Linux

apt-get 更新/升級列表而不更改任何內容

  • April 12, 2019

我想查看哪些軟體包可用於更新/升級,而無需實際更改任何文件,因為有些軟體包我不想更新。那麼是否有可能 apt-get update 例外。

我用apt list --upgradable.

下一個選擇是apt-get --simulate upgrade. (基於@EightBitTony)

以下是不同選項的輸出(希望對某人有所幫助):

me@machine:~$ apt list --upgradable
   Listing... Done
   kubernetes-cni/kubernetes-xenial 0.7.5-00 amd64 [upgradable from: 0.6.0-00]
   N: There are 3 additional versions. Please use the '-a' switch to see them.
me@machine:~$ apt-get --simulate upgrade
   NOTE: This is only a simulation!
         apt-get needs root privileges for real execution.
         Keep also in mind that locking is deactivated,
         so don't depend on the relevance to the real current situation!
   Reading package lists... Done
   Building dependency tree
   Reading state information... Done
   Calculating upgrade... Done
   The following packages will be upgraded:
     kubernetes-cni
   1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
   Inst kubernetes-cni [0.6.0-00] (0.7.5-00 kubernetes-xenial:kubernetes-xenial [amd64])
   Conf kubernetes-cni (0.7.5-00 kubernetes-xenial:kubernetes-xenial [amd64])
me@machine:~$ apt-get -u upgrade --assume-no
   E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
   E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
me@machine:~$ sudo apt-get -u upgrade --assume-no
   Reading package lists... Done
   Building dependency tree
   Reading state information... Done
   Calculating upgrade... Done
   The following packages will be upgraded:
     kubernetes-cni
   1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
   Need to get 6,473 kB of archives.
   After this operation, 4,278 kB of additional disk space will be used.
   Do you want to continue? [Y/n] N
   Abort.
me@machine:~$ sudo apt-get -u -V upgrade
   Reading package lists... Done
   Building dependency tree
   Reading state information... Done
   Calculating upgrade... Done
   The following packages will be upgraded:
      kubernetes-cni (0.6.0-00 => 0.7.5-00)
   1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
   Need to get 6,473 kB of archives.
   After this operation, 4,278 kB of additional disk space will be used.
   Do you want to continue? [Y/n] n
   Abort.

引用自:https://serverfault.com/questions/300749