Ubuntu – List available package updates

Ubuntu package manager has multiple tools to list the available package updates for installed deb packages. Look into all options and choose the one which you feel comfort. Among given options, first two option are my favourite. Because they populate list of available package updates with version details.

These commands work well for 16.04. May needs additional testing for older versions of Ubuntu.

Note: Run “apt-get update” before checking list of available package updates. This will refresh the repository meta-data.

1. Dry-run apt-get

#apt-get upgrade --dry-run
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done

<<--- Cropped --- Below lines shows us the available package updates summary --->>

The following packages have been kept back:
libdrm-amdgpu1 libdrm2 libegl1-mesa libgbm1 libgl1-mesa-dri
libwayland-egl1-mesa libxatracker2 mesa-va-drivers
The following packages will be upgraded:
grub-common grub-pc grub-pc-bin grub2-common libdrm-intel1 libdrm-nouveau2
libdrm-radeon1 libgl1-mesa-glx libglapi-mesa libseccomp2 squashfs-tools
unattended-upgrades xserver-xorg-core-hwe-16.04
xserver-xorg-legacy-hwe-16.04
14 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
Inst grub-pc [2.02~beta2-36ubuntu3.14] (2.02~beta2-36ubuntu3.15 Ubuntu:16.04/xenial-updates [amd64]) []

2. Direct option in “apt”

This command lists the installed package version and target version where it can be taken. This is quite verbose to understand what are packages going to get updated. Before initiating upgrade have the output of “apt list –upgradable” command will help in documentation & troubleshooting.

#apt list --upgradable
Listing... Done 
grub-common/xenial-updates 2.02~beta2-36ubuntu3.15 amd64 [upgradable from: 2.02~beta2-36ubuntu3.14]
grub-pc/xenial-updates 2.02~beta2-36ubuntu3.15 amd64 [upgradable from: 2.02~beta2-36ubuntu3.14]
grub-pc-bin/xenial-updates 2.02~beta2-36ubuntu3.15 amd64 [upgradable from: 2.02~beta2-36ubuntu3.14]
grub2-common/xenial-updates 2.02~beta2-36ubuntu3.15 amd64 [upgradable from: 2.02~beta2-36ubuntu3.14]
libdrm-amdgpu1/xenial-updates 2.4.83-1~16.04.1 amd64 [upgradable from: 2.4.76-1~ubuntu16.04.1]
libdrm-intel1/xenial-updates 2.4.83-1~16.04.1 amd64 [upgradable from: 2.4.76-1~ubuntu16.04.1]
libdrm-nouveau2/xenial-updates 2.4.83-1~16.04.1 amd64 [upgradable from: 2.4.76-1~ubuntu16.04.1]
libdrm-radeon1/xenial-updates 2.4.83-1~16.04.1 amd64 [upgradable from: 2.4.76-1~ubuntu16.04.1]
libdrm2/xenial-updates 2.4.83-1~16.04.1 amd64 [upgradable from: 2.4.76-1~ubuntu16.04.1]
libegl1-mesa/xenial-updates 17.2.4-0ubuntu1~16.04.2 amd64 [upgradable from: 17.0.7-0ubuntu0.16.04.2]
libgbm1/xenial-updates 17.2.4-0ubuntu1~16.04.2 amd64 [upgradable from: 17.0.7-0ubuntu0.16.04.2]
libgl1-mesa-dri/xenial-updates 17.2.4-0ubuntu1~16.04.2 amd64 [upgradable from: 17.0.7-0ubuntu0.16.04.2]
libgl1-mesa-glx/xenial-updates 17.2.4-0ubuntu1~16.04.2 amd64 [upgradable from: 17.0.7-0ubuntu0.16.04.2]
libglapi-mesa/xenial-updates 17.2.4-0ubuntu1~16.04.2 amd64 [upgradable from: 17.0.7-0ubuntu0.16.04.2]
libseccomp2/xenial-updates 2.3.1-2.1ubuntu2~16.04.1 amd64 [upgradable from: 2.2.3-3ubuntu3]
libwayland-egl1-mesa/xenial-updates 17.2.4-0ubuntu1~16.04.2 amd64 [upgradable from: 17.0.7-0ubuntu0.16.04.2]
libxatracker2/xenial-updates 17.2.4-0ubuntu1~16.04.2 amd64 [upgradable from: 17.0.7-0ubuntu0.16.04.2]
mesa-va-drivers/xenial-updates 17.2.4-0ubuntu1~16.04.2 amd64 [upgradable from: 17.0.7-0ubuntu0.16.04.2]
squashfs-tools/xenial-updates 1:4.3-3ubuntu2.16.04.1 amd64 [upgradable from: 1:4.3-3ubuntu2]
unattended-upgrades/xenial-updates,xenial-updates 0.90ubuntu0.9 all [upgradable from: 0.90ubuntu0.8]
xserver-xorg-core-hwe-16.04/xenial-updates 2:1.19.5-0ubuntu2~16.04.1 amd64 [upgradable from: 2:1.19.3-1ubuntu1~16.04.4]
xserver-xorg-legacy-hwe-16.04/xenial-updates 2:1.19.5-0ubuntu2~16.04.1 amd64 [upgradable from: 2:1.19.3-1ubuntu1~16.04.4]

