Linux – apt-get Update/Upgrade List Without Changing Anything

aptdebianlinuxunix

I would like to view what packages are available for update/upgrade without actually changing any files becuase there are some packages I wouldn't like to update. Would it then be possible to apt-get update with exceptions.

Best Answer

I use apt list --upgradable.
The next alternative is apt-get --simulate upgrade. (based on @EightBitTony)
Here are outputs from different options (hope it helps someone):

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.