Update all packages in Ubuntu

Updating packages in Ubuntu is sometimes needed to upgrade your Ubuntu to latest version and apply security updates. We can also upgrade all packages in the system to make sure we use the latest version of all packages. Steps below.

Update repositories

> sudo apt update

sudo apt update updates the Ubuntu repositories so that your system checks against the repositories and lists our newer versions if available.

> sudo apt update
Hit:1 http://mirrors.digitalocean.com/ubuntu focal InRelease
Hit:2 http://mirrors.digitalocean.com/ubuntu focal-updates InRelease
Hit:3 http://mirrors.digitalocean.com/ubuntu focal-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
82 packages can be upgraded. Run 'apt list --upgradable' to see them.

View packages

To view the list of packages that can be updated use apt list –upgradable. This is an optional step.

> apt list --upgradable
Listing... Done
alsa-ucm-conf/focal-updates 1.2.2-1ubuntu0.5 all [upgradable from: 1.2.2-1ubuntu0.4]
apt-utils/focal-updates 2.0.4 amd64 [upgradable from: 2.0.2ubuntu0.2]
apt/focal-updates 2.0.4 amd64 [upgradable from: 2.0.2ubuntu0.2]
base-files/focal-updates 11ubuntu5.3 amd64 [upgradable from: 11ubuntu5.2]
bind9-dnsutils/focal-updates 1:9.16.1-0ubuntu2.7 amd64 [upgradable from: 1:9.16.1-0ubuntu2.6]
bind9-host/focal-updates 1:9.16.1-0ubuntu2.7 amd64 [upgradable from: 1:9.16.1-0ubuntu2.6]
bind9-libs/focal-updates 1:9.16.1-0ubuntu2.7 amd64 [upgradable from: 1:9.16.1-0ubuntu2.6]
busybox-initramfs/focal-updates 1:1.30.1-4ubuntu6.3 amd64 [upgradable from: 1:1.30.1-4ubuntu6.2]
busybox-static/focal-updates 1:1.30.1-4ubuntu6.3 amd64 [upgradable from: 1:1.30.1-4ubuntu6.2]
cloud-init/focal-updates 20.4.1-0ubuntu1~20.04.1 all [upgradable from: 20.3-2-g371b392c-0ubuntu1~20.04.1]
cryptsetup-bin/focal-updates 2:2.2.2-3ubuntu2.3 amd64 [upgradable from: 2:2.2.2-3ubuntu2.2]
cryptsetup-initramfs/focal-updates 2:2.2.2-3ubuntu2.3 all [upgradable from: 2:2.2.2-3ubuntu2.2]
cryptsetup-run/focal-updates 2:2.2.2-3ubuntu2.3 all [upgradable from: 2:2.2.2-3ubuntu2.2]
cryptsetup/focal-updates 2:2.2.2-3ubuntu2.3 amd64 [upgradable from: 2:2.2.2-3ubuntu2.2]
dirmngr/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
friendly-recovery/focal-updates 0.2.41ubuntu0.20.04.1 all [upgradable from: 0.2.41]
gnupg-l10n/focal-updates 2.2.19-3ubuntu2.1 all [upgradable from: 2.2.19-3ubuntu2]
gnupg-utils/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gnupg/focal-updates 2.2.19-3ubuntu2.1 all [upgradable from: 2.2.19-3ubuntu2]
gpg-agent/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpg-wks-client/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpg-wks-server/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpg/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpgconf/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpgsm/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpgv/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
grub-common/focal-updates 2.04-1ubuntu26.9 amd64 [upgradable from: 2.04-1ubuntu26.4]
grub-efi-amd64-bin/focal-updates 2.04-1ubuntu26.9 amd64 [upgradable from: 2.04-1ubuntu26.4]
grub-efi-amd64-signed/focal-updates 1.142.11+2.04-1ubuntu26.9 amd64 [upgradable from: 1.142.6+2.04-1ubuntu26.4]
grub-pc-bin/focal-updates 2.04-1ubuntu26.9 amd64 [upgradable from: 2.04-1ubuntu26.4]
grub-pc/focal-updates 2.04-1ubuntu26.9 amd64 [upgradable from: 2.04-1ubuntu26.4]
grub2-common/focal-updates 2.04-1ubuntu26.9 amd64 [upgradable from: 2.04-1ubuntu26.4]
libapt-pkg6.0/focal-updates 2.0.4 amd64 [upgradable from: 2.0.2ubuntu0.2]
libasound2-data/focal-updates 1.2.2-2.1ubuntu2.3 all [upgradable from: 1.2.2-2.1ubuntu2]
libasound2/focal-updates 1.2.2-2.1ubuntu2.3 amd64 [upgradable from: 1.2.2-2.1ubuntu2]
libc-bin/focal-updates 2.31-0ubuntu9.2 amd64 [upgradable from: 2.31-0ubuntu9.1]
libc-dev-bin/focal-updates 2.31-0ubuntu9.2 amd64 [upgradable from: 2.31-0ubuntu9.1]
libc6-dev/focal-updates 2.31-0ubuntu9.2 amd64 [upgradable from: 2.31-0ubuntu9.1]
libc6/focal-updates 2.31-0ubuntu9.2 amd64 [upgradable from: 2.31-0ubuntu9.1]
libcryptsetup12/focal-updates 2:2.2.2-3ubuntu2.3 amd64 [upgradable from: 2:2.2.2-3ubuntu2.2]
libdrm-common/focal-updates 2.4.102-1ubuntu1~20.04.1 all [upgradable from: 2.4.101-2]
libdrm2/focal-updates 2.4.102-1ubuntu1~20.04.1 amd64 [upgradable from: 2.4.101-2]
libefiboot1/focal-updates 37-2ubuntu2.2 amd64 [upgradable from: 37-2ubuntu2]
libefivar1/focal-updates 37-2ubuntu2.2 amd64 [upgradable from: 37-2ubuntu2]
libnetplan0/focal-updates 0.101-0ubuntu3~20.04.2 amd64 [upgradable from: 0.99-0ubuntu3~20.04.2]
libnss-systemd/focal-updates 245.4-4ubuntu3.4 amd64 [upgradable from: 245.4-4ubuntu3.2]
libpam-systemd/focal-updates 245.4-4ubuntu3.4 amd64 [upgradable from: 245.4-4ubuntu3.2]
libparted2/focal-updates 3.3-4ubuntu0.20.04.1 amd64 [upgradable from: 3.3-4]
libplymouth5/focal-updates 0.9.4git20200323-0ubuntu6.2 amd64 [upgradable from: 0.9.4git20200323-0ubuntu6]
libpulse0/focal-updates 1:13.99.1-1ubuntu3.10 amd64 [upgradable from: 1:13.99.1-1ubuntu3.8]
libsystemd0/focal-updates 245.4-4ubuntu3.4 amd64 [upgradable from: 245.4-4ubuntu3.2]
libudev1/focal-updates 245.4-4ubuntu3.4 amd64 [upgradable from: 245.4-4ubuntu3.2]
locales/focal-updates 2.31-0ubuntu9.2 all [upgradable from: 2.31-0ubuntu9.1]
lshw/focal-updates 02.18.85-0.3ubuntu2.20.04.1 amd64 [upgradable from: 02.18.85-0.3ubuntu2]
lsof/focal-updates 4.93.2+dfsg-1ubuntu0.20.04.1 amd64 [upgradable from: 4.93.2+dfsg-1]
motd-news-config/focal-updates 11ubuntu5.3 all [upgradable from: 11ubuntu5.2]
netplan.io/focal-updates 0.101-0ubuntu3~20.04.2 amd64 [upgradable from: 0.99-0ubuntu3~20.04.2]
node-uid-number/focal-updates 0.0.6-1ubuntu0.20.04.1 all [upgradable from: 0.0.6-1]
open-vm-tools/focal-updates 2:11.1.5-1~ubuntu20.04.2 amd64 [upgradable from: 2:11.0.5-4]
openssh-client/focal-updates,focal-security 1:8.2p1-4ubuntu0.2 amd64 [upgradable from: 1:8.2p1-4ubuntu0.1]
openssh-server/focal-updates,focal-security 1:8.2p1-4ubuntu0.2 amd64 [upgradable from: 1:8.2p1-4ubuntu0.1]
openssh-sftp-server/focal-updates,focal-security 1:8.2p1-4ubuntu0.2 amd64 [upgradable from: 1:8.2p1-4ubuntu0.1]
parted/focal-updates 3.3-4ubuntu0.20.04.1 amd64 [upgradable from: 3.3-4]
plymouth-theme-ubuntu-text/focal-updates 0.9.4git20200323-0ubuntu6.2 amd64 [upgradable from: 0.9.4git20200323-0ubuntu6]
plymouth/focal-updates 0.9.4git20200323-0ubuntu6.2 amd64 [upgradable from: 0.9.4git20200323-0ubuntu6]
pollinate/focal-updates 4.33-3ubuntu1.20.04.1 all [upgradable from: 4.33-3ubuntu1]
python-apt-common/focal-updates 2.0.0ubuntu0.20.04.4 all [upgradable from: 2.0.0ubuntu0.20.04.3]
python3-apt/focal-updates 2.0.0ubuntu0.20.04.4 amd64 [upgradable from: 2.0.0ubuntu0.20.04.3]
python3-distupgrade/focal-updates 1:20.04.30 all [upgradable from: 1:20.04.28]
python3-software-properties/focal-updates 0.98.9.4 all [upgradable from: 0.98.9.3]
python3-twisted-bin/focal-updates 18.9.0-11ubuntu0.20.04.1 amd64 [upgradable from: 18.9.0-11]
python3-twisted/focal-updates 18.9.0-11ubuntu0.20.04.1 all [upgradable from: 18.9.0-11]
python3-update-manager/focal-updates 1:20.04.10.6 all [upgradable from: 1:20.04.10.1]
software-properties-common/focal-updates 0.98.9.4 all [upgradable from: 0.98.9.3]
sosreport/focal-updates 4.0-1~ubuntu0.20.04.3 amd64 [upgradable from: 4.0-1~ubuntu0.20.04.2]
systemd-sysv/focal-updates 245.4-4ubuntu3.4 amd64 [upgradable from: 245.4-4ubuntu3.2]
systemd-timesyncd/focal-updates 245.4-4ubuntu3.4 amd64 [upgradable from: 245.4-4ubuntu3.2]
systemd/focal-updates 245.4-4ubuntu3.4 amd64 [upgradable from: 245.4-4ubuntu3.2]
ubuntu-release-upgrader-core/focal-updates 1:20.04.30 all [upgradable from: 1:20.04.28]
udev/focal-updates 245.4-4ubuntu3.4 amd64 [upgradable from: 245.4-4ubuntu3.2]
update-manager-core/focal-updates 1:20.04.10.6 all [upgradable from: 1:20.04.10.1]
update-notifier-common/focal-updates 3.192.30.5 all [upgradable from: 3.192.30]

