[Adduser-devel] Bug#759740: apt-cache-ng: user apt-cacher-ng already exists error when upgrading

Andrew Patterson andrew.patterson at hp.com
Wed Sep 3 18:53:32 UTC 2014

On Wed, 3 Sep 2014 19:13:46 +0200 Eduard Bloch <edi at gmx.de> wrote:
> reassign 759740 adduser
> retitle 759740 --system --quiet ... still produces warnings and bad exit code
> thanks
> Hallo,
> * Andrew Patterson [Tue, Sep 02 2014, 03:24:10PM]:
> > 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?
> >
> > I tried running adduser by hand and got what I think are the expected results:
> >
> > # adduser --quiet --system --group --no-create-home --home /var/cache/apt-cacher-ng apt-cacher-ng
> > adduser: The user `apt-cacher-ng' already exists. Exiting.
> Nope, those are not the expected results:
> Add a system user
> If called with one non-option argument and the --system option, adduser will add a
> system user. If a user with the same name already exists in the system uid range
> (or, if the uid is specified, if a user with that uid already exists), adduser will
> exit with a warning. This warning can be suppressed by adding "--quiet".
> 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.
> > I am guessing I could delete the user, then rerun the configure script everything would fine.
> 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.
> Thanks,
> Eduard.

I downloaded the deb source for apt-cacher-ng and found this in

if [ "$1" = "configure" ]; then

   adduser --quiet --system --group --no-create-home --home $CDIR $NAME

   for x in $CDIR $LDIR ; do
      if [ ! -d "$x" ]; then
         install -d -g $NAME -o $NAME -m2755 "$x"

So the script is not checking if the user exists before adding
it. Should configure be run when upgrading the package?

One possible complication I may be running into is that I am using
LDAP for user accounts with uid > 2000, which would fail if
apt-cacher-ng was trying to create a user in the range. But I think
the problem here is solely that the account already exists and the
code should be more like:

if [ "$1" = "configure" ]; then

   if getent passwd $NAME; then
      : # Or pehaps remove the user and re-add.
      adduser --quiet --system --group --no-create-home --home $CDIR $NAME

-- Andrew

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/adduser-devel/attachments/20140903/02108e60/attachment.html>

More information about the Adduser-devel mailing list