Discussion:
unknown uid 0
lee eric
2006-02-24 05:35:04 UTC
Permalink
hello all
I used busybox to build my linux.After i installed busybox,some
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

_________________________________________________________________
ÏíÓÃÊÀœçÉÏ×îŽóµÄµç×ÓÓÊŒþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com
Tito
2006-02-24 06:09:59 UTC
Permalink
Post by lee eric
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 ui=
d=20
Post by lee eric
0'.What is the problem?How can i solve it?
thanks
Maybe /etc/passwd or /etc/shadow are missing?

Ciao,
Tito
Post by lee eric
_________________________________________________________________
=CF=ED=D3=C3=CA=C0=BD=E7=C9=CF=D7=EE=B4=F3=B5=C4=B5=E7=D7=D3=D3=CA=BC=FE=
=CF=B5=CD=B3=A1=AA MSN Hotmail=A1=A3 http://www.hotmail.com =20
Post by lee eric
=20
_______________________________________________
busybox mailing list
http://busybox.net/cgi-bin/mailman/listinfo/busybox
=20
Michael S. Zick
2006-02-24 12:24:08 UTC
Permalink
Post by lee eric
hello all
I used busybox to build my linux.After i installed busybox,some
command did not work.For example,wher i used 'passwd',it said 'unknown uid
0'.What is the problem?How can i solve it?
You need to create your /etc/passwd and /etc/group files for root:root (0:0)
with something other than busybox.
BusyBox does not do uid or gid 0

Just look at those entries on your build system for the line layout required.

Mike
Rob Landley
2006-02-24 14:35:39 UTC
Permalink
Post by lee eric
hello all
I used busybox to build my linux.After i installed busybox,some
command did not work.For example,wher i used 'passwd',it said 'unknown uid
0'.What is the problem?How can i solve it?
Add an /etc/passwd file that mentions the root user?

Or check the FAQ section that refers you to documents on building systems,
which is outside the scope of busybox because busybox is a component of a
Linux system but not a complete Linux system by itself? (Can't even boot it
without a kernel. A filesystem with the right directories is nice. Then
there's init scripts that mount /proc and /sys and run mdev and such...)

Rob
--
Never bet against the cheap plastic solution.
Tito
2006-02-28 11:02:04 UTC
Permalink
hello Tito,
Thanks for your reply.My /etc/passwd and /etc/shadow do exist,some
other problem?
eric
Post by lee eric
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 <***@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

So please check you have all the needed libraries.

Ciao,
Tito
Michael S. Zick
2006-02-28 11:52:18 UTC
Permalink
Post by Tito
hello Tito,
Thanks for your reply.My /etc/passwd and /etc/shadow do exist,some
other problem?
eric
Post by lee eric
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,
passwd.c line 172: myname = (char *) bb_xstrdup(bb_getpwuid(NULL, getuid(), -1));
getuid: as per man page : These functions are always successful.
*
* 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.
strace -o out.txt ./busybox passwd some_user
and inspect the out.txt file to see what is happening.
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.
Post by Tito
So please check you have all the needed libraries.
Mike
Rob Landley
2006-03-01 14:57:27 UTC
Permalink
Post by Michael S. Zick
Note that BusyBox has its own implementation of getpwuid
in the tree (I have no clue as to when/if this gets used.)
CONFIG_USE_BB_PWD_GROUP. Look at the top of the Login Utils menu.

Rob
--
Never bet against the cheap plastic solution.
Rob Landley
2006-03-01 16:57:29 UTC
Permalink
Post by Michael S. Zick
Note that BusyBox has its own implementation of getpwuid
in the tree (I have no clue as to when/if this gets used.)
CONFIG_USE_BB_PWD_GROUP. Look at the top of the Login Utils menu.

Rob
--
Never bet against the cheap plastic solution.
Michael S. Zick
2006-02-28 13:52:07 UTC
Permalink
Post by Tito
hello Tito,
Thanks for your reply.My /etc/passwd and /etc/shadow do exist,some
other problem?
eric
Post by lee eric
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,
passwd.c line 172: myname = (char *) bb_xstrdup(bb_getpwuid(NULL, getuid(), -1));
getuid: as per man page : These functions are always successful.
/* Hacked by Tito Ragusa (c) 2004 <farmatito at tiscali.it> to make it more
*
* 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.
strace -o out.txt ./busybox passwd some_user
and inspect the out.txt file to see what is happening.
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.
Post by Tito
So please check you have all the needed libraries.
Mike
lee eric
2006-02-24 07:18:00 UTC
Permalink
hello all
I used busybox to build my linux.After i installed busybox,some
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

_________________________________________________________________
??????????????? MSN Hotmail? http://www.hotmail.com
Tito
2006-02-24 08:09:50 UTC
Permalink
Post by lee eric
hello all
I used busybox to build my linux.After i installed busybox,some
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
Post by lee eric
_________________________________________________________________
??????????????? MSN Hotmail? http://www.hotmail.com
_______________________________________________
busybox mailing list
busybox at busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
Michael S. Zick
2006-02-24 14:24:02 UTC
Permalink
Post by lee eric
hello all
I used busybox to build my linux.After i installed busybox,some
command did not work.For example,wher i used 'passwd',it said 'unknown uid
0'.What is the problem?How can i solve it?
You need to create your /etc/passwd and /etc/group files for root:root (0:0)
with something other than busybox.
BusyBox does not do uid or gid 0

Just look at those entries on your build system for the line layout required.

Mike
Rob Landley
2006-02-24 16:35:31 UTC
Permalink
Post by lee eric
hello all
I used busybox to build my linux.After i installed busybox,some
command did not work.For example,wher i used 'passwd',it said 'unknown uid
0'.What is the problem?How can i solve it?
Add an /etc/passwd file that mentions the root user?

Or check the FAQ section that refers you to documents on building systems,
which is outside the scope of busybox because busybox is a component of a
Linux system but not a complete Linux system by itself? (Can't even boot it
without a kernel. A filesystem with the right directories is nice. Then
there's init scripts that mount /proc and /sys and run mdev and such...)

Rob
--
Never bet against the cheap plastic solution.
Tito
2006-02-28 13:01:47 UTC
Permalink
hello Tito,
Thanks for your reply.My /etc/passwd and /etc/shadow do exist,some
other problem?
eric
Post by lee eric
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

So please check you have all the needed libraries.

Ciao,
Tito
Continue reading on narkive:
Loading...