package systemd-shim failed to install/during upgrade:to 18.04

Asked by Robert Parsons

I was running the software updater to install ubuntu 18.04, when I got the error message,
"Could not install systemd-shim."

I continued on with the install and got the message, "Could not install "/var/cache/apt/...deb" package."

I continued on with the install and got the message "Could not install upgrade."

I rebooted and it looks like it did upgrade most of the applications.

I ran the software updater and it tells me "Not all updates can be installed" and that I have to run a partial install. I do this and get the message "Could not install 'systemd-shim'. The upgrade has aborted. Your system could be in an unusable state. A recovery will run now (dpkg --configure -a)."

I tryed Synaptic and it tells me that systemd-shim is "Marked for removal". I try and Apply the change and get the error message "E: systemd-shim: installed systemd-shim package post-removal script subprocess returned error exit status 2".

So how do I fix this so that I can finish the install?

ProblemType: Package
DistroRelease: Ubuntu 18.04
Package: systemd-sysv 237-3ubuntu10.3
ProcVersionSignature: Ubuntu 4.15.0-32.35-generic 4.15.18
Uname: Linux 4.15.0-32-generic i686
NonfreeKernelModules: nvidia
ApportVersion: 2.20.9-0ubuntu7.2
Architecture: i386
Date: Fri Aug 17 12:16:55 2018
ErrorMessage: installed systemd-shim package post-removal script subprocess returned error exit status 2
InstallationDate: Installed on 2010-05-12 (3018 days ago)
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
Python3Details: /usr/bin/python3.6, Python 3.6.5, python3-minimal, 3.6.5-3ubuntu1
PythonDetails: /usr/bin/python2.7, Python 2.7.15rc1, python-minimal, 2.7.15~rc1-1
RelatedPackageVersions:
 dpkg 1.19.0.5ubuntu2
 apt 1.6.3
SourcePackage: systemd
Title: package systemd-sysv 237-3ubuntu10.3 failed to install/upgrade: installed systemd-shim package post-removal script subprocess returned error exit status 2
UpgradeStatus: Upgraded to bionic on 2018-08-17 (0 days ago)

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu systemd Edit question
Assignee:
No assignee Edit question
Solved by:
Robert Parsons
Solved:
Last query:
Last reply:
Revision history for this message
Robert Parsons (raparsons1) said :
#1

I hope to find a work arround for my problem

Revision history for this message
Robert Parsons (raparsons1) said :
#2

I performed the following command sudo dpkg --purge systemd-shim and got the following errors:

Removing systemd-shim (9-1bzr4ubuntu1) ...
Removing 'diversion of /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service to /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd by systemd-shim'
dpkg-divert: error: rename involves overwriting '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service' with
  different file '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd', not allowed
dpkg: error processing package systemd-shim (--purge):
 installed systemd-shim package post-removal script subprocess returned error exit status 2

Do I need to change the privileges on the file being overwritten? What is this file?

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

What is the output of the commands

cat /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service
cat /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd

Revision history for this message
Robert Parsons (raparsons1) said :
#4

The output of cat /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service is:

[D-BUS Service]
Name=org.freedesktop.systemd1
User=root
Exec=/usr/lib/i386-linux-gnu/systemd-shim

The output of cat /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd is:

[D-BUS Service]
Name=org.freedesktop.systemd1
Exec=/bin/false
User=root

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

Maybe this action helps as a workaround to get the package (which is obsolete) removed:

cd /usr/share/dbus-1/system-services/
sudo cp org.freedesktop.systemd1.service.systemd org.freedesktop.systemd1.service
sudo dpkg --purge systemd-shim

Revision history for this message
Robert Parsons (raparsons1) said :
#6

I did what you sugest but when I did the purge I got the following error again:

robert@robert-desktop:/usr/share/dbus-1/system-services$ sudo dpkg --purge systemd-shim
(Reading database ... 503793 files and directories currently installed.)
Removing systemd-shim (9-1bzr4ubuntu1) ...
Removing 'diversion of /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service to /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd by systemd-shim'
dpkg-divert: error: rename involves overwriting '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service' with
  different file '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd', not allowed
dpkg: error processing package systemd-shim (--purge):
 installed systemd-shim package post-removal script subprocess returned error exit status 2
Errors were encountered while processing:
 systemd-shim

Is there something else we can do?

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

My next suggestion would be to try removing the offending file.

sudo rm /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service
sudo dpkg --purge systemd-shim

Revision history for this message
Robert Parsons (raparsons1) said :
#8

IT WORKED MANFRED!!!

Thanks for all your help!!!!!

Revision history for this message
William Curley (william-curley-3) said :
#9

Yes, worked for me as well, where on a move from 16.04 to 18.04.2 I could not install 1) fontconfig 2) systemd-shim, and 3) systemd-shim. Question: could I have skipped to and used only the sudo rm /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service and sudo dpkg --purge systemd-shim commands? As it was, I worked through all the instructions. But, it worked. Thanks.