<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On Wed, 3 Sep 2014 19:13:46 +0200 Eduard Bloch <a class="moz-txt-link-rfc2396E" href="mailto:edi@gmx.de"><edi@gmx.de></a>
    wrote:<br>
    <span style="white-space: pre;">> reassign 759740 adduser<br>
      > retitle 759740 --system --quiet ... still produces warnings
      and bad exit code<br>
      > thanks<br>
      ><br>
      > Hallo,<br>
      > * Andrew Patterson [Tue, Sep 02 2014, 03:24:10PM]:<br>
      ><br>
      > > I guess I don't understand. The current account seem
      perfectly valid, i.e., uid = 108. Why is the configure scripts
      trying to re-add the user if it already exists? I can re-add the
      user, but what ID should I use?<br>
      > ><br>
      > > I tried running adduser by hand and got what I think are
      the expected results:<br>
      > ><br>
      > > # adduser --quiet --system --group --no-create-home
      --home /var/cache/apt-cacher-ng apt-cacher-ng<br>
      > > adduser: The user `apt-cacher-ng' already exists.
      Exiting.<br>
      ><br>
      > Nope, those are not the expected results:<br>
      ><br>
      > Add a system user<br>
      > If called with one non-option argument and the --system
      option, adduser will add a<br>
      > system user. If a user with the same name already exists in
      the system uid range<br>
      > (or, if the uid is specified, if a user with that uid already
      exists), adduser will<br>
      > exit with a warning. This warning can be suppressed by adding
      "--quiet".<br>
      ><br>
      > Now I am also wondering what is going on. The last year's bug
      was clearly reproducible with UID being outside of the system UID
      range. Your problem apparently has a different reason, therefore I
      am reassigning this BR.<br>
      ><br>
      > > I am guessing I could delete the user, then rerun the
      configure script everything would fine.<br>
      ><br>
      > Yes and no... you would need to change the ownership of the
      the logdir/cachedir contents (chown -R...) but appart from that it
      should do the job.<br>
      ><br>
      > Thanks,<br>
      > Eduard.<br>
      ><br>
      ></span><br>
    <br>
    I downloaded the deb source for apt-cacher-ng and found this in<br>
    apt-cacher-ng.postinst:<br>
    <br>
    if [ "$1" = "configure" ]; then<br>
    <br>
       adduser --quiet --system --group --no-create-home --home $CDIR
    $NAME<br>
    <br>
       for x in $CDIR $LDIR ; do <br>
          if [ ! -d "$x" ]; then<br>
             install -d -g $NAME -o $NAME -m2755 "$x"<br>
          fi<br>
       done<br>
    <br>
    So the script is not checking if the user exists before adding<br>
    it. Should configure be run when upgrading the package?<br>
    <br>
    One possible complication I may be running into is that I am using<br>
    LDAP for user accounts with uid > 2000, which would fail if<br>
    apt-cacher-ng was trying to create a user in the range. But I think<br>
    the problem here is solely that the account already exists and the<br>
    code should be more like:<br>
    <br>
    <br>
    if [ "$1" = "configure" ]; then<br>
    <br>
       if getent passwd $NAME; then<br>
          : # Or pehaps remove the user and re-add.<br>
       else<br>
          adduser --quiet --system --group --no-create-home --home $CDIR
    $NAME<br>
       fi<br>
    <br>
    -- Andrew<br>
    <br>
  </body>
</html>