Ubuntu – apt-get upgrade – supervisor error

aptPHPsupervisordUbuntuubuntu-16.04

I have two Ubuntu 16.04.2 LTS servers on AWS. I wanted to patch them, but I'm getting an error that I can't figure out next steps.

sudo apt-get upgrade gives me:

Setting up supervisor (3.2.0-2ubuntu0.1) ...
insserv: script supervisor: service supervisor already provided!
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: error processing package supervisor (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 supervisor
E: Sub-process /usr/bin/dpkg returned an error code (1)

Based on other similar errors, I've tried:

sudo apt-get clean && sudo apt-get autoremove 
sudo apt-get -f install
sudo dpkg --configure -a

These server are far from "clean". They have been created as copies of copies. In terms of software, they have PHP 7.0, Laravel and are running Laravel queues under supervisor. But I don't know if that matters for this.

I've looked on the supervisor issues list, but I'm not finding any issues that seem to apply to me.

Best Answer

It appears that you have supervisor already installed through some other source. The insserv program manages the startup scripts and is failing to register this package's copy of supervisor because it already has a supervisor set to start up. Take a look at

grep Provides /etc/init.d/*

and see which script(s) claim to provide supervisor.

As for fixing this, you'll need to track down where the existing supervisor came from and update it the same way. If you run dpkg -S /etc/init.d/filename it will tell you if it came from some other package (maybe you've installed something from a PPA that bundled supervisor with another package?), if nothing comes up, then it is likely that the existing supervisor was installed manually from a binary download or built from source.

The other option would be to start up a clean 16.4 image and (if you want php7.1 instead of 7.0 or need other software that isn't in 16.4) locate maintained PPAs with the versions of software you need. Document everything you install, including the versions you installed, and where you got them from (especially if it was installed without a package), and test that your software will work on the image. You'll also want to keep track of dependencies, especially what required a given package. This is less important when using apt but if you're building things by hand you'll need to remember to check that app will work with the latest version of libfoo before upgrading libfoo. Investing this time now will make it much easier to maintain going forward.

Related Topic