0

I tried installing Plex Media Server on Ubuntu 15.04 but it didn't work because of the migration to systemd from Upstart. Unfortunately I can't seem to be able to uninstall it now either, since the callbacks error out and prevent dpkg from uninstalling the package. Is there a way to forcibly uninstall the package?

Here's what happens when I attempt to uninstall:

leslie@ubuntu:~$ sudo dpkg --remove plexmediaserver
(Reading database ... 191366 files and directories currently installed.)
Removing plexmediaserver (0.9.12.0.1071-7b11cfc) ...
Synchronizing state for plexmediaserver.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d plexmediaserver defaults
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
insserv: warning: script 'plexmediaserver' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plexmediaserver'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `plexmediaserver'
Executing /usr/sbin/update-rc.d plexmediaserver disable
update-rc.d: error: plexmediaserver Default-Start contains no runlevels, aborting.
dpkg: error processing package plexmediaserver (--remove):
 subprocess installed pre-removal script returned error exit status 1
OK
Synchronizing state for plexmediaserver.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d plexmediaserver defaults
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
insserv: warning: script 'plexmediaserver' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plexmediaserver'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `plexmediaserver'
Executing /usr/sbin/update-rc.d plexmediaserver enable
update-rc.d: error: plexmediaserver Default-Start contains no runlevels, aborting.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 plexmediaserver

/var/lib/dpkg/info/plexmediaserver.prerm:

#!/bin/sh

set -e

if [ `cat /etc/issue|cut -d"." -f1|sed 's/[^0-9]*//g'` -gt 14 ];
then
  systemctl stop plexmediaserver.service
  systemctl disable plexmediaserver.service
else
  if [ -e "/etc/init/plexmediaserver.conf" ]; then
  stop plexmediaserver || :
  fi
fi

/var/lib/dpkg/info/plexmediaserver.postrm:

#!/bin/sh
set -e
# Automatically added by dh_makeshlibs
if [ "$1" = "remove" ]; then
    ldconfig
fi
# End automatically added section
Lesleh
  • 145
  • Add the contents of /var/lib/dpkg/info/plexmediaserver.prerm and /var/lib/dpkg/info/plexmediaserver.postrm. Try commenting out any calls to update-rc.d in them. – muru May 04 '15 at 19:16
  • I added the contents of those two files. No reference to update-rc.d in them. – Lesleh May 04 '15 at 19:22
  • Try commenting out the call to systemctl disable. – muru May 04 '15 at 19:27
  • Aha, that did the trick. Could you post this as an answer so I can mark it as the solution? – Lesleh May 04 '15 at 19:31
  • 1
    A similar question is http://askubuntu.com/questions/617575/ and a related one is http://askubuntu.com/questions/600026/ . – JdeBP May 04 '15 at 22:03

1 Answers1

3

This line in the output:

Synchronizing state for plexmediaserver.service with sysvinit using update-rc.d...

suggests that systemctl is calling update-rc.d, and the only plausible line that does this is:

systemctl disable plexmediaserver.service

Commenting it out or cancelling out the error from it should do the trick.

muru
  • 197,895
  • 55
  • 485
  • 740
  • thanks, that helped me removing lxdm on the same way, commenting a update-rc.d lxdm disable call – mwm Sep 20 '17 at 20:31