package systemd 229-4ubuntu4 failed to install/upgrade: subprocess installed pre-removal script returned error exit status 2

Bug #1570310 reported by Sanjeev Solanki
542
This bug affects 113 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Won't Fix
High
Dimitri John Ledkov

Bug Description

I was upgrading from 15.10 to 16.04 when this error occur.

ProblemType: Package
DistroRelease: Ubuntu 16.04
Package: systemd 229-4ubuntu4
ProcVersionSignature: Ubuntu 4.4.0-18.34-generic 4.4.6
Uname: Linux 4.4.0-18-generic x86_64
ApportVersion: 2.20.1-0ubuntu1
Architecture: amd64
Date: Wed Apr 13 21:41:53 2016
DpkgTerminalLog:
 Preparing to unpack .../systemd_229-4ubuntu4_amd64.deb ...
 De-configuring udev (225-1ubuntu9.1) ...
 dpkg: error processing archive /var/cache/apt/archives/systemd_229-4ubuntu4_amd64.deb (--unpack):
  subprocess installed pre-removal script returned error exit status 2
DuplicateSignature:
 De-configuring udev (225-1ubuntu9.1) ...
 dpkg: error processing archive /var/cache/apt/archives/systemd_229-4ubuntu4_amd64.deb (--unpack):
  subprocess installed pre-removal script returned error exit status 2
ErrorMessage: subprocess installed pre-removal script returned error exit status 2
InstallationDate: Installed on 2016-01-08 (96 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422)
Lsusb:
 Bus 002 Device 002: ID 0781:5583 SanDisk Corp.
 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 001 Device 003: ID 04f2:b483 Chicony Electronics Co., Ltd
 Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
MachineType: ASUSTeK COMPUTER INC. X455LJ
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.4.0-18-generic root=UUID=70fa96eb-e0d8-4e65-b049-9cb150759b40 ro quiet splash vt.handoff=7
RelatedPackageVersions:
 dpkg 1.18.4ubuntu1
 apt 1.2.10
SourcePackage: systemd
SystemdDelta:
 [EXTENDED] /etc/systemd/system/display-manager.service → /lib/systemd/system/display-manager.service.d/xdiagnose.conf
 [EXTENDED] /lib/systemd/system/rc-local.service → /lib/systemd/system/rc-local.service.d/debian.conf
 [EXTENDED] /lib/systemd/system/systemd-timesyncd.service → /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf

 3 overridden configuration files found.
Title: package systemd 229-4ubuntu4 failed to install/upgrade: subprocess installed pre-removal script returned error exit status 2
UpgradeStatus: Upgraded to xenial on 2016-04-13 (0 days ago)
dmi.bios.date: 04/22/2015
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: X455LJ.203
dmi.board.asset.tag: ATN12345678901234567
dmi.board.name: X455LJ
dmi.board.vendor: ASUSTeK COMPUTER INC.
dmi.board.version: 1.0
dmi.chassis.asset.tag: ATN12345678901234567
dmi.chassis.type: 10
dmi.chassis.vendor: ASUSTeK COMPUTER INC.
dmi.chassis.version: 1.0
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrX455LJ.203:bd04/22/2015:svnASUSTeKCOMPUTERINC.:pnX455LJ:pvr1.0:rvnASUSTeKCOMPUTERINC.:rnX455LJ:rvr1.0:cvnASUSTeKCOMPUTERINC.:ct10:cvr1.0:
dmi.product.name: X455LJ
dmi.product.version: 1.0
dmi.sys.vendor: ASUSTeK COMPUTER INC.

Revision history for this message
Sanjeev Solanki (sanjeev-solanki) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Martin Pitt (pitti) wrote :

systemd.prerm does not do much really, so I figure it's one of the dpkg-maintscript-helper mv_conffile calls that failed. Can you please enable some debugging with

  sudo sed -i '2 s/^.*/set -x/' /var/lib/dpkg/info/systemd.prerm
  sudo apt-get install --reinstall systemd

and see if you still get this error? Please copy&paste the entire output.

Changed in systemd (Ubuntu):
status: New → Incomplete
Revision history for this message
Robert Howerton (whowertoniii) wrote :

Hi Martin,

Thanks for the help, those two commands fixed the issue for me.

Revision history for this message
Martin Pitt (pitti) wrote :

