ubuntu sudo apt-get install&update报错dpkg 返回code(1)

解决了一个有点坑的bug,今天贴上来……想当年因为这个bug我直接把系统搞崩了……说多了都是泪阿

问题描述

报错:

Errors were encountered while processing:
runit
E: Sub-process /usr/bin/dpkg returned an error code (1)

解决方案:

命令:
1)cd ./var/lib/dpkg/info/
2)sudo vim runit.postinst
3) 修改文件

Before:

if [ -x /sbin/start ]; then #provided by upstart
  /sbin/start runsvdir
fi

After:

#if [ -x /sbin/start ]; then #provided by upstart
#  /sbin/start runsvdir
#fi

When you’ve saved that change, you can tell apt to finish where it left off and you should be good to go:

4)$ sudo apt-get install -f

原因:

Reading the error message, it appears that the runit install script expects upstart at one point, but my system (and I suspect yours) is running systemd. As Vivid is not an LTS, I submit that one could edit the post installation dpkg file to get this back on track. (This trick should also work for LTS installations as well, but hopefully would be a non-issue).

it will have left the runit package in an semi-installed state. You should find a runit.postinst file in /var/lib/dpkg/info/. This file is executed as part of the post-installation details for the runit package (mainly for starting up runit immediately after installation, as opposed to waiting until next system boot). The error is that the script appears to forget the exclusive nature of systemd/upstart. Since you’re clearly not running upstart, comment out the relevant lines (lines 58 - 60 on my install, currently).

参考网址:

https://askubuntu.com/questions/654951/failed-to-connect-to-socket-com-ubuntu-upstart-connection-refused-errors-were

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值