当前位置: 代码迷 >> 综合 >> ubuntu sudo apt-get installupdate报错dpkg 返回code(1)
  详细解决方案

ubuntu sudo apt-get installupdate报错dpkg 返回code(1)

热度:12   发布时间:2023-12-03 01:31:05.0

解决了一个有点坑的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

  相关解决方案