从那时起,我一直在尝试一款名为 topgrade 的软件,但在之前运行良好的系统上遇到了一些问题。一开始无法使用命令行启动 vscode code
(尽管它已经安装,我可以通过按窗口键并查找来启动它),然后我发现我的 apt 也坏了。每当我尝试使用 apt 安装任何东西时,它都会卡在
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).
因此,我关闭了正在运行安装的终端,并尝试在另一个终端中安装它,但 dpkg lock 前端错误开始出现,因此我尝试终止所有 apt 进程并再次运行安装,但 dpkg lock 错误仍然出现,因此我继续删除该lock-frontend
文件,但仍然没有效果
重新启动后,再次尝试 apt install,系统要求我配置 dpkg,因此我运行它sudo dpkg --configure -a
,但它再次卡在 mysql-server 设置处。
所以我尝试了这篇文章中的解决方案来修复 mysql-server 挂起的问题配置 mysql-server-5.7 时 Ubuntu 更新停止
它至少起作用了,mysql 服务器不再挂起,但是当我运行sudo dpkg --configure -a
并得到以下日志时https://pastebin.com/nwcAcZW8 现在显示一个git-daemon-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
所以我清除了 runit 并尝试再次安装它,但出现以下错误
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)
更新
我尝试了@karel 在他们的回答中建议的解决方案,当我执行最后一个命令重新安装 runit 时,出现以下错误
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)
答案1
要消除dpkg: error processing package runit (--configure):
错误,请打开终端并输入:
sudo dpkg--configure-a# 指示 dpkg “修复”自身 sudo apt-get -f 安装# 更正依赖关系并继续配置你的软件包 sudo apt install runit--reinstall# 重新安装 runit
上述命令应该可以消除配置错误,但现在 runit 包导致错误Failed to connect to socket /com/ubuntu/upstart: Connection refused
。卸载 runit 不会破坏 Ubuntu 中的任何核心组件。通过运行 强制删除 runit sudo dpkg -r runit git-daemon-run
。您可能需要使用其中一个--force-*
选项来删除它。
sudo dpkg -r runit git-daemon-run
sudo apt autoremove