unknown uid 0

Michael S. Zick mszick at morethan.org
Tue Feb 28 13:52:07 UTC 2006


On Tue February 28 2006 07:01, Tito wrote:
> On Tuesday 28 February 2006 08:44, you wrote:
> > hello Tito,
> >      Thanks for your reply.My /etc/passwd and /etc/shadow do exist,some 
> > other problem?
> >   
> > eric
> > 
> > On Friday 24 February 2006 08:18, lee eric wrote:
> > > hello all
> > >      I used busybox to build my linux.After i installed busybox,some=20
> > > command did not work.For example,wher i used 'passwd',it said 'unknown  uid 0'.
> > > What is the problem?How can i solve it? 
> > >                                                                    thanks
> > 
> > Maybe /etc/passwd or /etc/shadow are missing?
> > 
> > Ciao,
> > Tito
> Hi,
> the only place where this error message can be generated is:
> 
> passwd.c line 172: 	myname = (char *) bb_xstrdup(bb_getpwuid(NULL, getuid(), -1));
> 
> by looking at it:
> 
> getuid: as per man page :   These functions are always successful.
> 
> so it is bb_getpwuid which is failing:
> 
>  /* Hacked by Tito Ragusa (c) 2004 <farmatito at tiscali.it> to make it more
>   * flexible :
>   *
>   * if bufsize is > 0 char *name can not be set to NULL.
>   *                   On success username is written on the static allocated
>   *                   buffer name (and a pointer to it is returned).
>   *                   On failure uid as string is written to the static
>   *                   allocated buffer name and NULL is returned.
>   * if bufsize is = 0 char *name can be set to NULL.
>   *                   On success username is returned.
>   *                   On failure NULL is returned.
>   * if bufsize is < 0 char *name can be set to NULL
>   *                   On success username is returned.
>   *                   On failure an error message is printed and
>   *                   the program exits.
>   */
> 
> So or something is wrong with your /etc/passwd or /etc/shadow (formatting ?)
> or you are missing some libraries.
> 
> You can try:
> 
>  strace -o out.txt ./busybox passwd some_user
> 
> and inspect the out.txt file to see what is happening.
> 
> Remeber that depending on your .config busybox needs:
> 
> open("/etc/nsswitch.conf", O_RDONLY)    = 3
> open("/lib/tls/i686/cmov/libcrypt.so.1", O_RDONLY) = 3
> 
> and some lib_nss*.so libs
> 
> open("/lib/tls/i686/cmov/libnss_compat.so.2", O_RDONLY) = 3
> open("/lib/tls/i686/cmov/libnsl.so.1", O_RDONLY) = 3
> open("/lib/tls/i686/cmov/libnss_nis.so.2", O_RDONLY) = 3
> open("/lib/tls/i686/cmov/libnss_files.so.2", O_RDONLY) = 3      <---- at least this one if I remember correctly
>
Exactly which is required depends on the contents of
the /etc/nsswitch.conf file for the "passwd" function.

If it is: "passwd: compat" and recent glibc - then note
that libnss_compat.so.2 calls libnss_files.so.2

If recent glibc and no /etc/nsswitch.conf file, the default
behavior requires a minimum of: libnss_dns*, libnss_compat*, 
and libnss_files* (libnss_nis* would not hurt either).

You can check if you have all that are expected by cat'ing
/usr/include/gnu/lib-names.h or the like for your c library.

If not using glibc...
Note that BusyBox has its own implementation of getpwuid
in the tree (I have no clue as to when/if this gets used.)

Whatever the case, it is a weak symbol and should silently
fail at runtime if missing.

strace ... sounds like the thing to do at this point.
 
> So please check you have all the needed libraries.

Mike



More information about the busybox mailing list