Bug 214964 - useradd: uid XXX is not unique
useradd: uid XXX is not unique
Product: Fedora Hosted Projects
Classification: Retired
Component: mock (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Clark Williams
Depends On:
  Show dependency treegraph
Reported: 2006-11-10 05:36 EST by Ralf Corsepius
Modified: 2013-01-09 23:07 EST (History)
2 users (show)

See Also:
Fixed In Version: 0.9.7-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-03-07 17:05:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ralf Corsepius 2006-11-10 05:36:48 EST
Description of problem:
After having worked around
by adding 
config_opts['chroot_setup_cmd'] = 'groupinstall build-base build-minimal build'
to /etc/mock/redhat-73-i386.cfg

mock -r redhat-73-i386 init
aborts with:
Non-zero return value 4 on executing /usr/sbin/mock-helper chroot
/var/lib/mock/redhat-73-i386/root /bin/su - root -c "/usr/sbin/useradd -m -u
1002 -d /builddir mockbuild"

This error is bogus. uid 1002 is not being used on the guest system.

Version-Release number of selected component (if applicable):

How reproducible:
I am able to deterministically reproduce this effect on several fc6 machines
with selinux enabled. On an fc5 machine, with selinux disabled, this does not occur.

Steps to Reproduce:
1. Apply the fix mentioned above to /etc/mock/redhat-73-i386.
2. mock --debug -r redhat-73-i386 init

Actual results:
DEBUG: Executing /usr/sbin/mock-helper yum --installroot
/var/lib/mock/redhat-73-i386/root groupinstall build-base build-minimal build
DEBUG: Executing /usr/sbin/mock-helper chroot /var/lib/mock/redhat-73-i386/root
/bin/su - root -c "/usr/sbin/useradd -m -u 1002 -d /builddir mockbuild"
useradd: uid 1002 is not unique
DEBUG: Executing /usr/sbin/mock-helper umount /var/lib/mock/redhat-73-i386/root/proc
DEBUG: Executing /usr/sbin/mock-helper umount
Non-zero return value 4 on executing /usr/sbin/mock-helper chroot
/var/lib/mock/redhat-73-i386/root /bin/su - root -c "/usr/sbin/useradd -m -u
1002 -d /builddir mockbuild"

Expected results:

Additional info:
I presume this to be an selinux issue interferring between "host" and "guest"
resulting from using "/bin/su" on rh7 guests and not using "/sbin/runuser" as it
being used for newer "guests".

An "easy hack" to silence useradd and to let mock succeed would be to use
"useradd -o" in /usr/bin/mock. A proper solution probably would be add "some
appropriate selinux magic".
Comment 1 Ralf Corsepius 2006-12-13 15:54:44 EST
Comment 2 Clark Williams 2006-12-14 17:20:28 EST
I'm looking! Sorry I haven't responded sooner, but other issues at work have
been pressing.

It looks like we have a number of issues that seem to be triggered by SELinux
and I'm trying to figure out what's going on (since we really haven't modified
UID/GID handling in a while). 

Possibly we should add 'useradd' as a config value and let the rhl7 config file
override it to use 'useradd -o'?

Comment 3 Clark Williams 2008-03-07 17:05:28 EST
the great mock rewrite has done a number of things to clean up uid/gid handling
inside the build roots. One thing we've done is removed the launcher and now
manage privleges inside mock itself. 

Closing for now...

Note You need to log in before you can comment on or make changes to this bug.