自动安装 Debian Backports 内核

Tim*_*oop 8 package-management debian apt pinning debian-wheezy

我有以下固定设置:

Package: linux-image-amd64
Pin: release a=wheezy-backports
Pin-Priority: 1001

Package: *
Pin: release a=wheezy-backports
Pin-Priority: 499
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

$ sudo apt-get install linux-image-amd64
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-image-amd64 : Depends: linux-image-3.16.0-0.bpo.4-amd64 but it is not going to   be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)

政策似乎是正确的:

$ apt-cache policy linux-image-amd64
linux-image-amd64:
  Installed: 3.2+46
  Candidate: 3.16+63~bpo70+1
  Package pin: 3.16+63~bpo70+1
  Version table:
     3.16+63~bpo70+1 1001
        499 http://ftp.nl.debian.org/debian/ wheezy-backports/main amd64 Packages
 *** 3.2+46 1001
        500 http://ftp.nl.debian.org/debian/ wheezy/main amd64 Packages
        100 /var/lib/dpkg/status

$ apt-cache policy linux-image-3.16.0-0.bpo.4-amd64
linux-image-3.16.0-0.bpo.4-amd64:
  Installed: (none)
  Candidate: 3.16.7-ckt4-3~bpo70+1
  Version table:
     3.16.7-ckt4-3~bpo70+1 0
        499 http://ftp.nl.debian.org/debian/ wheezy-backports/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)

所以我没有得到错误。我究竟做错了什么?

我正在尝试使用 puppet 将所有 Wheezy 机器升级到 backports 内核(计划连续重启),这就是我想正确解决它的原因。我可以手动登录到所有服务器来运行:

sudo apt-get install -t wheezy-backports linux-image-amd64
Run Code Online (Sandbox Code Playgroud)

哪个有效,但不是那么方便。

更新

按照要求:

/etc/apt/preferences.d$ cat linux-image 
Package: linux-image-*
Pin: release a=wheezy-backports
Pin-Priority: 1001

Package: *
Pin: release a=wheezy-backports
Pin-Priority: 499

/etc/apt/preferences.d$ sudo apt-get update
Hit http://debian.kumina.nl wheezy-kumina Release.gpg
.
.
.
Reading package lists... Done
/etc/apt/preferences.d$ sudo apt-get install linux-image-amd64
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-image-amd64 : Depends: linux-image-3.16.0-0.bpo.4-amd64 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
/etc/apt/preferences.d$ aptitude why-not linux-image-3.16.0-0.bpo.4-amd64
Unable to find a reason to remove linux-image-3.16.0-0.bpo.4-amd64.
Run Code Online (Sandbox Code Playgroud)

drA*_*erT 6

sudo apt-get install -t wheezy-backports linux-image-amd64

我知道这不方便..但这是将来不会遇到麻烦的正确做法(当然恕我直言)

  • 这没有足够的赞成票 (2认同)

sti*_*mur 3

检查该包依赖什么以及这些依赖项还需要什么。例如,我在我的机器上看到这个:

#apt-cache  show linux-image-amd64
Package: linux-image-amd64
<snip>
Depends: linux-image-3.16.0-4-amd64
Run Code Online (Sandbox Code Playgroud)

# apt-cache  show linux-image-3.16.0-4-amd64
Package: linux-image-3.16.0-4-amd64
<snip>
Depends: kmod | module-init-tools, linux-base (>= 3~), debconf (>= 0.5) | debconf-2.0, initramfs-tools (>= 0.110~) | linux-initramfs-tool
Pre-Depends: debconf | debconf-2.0
Run Code Online (Sandbox Code Playgroud)

检查依赖项是否也从向后移植中获取。