Monday, June 19, 2017

dpkg - Not able to `sudo apt install` anything



I had been experimenting with a software called topgrade ever since then I ran into some problems on my system which was previously working fine. It started with not being able to launch vscode from the command line using code (even though it was installed and I could launch it by pressing the window key and looking it up) then I discovered that my apt is also broken. Whenever I tried installing anything using apt it would get stuck at



Setting up mysql-server-5.7 (5.7.27-0ubuntu0.16.04.1) ...
insserv: warning: current start runlevel(s) (empty) of script `mysql' overrides LSB defaults (2 3 4 5).

insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `mysql' overrides LSB defaults (0 1 6).



So I closed the terminal in which the install was running and tried to install it in another terminal but the dpkg lock frontend error started coming up so I tried killing all the apt processes and ran the install again but the dpkg lock error still showed up so I went ahead and deleted the lock-frontend file still things didn't work



Did a reboot tried apt install again and I was asked to configure dpkg so I ran sudo dpkg --configure -a and it was again stuck at the mysql-server setup.



So I tried the solution in this post to fix the mysql-server from hanging Ubuntu update stops while configuring mysql-server-5.7




It worked at least the mysql server doesn't hang anymore but when I ran sudo dpkg --configure -a and got the following log https://pastebin.com/nwcAcZW8 which now shows a git-daemon-run error and I get the same error when I try to run apt install



After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
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
No apport report written because the error message indicates its a followup error from a previous failure.
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
Errors were encountered while processing:
runit
git-daemon-run
E: Sub-process /usr/bin/dpkg returned an error code (1)




sudo apt-get purge runit
sudo apt-get autoremove
sudo apt update
sudo apt install runit


So I purged runit and tried to install it again and go the following error




The following NEW packages will be installed:
fgetty runit
0 upgraded, 2 newly installed, 0 to remove and 205 not upgraded.
Need to get 121 kB of archives.
After this operation, 567 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://it-mirrors.evowise.com/ubuntu xenial/universe amd64 fgetty amd64 0.7-1 [18.9 kB]
Get:2 http://it-mirrors.evowise.com/ubuntu xenial/universe amd64 runit amd64 2.1.2-3ubuntu1 [102 kB]
Fetched 121 kB in 1s (62.8 kB/s)
Selecting previously unselected package fgetty.

(Reading database ... 538427 files and directories currently installed.)
Preparing to unpack .../fgetty_0.7-1_amd64.deb ...
Unpacking fgetty (0.7-1) ...
Selecting previously unselected package runit.
Preparing to unpack .../runit_2.1.2-3ubuntu1_amd64.deb ...
Unpacking runit (2.1.2-3ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Setting up fgetty (0.7-1) ...

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
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
runit
E: Sub-process /usr/bin/dpkg returned an error code (1)




Update



I tried the solution suggested by @karel in their answer and when I executed the last command to reinstall runit I got the following error



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
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:

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



To remove the dpkg: error processing package runit (--configure): error open the terminal and type:



sudo dpkg --configure -a # instruct dpkg to "fix" itself
sudo apt-get -f install # correct dependencies and continue to configure your packages
sudo apt install runit --reinstall # reinstall runit



The above commands should get rid of the configuration errors, but now the runit package is causing a Failed to connect to socket /com/ubuntu/upstart: Connection refused error. It won't break any core components in Ubuntu if you uninstall runit. Forcibly remove runit by running sudo dpkg -r runit git-daemon-run. You might need to use one of the --force-* options in order to remove it.



sudo dpkg -r runit git-daemon-run
sudo apt autoremove

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...