Linux-Kernel
如何解決 linux 核心的 dpkg 依賴關係?(Debian)
執行時如何解決此錯誤
sudo apt-get dist-upgrade
?Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 2 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] y Setting up linux-image-4.9.0-3-amd64 (4.9.30-2+deb9u2) ... /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-4.9.0-3-amd64 /etc/kernel/postinst.d/zz-update-grub: /usr/sbin/grub-mkconfig: 1: /etc/default/grub: ]#: not found run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127 dpkg: error processing package linux-image-4.9.0-3-amd64 (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of linux-image-amd64: linux-image-amd64 depends on linux-image-4.9.0-3-amd64; however: Package linux-image-4.9.0-3-amd64 is not configured yet. dpkg: error processing package linux-image-amd64 (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: linux-image-4.9.0-3-amd64 linux-image-amd64 E: Sub-process /usr/bin/dpkg returned an error code (1)
我在 Debian 9 (stretch) 上,最新版本的核心實際上是我目前擁有的 ( linux-image-4.9.0-3-amd64 ) 當我執行時,
sudo dpkg --configure -a
我收到以下消息:sudo dpkg --configure -a dpkg: dependency problems prevent configuration of linux-image-amd64: linux-image-amd64 depends on linux-image-4.9.0-3-amd64; however: Package linux-image-4.9.0-3-amd64 is not configured yet. dpkg: error processing package linux-image-amd64 (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: linux-image-amd64
我試過執行這些命令無濟於事:
sudo apt-get autoclean sudo apt-get clean sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get -f install
如果我執行
sudo dkpg --purge linux-image-4.9.0-3-amd64
並更新並重新安裝核心,我會得到這個依賴錯誤:dpkg: dependency problems prevent removal of linux-image-4.9.0-3-amd64: linux-image-amd64 depends on linux-image-4.9.0-3-amd64. dpkg: error processing package linux-image-4.9.0-3-amd64 (--purge): dependency problems - not removing Errors were encountered while processing: linux-image-4.9.0-3-amd64
提前致謝。
你沒有依賴問題。您有包配置問題。
成績單的相關部分是:
/etc/kernel/postinst.d/zz-update-grub: /usr/sbin/grub-mkconfig: 1: /etc/default/grub: ]#: not found run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
之後的一切都是這個問題的結果:核心安裝後腳本失敗,所以包
linux-image-4.9.0-3-amd64
沒有正確安裝(在 Debian 術語中它沒有配置),所以依賴它的包也沒有正確安裝。顯然有一個錯字(似乎在一行的開頭
/etc/default/grub
偏離了)。]
修復該問題,然後使用apt-get -f install
原來它與依賴無關。在更新過程中出現了問題,GRUB 變得一團糟。要重新安裝 GRUB,請呼叫:
sudo apt-get update sudo apt-get install --reinstall grub sudo apt-get dist-upgrade sudo apt-get upgrade sudo apt autoremove
然後重新啟動並嘗試
apt-get dist-upgrade
再次執行,問題應該得到解決。