我尝试使用升级apt-get upgrade
并收到以下错误消息:
insserv: Starting DbSecuritySpt depends on monit and therefore on system facility `$all' which can not be true!
insserv: Starting DbSecuritySpt depends on monit and therefore on system facility `$all' which can not be true!
insserv: Starting DbSecuritySpt depends on monit and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
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
E: Sub-process /usr/bin/dpkg returned an error code (1)
If I tried to remove util-linux getting below error
root@e2e-34-223:~# apt-get remove util-linux
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
linux-image-4.4.0-31-generic : Depends: initramfs-tools but it is not going to be installed or
linux-initramfs-tool
Recommends: grub-pc but it is not going to be installed or
grub-efi-amd64 but it is not going to be installed or
grub-efi-ia32 but it is not going to be installed or
grub but it is not going to be installed or
lilo but it is not going to be installed
linux-image-4.4.0-31-lowlatency : Depends: initramfs-tools but it is not going to be installed or
linux-initramfs-tool
Recommends: grub-pc but it is not going to be installed or
grub-efi-amd64 but it is not going to be installed or
grub-efi-ia32 but it is not going to be installed or
grub but it is not going to be installed or
lilo but it is not going to be installed
policykit-1 : Depends: libpam-systemd but it is not going to be installed
systemd : Depends: util-linux (>= 2.27.1) but it is not going to be installed
Recommends: libpam-systemd but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
答案1
不使用其他参数运行sudo apt-get -f install
。这应该可以解决问题。
出现此问题的原因是您尝试升级依赖于其他软件包的软件包,但这些软件包不会被安装。因此,依赖关系不满足,安装失败。
如果您要执行软件包更新(不升级操作系统),最好通过更新管理器进行(根据我的经验)。这是最安全、最简单的方法。
答案2
您可以尝试命令输出中的推荐内容 -apt-get -f install
单独运行并再次重复升级过程。
但总的来说,我对升级命令的体验很差——它并不总是有效。就我个人而言,我更喜欢使用 Ansible 等配置工具,并在每次安装新版本时完全重新安装 Ubuntu,同时将旧版本的系统保存在云中(例如 AWS),以确保万无一失。
顺便说一句,我真的建议您在尝试升级命令之前在根分区上使用 LVM 快照,以防出现问题。