3. apt-check

Command “apt-check” best suits to schedule a cron job to report admin when updates available.

#/usr/lib/update-notifier/apt-check --human-readable
11 packages can be updated.
0 updates are security updates.
#/usr/lib/update-notifier/apt-check -p
libglapi-mesa
squashfs-tools
libxatracker2
libegl1-mesa
libgbm1
libwayland-egl1-mesa
libgl1-mesa-dri
xserver-xorg-core-hwe-16.04
libgl1-mesa-glx
xserver-xorg-legacy-hwe-16.04

4. Using “dpkg”

Hope this command works for any release of Ubuntu. Run “apt-get update” before populating the below list.

#dpkg --get-selections | xargs apt-cache policy {} | grep -1 Installed | \

sed -r 's/(:|Installed: |Candidate: )//' | uniq -u | tac  | \

sed '/--/I,+1 d' | tac | sed '$d' | sed -n 1~2p
ansible
grub-common
grub-pc
grub-pc-bin
grub2-common
ieee-data
libbonobo2-0
libbonobo2-common
libdrm-amdgpu1
libdrm-intel1
libdrm-nouveau2
libdrm-radeon1
libdrm2
libegl1-mesa
libgbm1
libgl1-mesa-dri
libgl1-mesa-glx
libglapi-mesa
libgnome2-common
libgnomevfs2-common
libseccomp2
libwayland-egl1-mesa
libxatracker2
mesa-va-drivers
squashfs-tools
unattended-upgrades
xserver-xorg-core-hwe-16.04
xserver-xorg-legacy-hwe-16.04

5. Using “aptitude”

With “aptitude” different output format shown as example. The aptitude package must be installed for this command to work.

#aptitude search -F '%p' --disable-columns '~U'
grub-common 
grub-pc
grub-pc-bin
grub2-common
libdrm-amdgpu1
libdrm-intel1
libdrm-nouveau2
libdrm-radeon1
libdrm2
libegl1-mesa
libgbm1
libgl1-mesa-dri
libgl1-mesa-glx
libglapi-mesa
libseccomp2
libwayland-egl1-mesa
libxatracker2
mesa-va-drivers
squashfs-tools
unattended-upgrades
xserver-xorg-core-hwe-16.04
xserver-xorg-legacy-hwe-16.04

Column separated with package description.

#aptitude search '~U'
i grub-common - GRand Unified Bootloader (common files)
i grub-pc - GRand Unified Bootloader, version 2 (PC/BI
i grub-pc-bin - GRand Unified Bootloader, version 2 (PC/BI
i grub2-common - GRand Unified Bootloader (common files for
i libdrm-amdgpu1 - Userspace interface to amdgpu-specific ker
i libdrm-intel1 - Userspace interface to intel-specific kern
i libdrm-nouveau2 - Userspace interface to nouveau-specific ke
i libdrm-radeon1 - Userspace interface to radeon-specific ker
i libdrm2 - Userspace interface to kernel DRM services
i libegl1-mesa - free implementation of the EGL API -- runt
i libgbm1 - generic buffer management API -- runtime
i libgl1-mesa-dri - free implementation of the OpenGL API -- D
i libgl1-mesa-glx - free implementation of the OpenGL API -- G
i libglapi-mesa - free implementation of the GL API -- share
i libseccomp2 - high level interface to Linux seccomp filt
i libwayland-egl1-mesa - implementation of the Wayland EGL platform
i libxatracker2 - X acceleration library -- runtime
i A mesa-va-drivers - Mesa VA-API video acceleration drivers
i squashfs-tools - Tool to create and append to squashfs file
i unattended-upgrades - automatic installation of security upgrade
i xserver-xorg-core-hwe-16.04 - Xorg X server - core server
i A xserver-xorg-legacy-hwe-16.04 - setuid root Xorg server wrapper

These details were available in web but spread across multiple sites. Hence thought of unifying it under single page. If you know any tools other than mentioned here feel free to comment on it. Any suggestions/feedback do comment below. If you love the page comment as “+1”.

3 thoughts on “Ubuntu – List available package updates

Comments are closed.