在 debian 机器上进行系统升级(apt-get 升级)后,每次尝试使用 apt-get 时都会出现错误。例子:
# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initscripts (2.88dsf-41+deb7u1) ...
insserv: Service killprocs has to be enabled to start service single
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: error processing initscripts (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
initscripts
E: Sub-process /usr/bin/dpkg returned an error code (1)
我试图找到解决方案,但找不到任何看起来像这样的东西。首先,我有这个“未完全安装或删除”的数据包。但我找不到找到它的命令。试过:
dpkg -l | grep rc
但它列出了大约 20 个数据包,因此必须有更好的方法来找到这个数据包。
为了修复数据包系统,我尝试了正常的程序,例如:
apt-get clean && sudo apt-get autoremove
apt-get -f install
dpkg --configure -a
clean 命令很好,但 install 命令会失败,如上所示。
在绝望的尝试中,我尝试重新安装 insserv (不确定是数据包损坏了),但还是以同样的方式失败:
# apt-get install --reinstall insserv
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 8 not upgraded.
1 not fully installed or removed.
Need to get 63.8 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ftp.us.debian.org/debian/ wheezy/main insserv armel 1.14.0-5 [63.8 kB]
Fetched 63.8 kB in 0s (85.5 kB/s)
Setting up initscripts (2.88dsf-41+deb7u1) ...
insserv: Service killprocs has to be enabled to start service single
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: error processing initscripts (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
initscripts
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
/etc/rc1.d/S01killprocs -> ../init.d/killprocs
失踪了,显然,它在initscripts
但insserv
需要它。需要检查
也许您可以手动安装它,将其解压.deb
到其他目录中,然后将其复制到正确的位置。
dpkg -x /var/cache/apt/archives/initscripts_2.88dsf-41_i386.deb /tmp/somedir
2.88dsf-41_i386
是我的版本,使用你的:-)
编辑
如果您手动使其正常工作,请照常重新安装。
答案2
我能够通过从 /var/cache/apt/archives 中删除所有缓存的 .deb 文件然后运行以下命令来修复 ubuntu 16.04 上的此问题:
apt-get clean && sudo apt-get autoremove
我希望这可以解决某人的问题。
答案3
以下命令解决了我类似的升级问题:
dpkg -i /var/cache/apt/archives/initscripts_2.88dsf-59.3ubuntu2_i386.deb
我正在使用 do-release-upgrade 从 Ubuntu 14.04 (!) 升级到下一个 LTS,并遇到了以下错误:
update-rc.d: error: insserv rejected the script header
dpkg: error processing package util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
和 dpkg-reconfigure util-linux 给了我
/usr/sbin/dpkg-reconfigure: initscripts is broken or not fully installed
甚至 apt-get install --reinstall initscripts 也产生了:
E: Internal Error, No file name for initscripts:i386
不过 dpkg(上面)有效,并且允许继续升级。希望这对某人有帮助。