On a fresh install of Ubuntu 16.04 apt-get install git-all fails with:
Setting up runit (2.1.2-3ubuntu1) ...
start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
Some other packages such as dconf-tools fail with the same error.
The error message refers to upstart, and upstart is installed on the system but it's not running. Instead the system uses systemd:
dpkg: ii upstart 1.13.2-0ubuntu21 amd64 event-based init daemon - essential binaries
ps aux: root 1 0.2 0.0 185368 484 ? Ss 16:43 0:02 /sbin/init auto noprompt
ls -l: /sbin/init -> /lib/systemd/systemd
The error message also refers to runit. Downloading the runit .deb package and unpacking it shows the problem is the postinstall script. The postinstall script first tries to start runit using init, then systemd and then upstart.
The problem is, even though runit is successfuly started by systemd the postinstall script will later try to use upstart. Since upstart is not running it cannot be connected to, which then causes the error "... Failed to connect to socket /com/ubuntu/upstart..."
Here is the line where runit is started by systemd:
test ! -d /run/systemd/system || systemctl start runit.service
If systemctl start runit, then at this point the script should stop.
Instead several lines later at the end of the file upstart is tried:
if [ -x /sbin/start ]; then #provided by upstart
/sbin/start runsvdir
fi
Workaround: Install runit
Steps:
If needed, purge failed packages such as git-all, git-daemon-run
apt-get update
rm /sbin/start
apt-get install runit # can also install git-all and runit will also be installed
ln -s /sbin/initctl /sbin/initctl
apt-get install git-all # or other package such as dconf-tools
(all commands require sudo)
fix: Change the logic in the postinstall script in the runit .deb package to not start runit by upstart if it has already been started by systemd
All individual git packages such as git-el can be installed separately - except git-daemon-run which is the package in git-all needing runit. Other packages requiring runit(e.g., dconf-tools) can also be installed using the workaround. Once the runit package is successfuly installed the workaround is no longer needed. If git-all is successfuly installed using the workaround then runit is also successfully installed and no other packages will fail with "Failed to connect to socket /com/ubuntu/upstart: Connection refused." It goes without saying there is not an upstart bug and only going back to upstart will solve it...
BTW - a fresh install of 16.04 server does not have upstart installed so git-all installs with no errors.
On a fresh install of Ubuntu 16.04 apt-get install git-all fails with:
Setting up runit (2.1.2-3ubuntu1) ... upstart: Connection refused
start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/
Some other packages such as dconf-tools fail with the same error.
The error message refers to upstart, and upstart is installed on the system but it's not running. Instead the system uses systemd:
dpkg: ii upstart 1.13.2-0ubuntu21 amd64 event-based init daemon - essential binaries systemd
ps aux: root 1 0.2 0.0 185368 484 ? Ss 16:43 0:02 /sbin/init auto noprompt
ls -l: /sbin/init -> /lib/systemd/
The error message also refers to runit. Downloading the runit .deb package and unpacking it shows the problem is the postinstall script. The postinstall script first tries to start runit using init, then systemd and then upstart.
The problem is, even though runit is successfuly started by systemd the postinstall script will later try to use upstart. Since upstart is not running it cannot be connected to, which then causes the error "... Failed to connect to socket /com/ubuntu/ upstart. .."
Here is the line where runit is started by systemd:
test ! -d /run/systemd/system || systemctl start runit.service
If systemctl start runit, then at this point the script should stop.
Instead several lines later at the end of the file upstart is tried:
if [ -x /sbin/start ]; then #provided by upstart
/sbin/start runsvdir
fi
Workaround: Install runit
Steps:
If needed, purge failed packages such as git-all, git-daemon-run
apt-get update
rm /sbin/start
apt-get install runit # can also install git-all and runit will also be installed
ln -s /sbin/initctl /sbin/initctl
apt-get install git-all # or other package such as dconf-tools
(all commands require sudo)
fix: Change the logic in the postinstall script in the runit .deb package to not start runit by upstart if it has already been started by systemd
All individual git packages such as git-el can be installed separately - except git-daemon-run which is the package in git-all needing runit. Other packages requiring runit(e.g., dconf-tools) can also be installed using the workaround. Once the runit package is successfuly installed the workaround is no longer needed. If git-all is successfuly installed using the workaround then runit is also successfully installed and no other packages will fail with "Failed to connect to socket /com/ubuntu/ upstart: Connection refused." It goes without saying there is not an upstart bug and only going back to upstart will solve it...
BTW - a fresh install of 16.04 server does not have upstart installed so git-all installs with no errors.