当升级一个包时,-t
或者--default-release
会产生奇迹:
➜ ~ sudo apt-get install -t unstable libpam-gnome-keyring
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
libpam-gnome-keyring
1 upgraded, 0 newly installed, 0 to remove and 376 not upgraded.
Need to get 284 kB of archives.
After this operation, 22.5 kB disk space will be freed.
(Reading database ... 268717 files and directories currently installed.)
Preparing to unpack .../libpam-gnome-keyring_3.12.0-2_i386.deb ...
Unpacking libpam-gnome-keyring (3.12.0-2) over (3.8.2-2+b1) ...
Setting up libpam-gnome-keyring (3.12.0-2) ...
但当我尝试使用它来降级时,它根本没有:
➜ ~ sudo apt-get install -t testing libpam-gnome-keyring
Reading package lists... Done
Building dependency tree
Reading state information... Done
libpam-gnome-keyring is already the newest version. ## Why???
libpam-gnome-keyring set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.
唯一的方法是使用以下package/target_release
方法:
➜ ~ sudo apt-get install libpam-gnome-keyring/testing
Reading package lists... Done
Building dependency tree
Reading state information... Done
Selected version '3.8.2-2+b1' (Debian:testing [i386]) for 'libpam-gnome-keyring'
The following packages will be DOWNGRADED:
libpam-gnome-keyring
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 272 kB of archives.
After this operation, 22.5 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: warning: downgrading libpam-gnome-keyring from 3.12.0-2 to 3.8.2-2+b1
(Reading database ... 268716 files and directories currently installed.)
Preparing to unpack .../libpam-gnome-keyring_3.8.2-2+b1_i386.deb ...
Unpacking libpam-gnome-keyring (3.8.2-2+b1) over (3.12.0-2) ...
Setting up libpam-gnome-keyring (3.8.2-2+b1) ...
为什么不-t
降级软件包?
答案1
该-t
选项只是删除 apt 的固定首选项,并将所选版本设置为 990 优先级,相当于:
Package: *
Pin: release a=testing # for testing
Pin-Priority: 900
此优先级不足以强制软件包降级。要强制降级软件包,您需要为尝试降级到的版本设置 1000 或更高的优先级,或者为来自要删除的版本的软件包设置 -1 或更低的优先级。
package/release
做一些完全不同的事情。如果有多个软件包,它会选择软件包存档中的最新版本,并仅安装该软件包。相当于:
apt-get download package=version
dpkg -i --force-downgrade package.deb
总之,-t
和都package/release
遵循不同的过程,并且唯一能够从 apt 降级软件包的命令是显式版本选择器:package=version
和package/release
。