1

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.

Randar Puust
  • 123
  • 5

2 Answers2

1

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.

DerfK
  • 19,313
  • 2
  • 35
  • 51
  • Thanks for the guidance. It gives me something to look into. Let me clarify two things in case I wasn't clear. First, I wasn't trying to intentionally install new software. All I was trying to do was patch the servers. They will be new production servers that are copies of the QA servers, so I wanted to make sure they had all security updates, etc. Second, I know where supervisor came from. I installed it since Laravel recommends it to run their queues. I guess I could back up the configs, uninstall it, patch it and then reconfigure it once supervisor is back on there. – Randar Puust Apr 03 '17 at 03:50
  • One more clarification. I keep detailed logs of the changes made to the servers and confirmed that the supervisor was installed via apt-get. Specifically "sudo apt-get install supervisor". So it wasn't installed from a binary download or from source. – Randar Puust Apr 03 '17 at 17:24
  • When I run the grep, the Provides is by /etc/init.d/supervisor and /etc/init.d/supervisord. So nothing seems out of the ordinary there. supervisor isn't actually doing that much, so will likely try to back up the configs, uninstall it, patch it and re-configure it. The only sad thing is that if it works, I need to do the same thing to a bunch of other servers. – Randar Puust Apr 03 '17 at 21:17
  • @RandarPuust In that case, it appears that you might have one package named "supervisor" and a different package named "supervisord" one of which should be uninstalled. Use the `dpkg -S` command to determine which file came from which package and remove one – DerfK Apr 03 '17 at 23:44
0

So it ends up that while diagnosing the issue, I stumbled onto the solution. @DerfK put me on the right trail. It ends up that even after "removing" supervisor and then patching the server, it was still there. This is even though I used apt-get to install supervisor in the first place.

# removed it    
sudo apt-get remove supervisor

# patched it
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt autoremove

# after a reboot, this still lists it as running 
service --status-all

Edit #2 I was reminded why it's important to keep detailed notes as you build a server. I found a note that said:

created a supervisord from https://raw.githubusercontent.com/Supervisor/initscripts/master/ubuntu
-Note: This should not have been necessary.  supervisor is supposed to run on startup, but it wasn't
sudo chmod +x /etc/init.d/supervisord
sudo update-rc.d supervisord defaults

So it ends up I did install supervisor the right way, but the startup was out of the ordinary as @DerfK alluded to. So the proper fix was to:

  1. Get rid of my /etc/init.d/supervisor and /etc/init.d/supervisord scripts
  2. sudo apt-get install supervisor
  3. After the install, it was important to go through the apt-get update, apt-get upgrade, apt-get dist-upgrade cycle after the install and before the reboot or supervisor wouldn't start for some reason.

So it's all fixed now.

Randar Puust
  • 123
  • 5