Software Installation – Error About Upstart/Systemd with Runit Explained

runitsoftware installationupstart

I run sudo apt-get install git-all in Ubuntu 16.04 and see the following in the end

Setting up runit (2.1.2-3ubuntu1) ...
start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
dpkg: error processing package runit (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of git-daemon-run:
 git-daemon-run depends on runit; however:
  Package runit is not configured yet.

dpkg: error processing package git-daemon-run (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                      Errors were encountered while processing:
 runit
 git-daemon-run
E: Sub-process /usr/bin/dpkg returned an error code (1)

I get the error after rebooting my system also. It really blocks my whole system.
I run killall update-notifier. I run sudo apt-get install git-all but
I get the same error message. I run pgrep -a apt but get nothing as output. I run pgrep -a update but get nothing as output.
A bug report about the case here.

  • In Grub, Choose Advanced options > Ubuntu (Upstart) Linux kernel 4.22. Doing the same only in terminal without systemd causes the same error.

Why is this error here with runit?

Best Answer

Gerrit Pape, who maintains both xyr own runit and Bernstein's daemontools packages for Debian, is one of the few developers that took the idea of "init-system neutrality" (that was much bandied about after the Debian systemd hoo-hah) really to heart and has tried hard to support running these under van Smoorenburg init, upstart, and systemd.

The post-installation maintainer script for runit you will find unpacked on your system from the package somewhere such as /var/lib/dpkg/info/runit.postinst. As you can see, it tries to detect the presence of upstart and start the runsvdir upstart job if upstart is present. It does the same with systemd and runit.service.

Unfortunately, on Ubuntu 14 and later both systemd and upstart are installed. And so the post-installation maintainer script for the package is trying to run the upstart job with upstart's start command. Of course, upstart isn't (by default) the system-wide service manager in Ubuntu 15 and later, and upstart's start command fails to work.

The following is a rough idea of how to patch the script in order to overcome this:

…
if test -r /usr/share/debconf/confmodule; then
  . /usr/share/debconf/confmodule
  db_purge
fi

if test -d /run/systemd/system ; then
  systemctl start runit.service
elif test -x /sbin/start ; then
  /sbin/start runsvdir
fi

This is not ideal, but it is a beginning. runit.prerm and runit.postrm likewise require some adjustments.

Further reading

Related Question