Debian

由於未滿足的依賴關係,無法安裝 linux-headers

  • July 13, 2017

安裝 debian 後,我立即將儲存庫更改為測試:

$ cat /etc/apt/sources.list
# Debian packages for testing
deb http://ftp.by.debian.org/debian/ testing main non-free contrib
# Uncomment the deb-src line if you want 'apt-get source'
# to work with most packages.
deb-src http://ftp.by.debian.org/debian/ testing main non-free contrib

# Security updates for stable
# deb http://security.debian.org/ stable/updates main contrib

我想安裝 linux 標頭檔,因為它們需要安裝nvidia 驅動程序

顯然,當我切換到測試我的核心時,我的核心版本保持不變,因為沒有安裝 linux-headers(我假設)。它是 4.9.0-3-amd64,但現在是 4.11.0-1-amd64。在檢查了可用的內容後,我安裝了 4.11.0-1-amd64:

~$ apt-cache search linux-image
linux-headers-4.11.0-1-amd64 - Header files for Linux 4.11.0-1-amd64
linux-headers-4.11.0-1-rt-amd64 - Header files for Linux 4.11.0-1-rt-amd64
linux-image-4.11.0-1-amd64 - Linux 4.11 for 64-bit PCs
linux-image-4.11.0-1-amd64-dbg - Debug symbols for linux-image-4.11.0-1-amd64
linux-image-4.11.0-1-rt-amd64 - Linux 4.11 for 64-bit PCs, PREEMPT_RT
linux-image-4.11.0-1-rt-amd64-dbg - Debug symbols for linux-image-4.11.0-1-rt-amd64
linux-image-4.9.0-3-amd64 - Linux 4.9 for 64-bit PCs
linux-image-4.9.0-3-rt-amd64 - Linux 4.9 for 64-bit PCs, PREEMPT_RT
linux-image-amd64 - Linux for 64-bit PCs (meta-package)
linux-image-rt-amd64 - Linux for 64-bit PCs (meta-package), PREEMPT_RT

現在我想通過執行安裝標題:

~$ sudo apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
linux-headers-amd64 : Depends: linux-headers-4.9.0-3-amd64 but it is not installable
E: Unable to correct problems, you have held broken packages.

它抱怨我有未滿足的依賴關係。如何安裝元頭包?

PS:當我檢查linux-headers-amd64時,它說它取決於linux-headers- 4.9.0-3 -amd64。但是當我擁有較舊的核心(linux-image-4.9.0-3-amd64)時,它也抱怨同樣未滿足的依賴關係!

顯然這些軟體包需要由 Debian 軟體包維護者自己升級。現在,https://packages.debian.org/buster/linux-headers-amd64具有正確的依賴關係。

我遇到了同樣的問題,我正在執行4.9.0-3,最近的一次更新破壞了我的 X 伺服器(我被放到了文本控制台)。

我發現沒有載入nVidia模組,所以我嘗試重新編譯它。那時我注意到核心標頭檔失去了。

我的解決方案是linux-image-4.11.0-1-all與適當的標題一起安裝。重新啟動到新核心後,我重新編譯了 nVidia 核心模組。目前我安裝了以下軟體包:

linux-headers-4.11.0-1-all
linux-headers-4.11.0-1-all-amd64
linux-headers-4.11.0-1-amd64
linux-headers-4.11.0-1-common
linux-headers-4.11.0-1-common-rt
linux-headers-4.11.0-1-rt-amd64

這就是解決問題的方法。我在這裡看到包儲存庫中的一個錯誤,因為安裝linux-headers-amd64不提供任何衝突解決方案,除了不安裝它。我自己正在等待修復該問題的更新,特別是因為 ZFS 核心模組也不會安裝。

引用自:https://unix.stackexchange.com/questions/374798