Hmm, they weren't actually supposed to fix the problem but to reproduce it again with some debug logging, to see what's going on.. This got quite a number of duplicates, and so far I don't yet have an idea what causes this.

Thank you, though!

Revision history for this message
heppe (heppew) wrote : Re: [Bug 1570310] Re: package systemd 229-4ubuntu4 failed to install/upgrade: subprocess installed pre-removal script returned error exit status 2

I don't know if it was in the log that was generated, but the error said that systemd package had a dependency on an ubuntu21-something package, while ubuntu23-something was installed. So maybe there is something in de dependencies of the package or else maybe something in the order of the updates?

      Van: Martin Pitt <email address hidden>
 Aan: <email address hidden>
 Verzonden: maandag 25 april 15:14 2016
 Onderwerp: [Bug 1570310] Re: package systemd 229-4ubuntu4 failed to install/upgrade: subprocess installed pre-removal script returned error exit status 2

Hmm, they weren't actually supposed to fix the problem but to reproduce
it again with some debug logging, to see what's going on.. This got
quite a number of duplicates, and so far I don't yet have an idea what
causes this.

Thank you, though!

--
You received this bug notification because you are subscribed to a
duplicate bug report (1573196).
https://bugs.launchpad.net/bugs/1570310

Title:
  package systemd 229-4ubuntu4 failed to install/upgrade: subprocess
  installed pre-removal script returned error exit status 2

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1570310/+subscriptions

Revision history for this message
$username (zxs-unseen) wrote :

I got it from the upgrade of 15 -> 16 too.

Revision history for this message
Pedric (pedric) wrote :

Reinstalling systemd fixed it for me as well.

Revision history for this message
Steven Collins (stevencollins) wrote :

@pitti, This is probably not useful, since I just ran aptitude as soon as the upgrade to 16 completed with errors, and had it fix the broken packages (with no problems). So systemd seems to be installed fine for me too, now. Just in case there is some clue, though, here is the current output from the two debug commands you mentioned:

steven@goliath:~$ sudo sed -i '2 s/^.*/set -x/' /var/lib/dpkg/info/systemd.prerm
steven@goliath:~$ sudo apt-get install --reinstall systemd
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/3,643 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 186822 files and directories currently installed.)
Preparing to unpack .../systemd_229-4ubuntu4_amd64.deb ...
+ set -e
+ [ upgrade = remove ]
+ dpkg-maintscript-helper rm_conffile /etc/X11/xinit/xinitrc.d/50-systemd-user.sh 228-3~ -- upgrade 229-4ubuntu4
+ dpkg-maintscript-helper rm_conffile /etc/dbus-1/system.d/org.freedesktop.machine1.conf 228-5~ -- upgrade 229-4ubuntu4
+ dpkg-maintscript-helper mv_conffile /etc/systemd/systemd-journald.conf /etc/systemd/journald.conf 204-1~ -- upgrade 229-4ubuntu4
+ dpkg-maintscript-helper mv_conffile /etc/systemd/systemd-logind.conf /etc/systemd/logind.conf 204-1~ -- upgrade 229-4ubuntu4
+ dpkg-maintscript-helper rm_conffile /etc/bash_completion.d/systemd-bash-completion.sh 204-1~ -- upgrade 229-4ubuntu4
+ dpkg-maintscript-helper rm_conffile /etc/bash_completion.d/systemctl-bash-completion.sh 204-1~ -- upgrade 229-4ubuntu4
Unpacking systemd (229-4ubuntu4) over (229-4ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for dbus (1.10.6-1ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up systemd (229-4ubuntu4) ...
addgroup: The group `systemd-journal' already exists as a system group. Exiting.
steven@goliath:~$

Ari Dwi Utomo (uwitomo)
Changed in systemd (Ubuntu):
status: Incomplete → Opinion
Martin Pitt (pitti)
Changed in systemd (Ubuntu):
status: Opinion → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for systemd (Ubuntu) because there has been no activity for 60 days.]

Changed in systemd (Ubuntu):
status: Incomplete → Expired
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.

Changed in systemd (Ubuntu):
status: Expired → Confirmed
Changed in systemd (Ubuntu):
importance: Undecided → High
Changed in systemd (Ubuntu):
assignee: nobody → Dimitri John Ledkov (xnox)
milestone: none → ubuntu-17.03
Dan Streetman (ddstreet)
Changed in systemd (Ubuntu):
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.