Bug 1316168 - "userdel -R" does not work
"userdel -R" does not work
Status: NEW
Product: Fedora
Classification: Fedora
Component: shadow-utils (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Tomas Mraz
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2016-03-09 09:56 EST by Miroslav Suchý
Modified: 2017-11-02 05:18 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
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 Miroslav Suchý 2016-03-09 09:56:33 EST
Description of problem:
"userdel --root" refuse to remove user in given chroot.

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

How reproducible:

Steps to Reproduce:
1. mock -r fedora-23-i386 --init
2. cat /var/lib/mock/fedora-23-i386/root/etc/passwd |grep mockbuild
3. LC_ALL=C sudo /usr/sbin/userdel --force -R /var/lib/mock/fedora-23-i386/root/ mockbuild
userdel: user 'mockbuild' does not exist

Actual results:
userdel: user 'mockbuild' does not exist

Expected results:
user mockbuild is removed
Comment 1 Miroslav Suchý 2016-03-09 10:05:19 EST
Step 3 in reproducer is
LC_ALL=C sudo /usr/sbin/userdel --force -R /var/lib/mock/fedora-23-i386/root/ -r mockbuild
I forgot to copy here the -r option.
Comment 2 Tomas Mraz 2016-03-17 11:37:54 EDT
The problem is that userdel uses getpwnam() call in the chroot and that unfortunately fails because in the 32bit chroot there is no libnss_files.so to parse the /etc/passwd and shadow.

The --root feature is unfortunately only half-implemented and not really fully thought through and upstream development is very slow.

I would say even in 64bit chroot it is very undesirable to run any such libc calls and the parsing should be done only by shadow-utils.
Comment 3 Tomas Mraz 2016-03-17 11:39:52 EDT
Before the -R is used widely, the code would have to be reviewed and these getpw... calls workarounded.
Comment 4 Fedora End Of Life 2016-11-24 10:59:36 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 5 Fedora End Of Life 2017-02-28 04:55:35 EST
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

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