re[2]: [suse-programming-e] useradd

You might want to look into why Yast2 fails.
Same basic problem. /etc/passwd+ is created, rename() fails. The below is part of strace -f yast2. [pid 21991] open("/etc/passwd+", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 11 [pid 21991] umask(022) = 0777 [pid 21991] fchown32(0xb, 0, 0) = 0 [pid 21991] fchmod(11, 0644) = 0 [pid 21991] fstat64(11, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 [pid 21991] old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x401eb000 [pid 21991] write(11, "root:x:0:0:root:/root:/bin/bash\n"..., 2396) = 2396 [pid 21991] fsync(11) = 0 [pid 21991] close(11) = 0 [pid 21991] munmap(0x401eb000, 4096) = 0 [pid 21991] rename("/etc/passwd+", "/etc/passwd") = -1 EBUSY (Device or resource busy) [pid 21991] open("/usr/share/locale/en_US/LC_MESSAGES/shadow.mo", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 21991] open("/usr/share/locale/en/LC_MESSAGES/shadow.mo", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 21991] write(2, "useradd: cannot rewrite password"..., 38) = 38 Greg

* Greg Freemyer (freemyer@norcrossgroup.com) [030327 16:15]:
[pid 21991] rename("/etc/passwd+", "/etc/passwd") = -1 EBUSY (Device or resource busy)
That sounds like what should happen. From rename(2): EBUSY The rename fails because oldpath or newpath is a directory that is in use by some process (perhaps as current working directory, or as root directory, or because it was open for reading) or is in use by the system (for example as mount point), while the system considers this an error. (Note that there is no requirement to return EBUSY in such cases - there is nothing wrong with doing the rename anyway - but it is allowed to return EBUSY if the system cannot otherwise handle such situations.) It's easy to duplicate this and see that's it's nothing specific to yast or useradd: hades:/tmp # mkdir test && touch test/motd hades:/tmp # mount --bind /etc/motd test/motd hades:/tmp # mv test/motd test/foo mv: cannot move `test/motd' to `test/foo': Device or resource busy I don't think you mentioned why you want your passwd and shadow file in a directory other than /etc/ but you can probably do this chroot. -- -ckm
participants (2)
-
Christopher Mahmood
-
Greg Freemyer