除了在
/etc/apt
中设置文件外,您还可以在卸载snapd后运行
apt-mark
来防止安装需要
snapd
的任何内容:
$ sudo apt-mark hold snapd
例如,在Ubuntu 22.04中安装firefox
(这是一个基于snapd的软件包)会出现错误:
$ sudo apt install firefox
Reading package lists... Done
Building dependency tree... Done
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:
firefox : PreDepends: snapd but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
唯一打破这个规则的方法是明确地去做。
$ sudo apt install snapd
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
snapd
The following held packages will be changed:
snapd
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 23.8 MB of archives.
After this operation, 102 MB of additional disk space will be used.
Do you want to continue? [Y/n]
此外,您可以通过以下方式撤销效果:
$ sudo apt-mark unhold snapd