无法 运行 apt-get -f 在 debian 上安装

unable to run apt-get -f install on debian

我有一个系统要升级,但我与 apt-get -f install:

有冲突
 apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  login sysvinit-utils util-linux
Suggested packages:
  kbd util-linux-locales
The following packages will be upgraded:
  login sysvinit-utils util-linux
3 upgraded, 0 newly installed, 0 to remove and 106 not upgraded.
13 not fully installed or removed.
Need to get 0 B/1775 kB of archives.
After this operation, 1886 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
E: Sub-process false returned an error code (1)
E: Prior errors apply to /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb
E: Prior errors apply to /var/cache/apt/archives/util-linux_2.36.1-8_arm64.deb
E: Prior errors apply to /var/cache/apt/archives/login_1%3a4.8.1-1_arm64.deb
debconf: apt-extracttemplates failed: No such file or directory
(Reading database ... 9765 files and directories currently installed.)
Preparing to unpack .../sysvinit-utils_2.96-7_arm64.deb ...
Unpacking sysvinit-utils (2.96-7) over (2.88dsf-59) ...
dpkg: error processing archive /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb (--unpack):
 trying to overwrite '/lib/init/vars.sh', which is also in package initscripts 2.88dsf-59
Errors were encountered while processing:
 /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我不明白为什么在我确认安装包后显示 E: Sub-process false returned an error code (1)。谁能帮我解决这个问题?

尝试刷新缓存然后重新安装:

apt autoremove 
apt clean
apt autoclean
apt update
apt install -f

如果没有帮助,请尝试删除有问题的软件包并正常重新安装它们。

initscripts 是一个纯虚拟包,所以给 dpkg 覆盖它的权限是安全的。打开终端并输入:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb

如果您不直接使用 dpkg 而是使用 apt 前端,如 apt 或 apt-get,则以下命令定义了与上一个命令相同的自定义 dpkg 选项。

sudo apt-get -o Dpkg::Options::="--force-overwrite" install sysvinit-utils