• Bug#1099477: adduser: Re-adding existing system user fails, when * as p

    From Michael Musenbrock@21:1/5 to All on Tue Mar 4 00:00:02 2025
    Package: adduser
    Version: 3.143
    Severity: critical
    Justification: breaks unrelated software

    ## Add a new system user
    # adduser --system --group --home /var/lib/testuser testuser

    # echo $?

    0

    # id testuser
    uid=127(testuser) gid=138(testuser) groups=138(testuser)

    ## Re-Add the new system user
    # adduser --system --group --home /var/lib/testuser testuser
    warn: The home dir /var/lib/testuser you specified already exists.

    fatal: The system user `testuser' already exists. Exiting.

    ## Which seems to work fine
    # echo $?

    0

    ## Change it from locked to no password
    # sed -i 's/^testuser:\!:/testuser:\*:/g' /etc/shadow

    ## Re-Add the new system user
    # adduser --system --group --home /var/lib/testuser testuser
    warn: The home dir /var/lib/testuser you specified already exists.

    fatal: The system user `testuser' already exists. Exiting.

    ## Fails unexpected
    # echo $?
    13


    It looks like the check added in ee5cee1f32cc to addsysuser seems to be problematic:

    https://salsa.debian.org/debian/adduser/-/commit/ee5cee1f32ccaaf97c921c772fcc61dff0e4f053#fcb13654c5c3048ef5c4919c3aaf065a8c22cec6_562_568

    my $ret = existing_user_status($new_name, $new_uid);
    if ($ret == (EXISTING_FOUND|EXISTING_SYSTEM)) {
    # a user with this name already exists; it's a problem when it's not a system user
    log_fatal( mtx("The user `%s' already exists, but is not a system user. Exiting."), $new_name );
    exit( RET_WRONG_OBJECT_PROPERTIES );
    }

    This should be true if EXISTING_FOUND bit is set BUT EXISTING_SYSTEM is NOT set.

    With setting password to locked, it works, because existing_user_status sets the EXISTING_LOCKED bit too to $ret, which means this condition is not true anymore.

    hth, br m


    -- System Information:
    Debian Release: trixie/sid
    APT prefers unstable
    APT policy: (504, 'unstable'), (503, 'testing'), (502, 'experimental'), (500, 'unstable-debug'), (1, 'experimental-debug')
    Architecture: amd64 (x86_64)

    Kernel: Linux 6.12.17-amd64 (SMP w/16 CPU threads; PREEMPT)
    Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
    Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
    Shell: /bin/sh linked to /usr/bin/dash
    Init: systemd (via /run/systemd/system)
    LSM: AppArmor: enabled

    Versions of packages adduser depends on:
    ii passwd 1:4.17.3-1

    adduser recommends no packages.

    Versions of packages adduser suggests:
    ii cron 3.0pl1-194
    ii liblocale-gettext-perl 1.07-7+b1
    ii perl 5.40.1-2
    pn quota <none>

    -- debconf information:
    adduser/title:
    adduser/homedir-permission: true

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Debian Bug Tracking System@21:1/5 to All on Tue Mar 4 21:50:02 2025
    This is a multi-part message in MIME format...

    Your message dated Tue, 04 Mar 2025 20:41:39 +0000
    with message-id <E1tpZ59-003lp7-28@fasolo.debian.org>
    and subject line Bug#1099477: fixed in adduser 3.144
    has caused the Debian Bug report #1099477,
    regarding adduser: fails upgrade of packages with non-locked system accounts
    to be marked as done.

    This means that you claim that the problem has been dealt with.
    If this is not the case it is now your responsibility to reopen the
    Bug report if necessary, and/or fix the problem forthwith.

    (NB: If you are a system administrator and have no idea what this
    message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@bugs.debian.org
    immediately.)


    --
    1099477: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1099477
    Debian Bug Tracking System
    Contact owner@bugs.debian.org with problems

    Received: (at submit) by bugs.debian.org; 3 Mar 2025 22:50:54 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.6-bugs.debian.org_2005_01_02
    (2021-04-09) on buxtehude.debian.org
    X-Spam-Level:
    X-Spam-Status: No, score=-19.9 required=4.0 tests=BAYES_00,
    BODY_INCLUDES_PACKAGE,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,
    DKIM_VALID_EF,FOURLA,FREEMAIL_FROM,HAS_PACKAGE,MD5_SHA1_SUM,
    RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,
    XMAILER_REPORTBUG autolearn=ham autolearn_force=no
    version=3.4.6-bugs.debian.org_2005_01_02
    X-Spam-Bayes: score:0.0000 Tokens: new, 82; hammy, 150; neutral, 141; spammy,
    0. spammytokens: hammytokens:0.000-+--trixie, 0.000-+--sk:taint_o,
    0.000-+--sk:TAINT_O, 0.000-+--sk:taint_u, 0.000-+--sk:TAINT_U Return-path: <michael.musenbrock@gmx.at>
    Received: from mout.gmx.net ([212.227.15.18]:47769)
    by buxtehude.debian.org with e