Friday, 21 December 2007

DBUS: "Could not get password database information for UID of current process"

Recently I've been cross compiling DBUS and HAL to make them work on an embedded device with buildroot. It's been a bit of a journey with only sparse documentation available. There are lots of dependencies on things that often aren't present on embedded devices and it's not always easy to work out what they are. So, I'm going to try and document a few of the things I've come across here in the hope that someone finds it useful.

There are various reports of people getting this message but never any responses:

Starting system message bus: Could not get password database information for UID of current process: User "???" unknown or no memory to allocate password entry

This message appears despite /etc/passwd and /etc/group existing and looking correct.

The clue is in the message. It can't read this information because it is using glibc to do it. Glibc provides this information from various sources of which the passwd and group files are only one. It is necessary to enable the glibc back-end that reads the files (libnss_files) along with the library containing the generic functions (libnsl). This can be done in buildroot by enabling the BR2_GLIBC_NSL and BR2_GLIBC_NSS_FILES configuration options. Even better they can automatically be enabled when DBUS support is selected in buildroot by modifying the start of packages/dbus/Config.in to look something like:
config BR2_PACKAGE_DBUS
bool "dbus"
default n
select BR2_PACKAGE_EXPAT
select BR2_GLIBC_NSL
select BR2_GLIBC_NSS_FILES

I'm not sure why the lack of libnsl doesn't manifest itself as an error from ld.so - if it had then it would have been far more obvious what the cause was.

5 comments:

Anonymous said...

Hi,
I am currently trying to cross compile D-BUS for an ARM system but have run in to problem. I would like to install D-BUS in /usr/local but I have no write permissions to that directory on the server.
Unfortunately there is no
>make install install_root=/path/to/target so I do not no how to proceed. ./configure --prefix=/path does not work either.
Any ideas?

Mike said...

@ostersif: Try:

make DESTDIR=/path/to/target install

If you have further trouble have a look at how buildroot does it.

Anonymous said...

It worked perfect with DESTDIR. Where did you find it? I looked in the Makefile yesterday without finding it. I see it now but it is easier when I now what to look for : ) Anyway thanks a lot!

Mike said...

@ostersif: I think I found it originally by reading the buildroot or JTL makefiles.

See also: the automake manual.

Anonymous said...

DESTDIR was exactly what I was looking for. I see it now in the Makefile but it is easier when you what to look for.
Thank you so much!