kali在运行apt full-upgrade时报错:trying to overwrite '/sbin/init', which is also in package

运行apt full-upgrade(apt-get dist-upgrade)进行系统级更新时出现以下问题:

dpkg: error processing archive /var/cache/apt/archives/sysvinit_2.88dsf-41+deb7u1_amd64.deb (--unpack):
 trying to overwrite '/sbin/init', which is also in package systemd-sysv 240-4
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/sysvinit_2.88dsf-41+deb7u1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

应该是有两个应用同时对它进行读写导致的问题

错误示范:

sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_backup  #对info进行备份
sudo apt update &apt full-upgrade -y   #更新
sudo mv /var/lib/dpkg/info_backup/* /var/lib/dpkg/info/   #把info_backup里面旧的info内容移到新的info目录
sudo rm -r /var/lib/dpkg/info_backup  #删除info_backup

做完这些后发现没鸟用,而且把系统的进程堵塞了,搞得reboot和shutdown命令都运行不了(reboot -f 除外,reboot -f 后死的更惨)

正确的方法是:

sudo dpkg-i --force-overwrite /var/cache/apt/archives/sysvinit_2.88dsf-41+deb7u1_amd64.deb  #手动在缓存里面安装 sysvinit_2.88dsf-41+deb7u1_amd64.deb
sudo apt full-upgrade 

打完收工

你可能感兴趣的:(kali)