apt-get install git-all dpkg 错误

apt-get install git-all dpkg 错误

我是 Linux 新手。一直在尝试设置 git,但在设置存储库并将其链接到 git hub 时遇到了一些困难。但那是另一个问题。在尝试解决这个问题时,我在不同时间接连使用以下命令来尝试安装我需要的正确软件包

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

最后

apt-get install git-all

运行最后一条命令时我收到以下错误

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

我已经搜索过该网站并尝试找到解决方案,但它似乎依赖于大小写,所以我运行了

sudo apt-get install -f

并得到以下输出

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)

有人能告诉我哪个文件导致了错误以及我该如何修复它吗?此外,如果能提供一些关于为什么会发生这种情况的详细信息或任何有用的信息,我将不胜感激。谢谢

答案1

经过一番研究,我发现这个错误与 ubuntu 16.4.1 不再运行 Upstart 有关。(原来这个问题已经回答过了,所以很抱歉)ubuntu 15 以后的版本使用 systemd。答案在下面的链接中。感谢所有发布解决方案的人

无法连接到套接字 /com/ubuntu/upstart:连接被拒绝:处理时遇到错误:runit

答案2

这不是一个罕见的问题,问题出在runit包上,请尝试这个简单的解决方案:

$ 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

编辑:最新的 Ubuntu 版本不再支持 Upstart。如果出于某种原因,有人确实想使用 upstart,他们可以安装这个:sudo apt install upstart-sysv

相关内容