问题:
我需要一种方法来在我的 Debian 系统上安装某些软件包的特定固定版本。snapshot.debian.org似乎提供了一种方法来执行此操作,但是即使在向我的 apt-sources 添加快照后,我也无法apt-get install
在该快照存档中使用某些特定版本的软件包。
问题:
从 Debian 快照存档安装特定软件包版本的官方或“正确”方式是什么?
背景和我尝试过的:
让我们使用 Debian8 Jessie 和 3.16.x 内核二进制文件作为我们的示例。在撰写本文时,Jessie 发布的内核是 3.16.43-2+deb8u5。说我要安装 3.16.43-2+deb8u4。
我首先在 debian 快照档案中搜索我想要的版本 ( http://snapshot.debian.org/binary/linux-image-3.16.0-4-amd64/ ),然后单击我想要的内核的确切版本我正在寻找,这让我进入http://snapshot.debian.org/package/linux/3.16.43-2%2Bdeb8u4/#linux-image-3.16.0-4-amd64_3.16.43-2:2b: deb8u4
从那里,我可以看到该软件包是“在 2017-09-20 22:12:21 上看到的 debian-security”和“在 2017-10-08 16:31:52 上看到的 debian”。我决定使用前者并选择 debian-security snapshot 20170920T221221Z。
按照snapshot.debian.org首页上的说明,我将以下内容添加到我的 /etc/apt/sources.list 中:
deb http://snapshot.debian.org/archive/debian-security/20170920T221221Z/ jessie/updates main
deb src http://snapshot.debian.org/archive/debian-security/20170920T221221Z/ jessie/updates main
Run Code Online (Sandbox Code Playgroud)
然后我运行apt-get -o Acquire::Check-Valid-Until=false update
并看到更新(似乎)成功完成。
我认为这将允许我现在安装所需版本的内核,但 apt 只知道两个安装候选,3.16.43-2+deb8u2 和 3.16.43-2+deb8u5。没有 +deb8u4 的迹象:
# apt-cache madison linux-image-3.16.0-4-amd64
linux-image-3.16.0-4-amd64 | 3.16.43-2+deb8u5 | http://security.debian.org/ jessie/updates/main amd64 Packages
linux-image-3.16.0-4-amd64 | 3.16.43-2+deb8u5 | http://snapshot.debian.org/archive/debian-security/20170920T221221Z/ jessie/updates/main amd64 Packages
linux-image-3.16.0-4-amd64 | 3.16.43-2+deb8u2 | http://cloudfront.debian.net/debian/ jessie/main amd64 Packages
linux-image-3.16.0-4-amd64 | 3.16.7-ckt25-2 | http://cloudfront.debian.net/debian/ jessie-updates/main amd64 Packages
linux | 3.16.39-1 | http://cloudfront.debian.net/debian/ jessie-backports/main Sources
# apt-cache policy linux-image-3.16.0-4-amd64
linux-image-3.16.0-4-amd64:
Installed: 3.16.43-2+deb8u5
Candidate: 3.16.43-2+deb8u5
Version table:
3.16.43-2+deb8u5 0
500 http://security.debian.org/ jessie/updates/main amd64 Packages
500 http://snapshot.debian.org/archive/debian-security/20170920T221221Z/ jessie/updates/main amd64 Packages
*** 3.16.43-2+deb8u2 0
500 http://cloudfront.debian.net/debian/ jessie/main amd64 Packages
100 /var/lib/dpkg/status
3.16.7-ckt25-2 0
500 http://cloudfront.debian.net/debian/ jessie-updates/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)
此外,如果我尝试指定并安装我想要的版本,它会返回“未找到”:
# apt-get install linux-image-3.16.0-4-amd64=3.16.43-2+deb8u4
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '3.16.43-2+deb8u4' for 'linux-image-3.16.0-4-amd64' was not found
Run Code Online (Sandbox Code Playgroud)
我设法通过下载 .deb 二进制文件并dpkg -i
安装它来解决这个问题,但我更喜欢使用 apt 而不是 curl'ing .debs 并安装它们。任何人都可以解释我需要做什么才能处理apt-get install
特定的包,或者至少解释为什么这不能按我期望的方式工作?
这不是精确的科学,但这里有一个可能的解释,说明为什么它不适用于这种特定情况(当您不遵循变化太快的目标时,它通常会起作用)。
给定的存储库通常仅引用 Packages 文件中包的一个版本,例如,此版本。这不是技术义务,例如,deb https://dl.winehq.org/wine-builds/debian/ jessie main
在其 Packages 文件中包含同一软件包的多个版本,所有这些都可以通过 apt-get 检索,=
就像您一样使用,但 Debian (TM) 不会在同一 Packages 文件中保留对多个版本的引用。
如果您查看要查找的包所在的实际目录,您可以看到两个版本都可用:
linux-image-3.16.0-4-amd64_3.16.43-2+deb8u4_amd64.deb
linux-image-3.16.0-4-amd64_3.16.43-2+deb8u5_amd64.deb
当 deb8u5 出现后,之前对 deb8u4 的引用就消失了。deb8u4 .deb 可能仍然被其他存储库引用,或者根本没有经历一些“垃圾收集”。单击快照导航中的“上一个更改”仅会导致 deb8u3,而不会导致 deb8u4 或 deb8u5。这意味着 deb8u4 和 deb8u5 之间的更改发生得太快,以至于 deb8u4 的 Packages 文件无法下载,或者 snapshot.debian.org 无法在 deb8u5 替换它之前保存此中间 Packages 文件。debian-security 中的此引用(以及相应的校验和以及签名的发布文件)会丢失。
只需再次尝试使用 debian(而不是 debian-security):
linux-image-3.16.0-4-amd64_3.16.43-2+deb8u4_amd64.deb
以及相应的Packages.xz文件。这个只有 deb8u2 的条目...并且只会保留这个。在 8.10 发布之前,较新的版本应该来自 debian-security,所以即使它们出现在池中,那也只是因为 snapshot.debian.org 使所有版本都出现在同一个地方。
抱歉,对于这个特定的软件包版本,我没有找到下载 deb8u4 的方法。即使可以从链接下载并dpkg -i
安装它,也无法验证下载的内容,因此应该避免。
注意:你的方法是正确的。您通常可以通过固定某些特定软件包的特定快照来完成它,允许 apt-get 自动选择它们(不需要=
)并避免它们稍后升级。那里有解释: https: //wiki.debian.org/AptPreferences。持有它们也可以(dpkg --set-selections
或apt-mark hold
)避免升级。
归档时间: |
|
查看次数: |
308 次 |
最近记录: |