Comment 10 for bug 1570310

Revision history for this message
John McPherson (john-mcpherson) wrote :

I have encountered this occasionally over several years, and have just had it happen on an install of Ubuntu 16.10 (clean install of 16.10, not upgraded from an earlier version).

The postinst script for systemd does

   addgroup --system systemd-journal

This gives the error
   addgroup: The group `systemd-journal' already exists and is not a system group. Exiting.
and package install fails.

$ dpkg -l systemd
||/ Name Version Architecture Description
+++-==============-============-============-=================================
iF systemd 231-9ubuntu3 amd64 system and service manager

The problem is that addgroup will return 0 for --system if the group exists and the gid is between FIRST_SYSTEM_GID and LAST_SYSTEM_GID, but these are not set in the default /etc/adduser.conf file, so 'addgroup --system systemd-journal' returns 1 instead:

# addgroup --system systemd-journal
addgroup: The group `systemd-journal' already exists and is not a system group. Exiting.
# echo $?
1

# echo 'FIRST_SYSTEM_GID=50' >> /etc/adduser.conf
# echo 'LAST_SYSTEM_GID=300' >> /etc/adduser.conf

# addgroup --system systemd-journal
addgroup: The group `systemd-journal' already exists as a system group. Exiting.
# echo $?
0

The postinst script should be modified to either test if the group already exists (and not rely on addgroup to do it silently), or do "addgroup --system systemd-journal || true" to ignore errors from addgroup.