1

linux noob here. Been trying to setup git and having some difficulty setting up a repository and linking it to git hub. But that is another issue. while trying to figure this out I used the following commands one after another at various times to try and install the correct packages I need

apt-get install git
apt-get install git-core

and finally

apt-get install git-all

While running the last command I received the following error

 E: Sub-process /usr/bin/dpkg returned an error code (1)

I have searched the site to try and find a solution but it seems to be case dependent so I ran

sudo apt-get install -f

and got the following output

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer     required:
linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-headers- 4.4.0-38
linux-headers-4.4.0-38-generic linux-image-4.4.0-31-generic
linux-image-4.4.0-38-generic linux-image-extra-4.4.0-31-generic
linux-image-extra-4.4.0-38-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
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 it 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)

Can someone tell me which file is causing the error and how I can fix it. Also some details as to why this happens or any useful info would be greatly appreciated. Thanks

muru
  • 197,895
  • 55
  • 485
  • 740

2 Answers2

0

it's not a rare problem, the problem is runit package, try this simple solution:

$ sudo apt-get purge runit
$ sudo apt-get purge git-all
$ sudo apt-get purge git
$ sudo apt-get autoremove
$ sudo apt update
$ sudo apt install git

Edit: Upstart no longer supported in latest Ubuntu versions. If for some reason anyone really wants to run with upstart they can install this: sudo apt install upstart-sysv

elichai2
  • 681
  • 6
  • 14
  • I have tried that. I am looking to install git-all. git installs no problem, but git-all produces the same result – 0_insomniac_0 Oct 24 '16 at 19:56
  • instead of purging runit, try running this line: sudo dpkg -r --force-all runit then purge all the other things and install runit with the -f sudo apt -f install runit – elichai2 Oct 24 '16 at 20:14
  • Now getting this errorDo you want to continue? [Y/n] y 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 Errors were encountered while processing: runit E: Sub-process /usr/bin/dpkg returned an error code (1) – 0_insomniac_0 Oct 24 '16 at 20:16
  • this will fix it, but I must say. it's not the recommended way to fix it. they removed the package for a reason. sudo apt install upstart-sysv – elichai2 Oct 24 '16 at 20:27
  • Thanks, I just read an answer on another question that says Ubuntu changed from Upstart to systemd from version 15. Is that true? and if it is why is apt trying to connect to it on version 16? (I really don't even understand what any of these terms mean) – 0_insomniac_0 Oct 24 '16 at 20:32
  • Please [edit] your answer to include anything new you have mentioned in the comments that the OP should do in regards to solving the problem. –  Oct 24 '16 at 21:18
0

After a little research I discovered the bug has something to do with the fact that ubuntu 16.4.1 no longer runs Upstart. (Turns out the question has been answered already so appologies for that) Versions from ubuntu 15 onwards use systemd. Answer in the link below. Thanks to all who posted solutions

Failed to connect to socket /com/ubuntu/upstart: Connection refused: Errors were encountered while processing: runit

  • that's right. and if for some reason you really want to run it, you can make upstart work again by installing this: sudo apt install upstart-sysv – elichai2 Oct 25 '16 at 14:54