acct-user/at fails vs clean exit if at daemon is running during emerge -e or similar * Package: acct-user/at-0:0 * Repository: gentoo * Maintainer: blueness@gentoo.org * USE: abi_x86_64 amd64 elibc_glibc kernel_linux userland_GNU * FEATURES: network-sandbox preserve-libs sandbox userpriv usersandbox >>> Unpacking source... >>> Source unpacked in /var/tmp/portage/acct-user/at-0/work >>> Preparing source in /var/tmp/portage/acct-user/at-0/work ... >>> Source prepared. >>> Configuring source in /var/tmp/portage/acct-user/at-0/work ... >>> Source configured. >>> Compiling source in /var/tmp/portage/acct-user/at-0/work ... >>> Source compiled. >>> Test phase [not enabled]: acct-user/at-0 >>> Install acct-user/at-0 into /var/tmp/portage/acct-user/at-0/image >>> Completed installing acct-user/at-0 into /var/tmp/portage/acct-user/at-0/image * Final size of build directory: 0 KiB * Final size of installed tree: 4 KiB * User at already exists * Updating user at usermod: user at is currently used by process 2002 * ERROR: acct-user/at-0::gentoo failed (postinst phase): * usermod failed * * Call stack: * ebuild.sh, line 136: Called pkg_postinst * environment, line 834: Called acct-user_pkg_postinst * environment, line 365: Called die * The specific snippet of code: * die "usermod failed"; # ps aux | grep 2002 at 2002 0.0 0.0 2308 120 ? Ss Dec23 0:00 /usr/sbin/atd
You should probably stop atd before removing that user.
(In reply to Mike Gilbert from comment #1) > You should probably stop atd before removing that user. Sorry, I misread the bug at first and forgot to remove this comment.
usermod aborts if we try to change the uid, username, or home directory of a user that currently has any processes running. I don't see any way to really avoid this other than stopping atd before you attempt to install acct-user/at.
*** Bug 888191 has been marked as a duplicate of this bug. ***
Hmm, perhaps there's room for improvement. One option would be to move this to preinst, so that package wouldn't be considered installed. We could also print instructions how to manually perform the update, so that the user could stop atd, update the user and restart it without having to retrigger the ebuild.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f06a34a08c256ca49f68ead9968738c49be6f0c commit 2f06a34a08c256ca49f68ead9968738c49be6f0c Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2023-06-24 16:52:13 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2023-06-26 18:57:38 +0000 acct-user.eclass: improve error message when usermod fails usermod refuses to update the home directory for a user with running processes. Output a more helpful message and avoid calling die for this. For other usermod failures, output stderr as an eerror message and die. Example output: * Failed to update user portage * This user currently has one or more running processes. * Please update this user manually with the following command: * usermod '--comment' 'System user; portage' '--home' '/var/lib/portage/home' '--shell' '/bin/bash' '--gid' 'portage' '--groups' '' portage Bug: https://bugs.gentoo.org/888189 Signed-off-by: Mike Gilbert <floppym@gentoo.org> eclass/acct-user.eclass | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)