假设我们有一个包mypackage,它有来自不同来源的不同版本。我不想要禁用任何这些来源虽然。
然而,当前最新版本mypackage在我的系统上有问题,但以前的版本运行良好,未来的版本可能也会再次修复。
我怎样才能只将这个有问题的版本列入黑名单,mypackage这样apt就不会升级到它,而是继续从所有来源接收升级,并且一旦它们出来就会升级到以下版本?
apt-mark hold mypackage保留包裹(也会阻止将来的更新,直到我手动取消保留包裹,这不是我想要的。
将我的 Ubuntu 从 18.10 升级到 19.04 后,一些软件包被阻止了,但我并不在乎,因为我认为这些问题会在几周内得到解决,届时依赖项可以升级到我的操作系统的正确版本。一段时间后,这并没有发生,我已经在这些“阻止”的包周围闲逛并发现了一个问题,这也解释了为什么我的系统负载指示器小部件和其他依赖传感器的小部件停止工作。
只剩下 2 个包裹被阻止了:libsnmp30 sysstat. 两者都以一种方式或另一种方式libsensors5依赖于libsensors-config。现在我可以尝试libsensors-config通过安装,sudo apt install libsensors-config但是我得到的(最后一个)输出让我觉得这不是一个好主意,对吧?
$ sudo apt install sysstat
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. …Run Code Online (Sandbox Code Playgroud) 我已经尝试了所有通常的修复方法......到目前为止没有运气
sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
libglib2.0-0:i386 libhwloc-plugins
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Run Code Online (Sandbox Code Playgroud)
以下都没有帮助
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -f install
Run Code Online (Sandbox Code Playgroud) 以下是一长串被保留的包裹清单:
The following packages have been kept back: aptdaemon
fcitx-frontend-qt5 gir1.2-packagekitglib-1.0 kde-style-breeze
kde-style-breeze-qt4 libfcitx-qt5-1 libkf5archive5 libkf5auth-data
libkf5auth5 libkf5codecs-data libkf5codecs5 libkf5config-data
libkf5configcore5 libkf5configgui5 libkf5configwidgets-data
libkf5configwidgets5 libkf5coreaddons-data libkf5coreaddons5
libkf5guiaddons5 libkf5i18n-data libkf5i18n5 libkf5iconthemes-data
libkf5iconthemes5 libkf5itemviews-data libkf5itemviews5 libkf5style5
libkf5widgetsaddons-data libkf5widgetsaddons5 libkf5windowsystem-data
libkf5windowsystem5 libqt4-dbus libqt4-dbus:i386 libqt4-declarative
libqt4-declarative:i386 libqt4-designer libqt4-network
libqt4-network:i386 libqt4-opengl libqt4-opengl:i386
libqt4-qt3support libqt4-script libqt4-script:i386 libqt4-sql
libqt4-sql:i386 libqt4-sql-mysql:i386 libqt4-sql-sqlite libqt4-svg
libqt4-xml libqt4-xml:i386 libqt4-xmlpatterns
libqt4-xmlpatterns:i386 libqt5core5a libqt5dbus5 libqt5gui5
libqt5multimedia5 libqt5network5 libqt5opengl5 libqt5positioning5
libqt5printsupport5 libqt5qml5 libqt5quick5 libqt5quicktest5
libqt5script5 libqt5sql5 libqt5sql5-mysql libqt5sql5-sqlite
libqt5svg5 libqt5test5 libqt5webkit5 libqt5widgets5 libqt5x11extras5
libqt5xml5 …Run Code Online (Sandbox Code Playgroud) 认识到这基本上是一个常见问题解答:
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nicholas@mordor:~$
nicholas@mordor:~$ sudo dpkg --get-selections | grep hold
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt install mariadb-server mariadb-client
Reading package lists... Done
Building dependency tree …Run Code Online (Sandbox Code Playgroud) 似乎最近当我去更新我的 Ubuntu 22.04 机器时,我经常看到软件包似乎无缘无故地被阻止。这是最新的:
Earth:sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
gnome-control-center gnome-control-center-data gnome-control-center-faces
libapache2-mod-php8.1 php8.1 php8.1-cgi php8.1-cli php8.1-common
php8.1-mysql php8.1-opcache php8.1-readline
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
Earth:
Run Code Online (Sandbox Code Playgroud)
如果我 apt 升级并指定软件包,安装就不会出现问题。但为什么所有这些都阻碍了呢?
我使用 Muon 包管理器将包锁定到特定版本,但是当我尝试释放锁定时,收到消息“无法锁定包代码。无法写入锁定文件。”
亦sudo apt-mark showhold是空空如也。我尝试清除软件包并重新安装它,但它仍然安装锁定版本。
如果我强制它安装特定版本,这是可行的,但随后apt dist-upgrade想要降级软件包:
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 https://deb.nodesource.com/node_19.x jammy InRelease [4,563 B]
Hit:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Ign:6 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 InRelease
Hit:7 https://download.sublimetext.com apt/stable/ InRelease
Hit:8 http://packages.microsoft.com/repos/code stable InRelease
Hit:9 https://deb.opera.com/opera-stable stable InRelease
Hit:10 https://linux-clients.seafile.com/seafile-deb/jammy stable InRelease
Hit:11 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release
Fetched 4,563 B in 1s (3,842 B/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can …Run Code Online (Sandbox Code Playgroud) package-management apt dpkg muon-package-manager held-packages