Upgrade packages

To upgrade all these packages at once use sudo apt upgrade. This will ask for your confirmation by showing the memory to be used for new packages. Press Y and Press Enter.

> sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  alsa-ucm-conf apt apt-utils base-files bind9-dnsutils bind9-host bind9-libs busybox-initramfs busybox-static cloud-init cryptsetup cryptsetup-bin cryptsetup-initramfs cryptsetup-run dirmngr
  friendly-recovery gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm gpgv grub-common grub-efi-amd64-bin grub-efi-amd64-signed grub-pc grub-pc-bin grub2-common
  libapt-pkg6.0 libasound2 libasound2-data libc-bin libc-dev-bin libc6 libc6-dev libcryptsetup12 libdrm-common libdrm2 libefiboot1 libefivar1 libnetplan0 libnss-systemd libpam-systemd libparted2
  libplymouth5 libpulse0 libsystemd0 libudev1 locales lshw lsof motd-news-config netplan.io node-uid-number open-vm-tools openssh-client openssh-server openssh-sftp-server parted plymouth
  plymouth-theme-ubuntu-text pollinate python-apt-common python3-apt python3-distupgrade python3-software-properties python3-twisted python3-twisted-bin python3-update-manager software-properties-common
  sosreport systemd systemd-sysv systemd-timesyncd ubuntu-release-upgrader-core udev update-manager-core update-notifier-common
82 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 33.9 MB/35.0 MB of archives.
After this operation, 411 kB of additional disk space will be used.
Do you want to continue? [Y/n]