什么更可靠 – apt-mark或APT-pin(/etc/apt/preferences.d/pin)用于版本锁定?
通常在我的Ubuntu 16.04 LTS上,我锁定具有APT-pinfunction的封装版本。
例如,如果我想meld
版本固定为版本1.5.3-1ubuntu1,我创建以下pin文件:
cat <<EOF | sudo tee /etc/apt/preferences.d/pin-meld Package: meld Pin: version 1.5.3-1ubuntu1 Pin-Priority: 1337 EOF
此文件适用于系统范围的设置: apt
, apt-get
, aptitude
和GUI工具,如synaptic
和muon
尊重它。
我知道其他机制 – apt-mark
。 我们假设。 我的出发点 – 我手动安装了meld_1.5.3-1ubuntu1 ,它的引脚被移除了。
$ apt-mark showhold $ apt-cache policy meld meld: Installed: 1.5.3-1ubuntu1 Candidate: 3.14.2-1 Version table: 3.14.2-1 500 500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages 500 http://archive.ubuntu.com/ubuntu xenial/universe i386 Packages *** 1.5.3-1ubuntu1 100 100 /var/lib/dpkg/status
然后我拿着安装版本。
$ sudo apt-mark hold meld meld set on hold. $ dpkg -l | grep meld hi meld 1.5.3-1ubuntu1 all graphical tool to diff and merge files
APT标志显示它处于暂停状态。 但apt-cache policy meld
没有任何变化
$ apt-cache policy meld meld: Installed: 1.5.3-1ubuntu1 Candidate: 3.14.2-1 Version table: 3.14.2-1 500 500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages 500 http://archive.ubuntu.com/ubuntu xenial/universe i386 Packages *** 1.5.3-1ubuntu1 100 100 /var/lib/dpkg/status
apt-get upgrade
报告meld
被保留回来 :
$ sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages have been kept back: meld 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
但是如果我以交互模式启动aptitude
,我可以meld
可升级包 :
Actions Undo Package Resolver Search Options Views Help CT: Menu ?: Help q: Quit u: Update g: Preview/Download/Install/Remove Pkgs aptitude 0.7.4 --\ Upgradable Packages (1) --\ gnome - The GNOME Desktop Environment (1) --\ universe - Unsupported Free Software. (1) ih meld 1.5.3-1ubuntu1 3.14.2-1
如果我不小心选择了操作 – >取消待处理操作 ,则将删除保留。
到目前为止,我可以理解synaptic
忽略了apt-mark
标记,其锁定版本function的工作方式不同。
meld
在此处列为已安装(可升级) 。 标记所有升级按钮不会自动选择它,但可能会被Mark for Upgrade意外升级包。
Muon以相同的方式使用apt-mark
持有的包。 但有趣的是它的选项Lock at Current Version将pin-file写入/etc/apt/preferences.d/meld
。
我是否正确理解APT-pin比apt-mark
更可靠?
是的,钉扎比apt-mark
更可靠。
我发现了什么:
-
过去12 – 14年Synaptic使用自己的固定文件(/ var / lib / synaptic / preferences) – 请参阅启动板上的错误42178 。 对于系统范围的人,可能希望在
/etc
和Synaptic之间设置符号链接sudo ln -s /etc/apt/preferences.d/synaptic /var/lib/synaptic/preferences
因此它是解决方法,不建议在Synaptic中锁定版本的方法(此文件不会被
apt-get
和aptitude
读取)。 -
Muon在
/etc/apt/preferences.d
使用每个应用程序的系统范围的pin文件。 -
aptitude
有两个错误:- 在14.04 LTS它完全不尊重
apt-mark
(参见我在启动板上的错误1747189 )。 - 在16.04 LTS保持,由
apt-mark
设置在点击操作 – >取消待处理操作后丢失(参见我在启动板上的错误1747191 )。
但是在18.04 LTS
aptitude
没有这样的错误,它很棒。 - 在14.04 LTS它完全不尊重
所以我的结论如下:只有使用apt-get
安装/删除/升级软件才能使用apt-mark
,否则你应该使用固定(即/etc/apt/preferences.d/
),它更可靠,直截了当。
- webupd8 oracle-java-9-installer与404失败
- Apt安装挂起/冻结尝试运行更新没有错误17.10
- 无法安装libglew-dev,因为libcheese和libclutter没有所需的版本
- 使用Software Updater与运行apt-get update和apt-get upgrade相同吗?
- 如何在Ubuntu 14.04中安装synapse
- “固定”一个自动安装的软件包,以便apt-get autoremove保持它
- 在’apt-cache depends’输出中,Suggests,Recommends,|,的含义是什么?
- apt全升级与apt-get dist-upgrade
- Ubuntu 16.04中Python包的apt-get升级错误