How To Set Up Canonical Livepatch On Ubuntu 20.04 "Focal Fossa"

Sohail
Sohail

Table of Contents

Canonical Livepatch was introduced in Ubuntu 16.04. The livepatch option allows you to install kernel updates without a system reboot. It is a great option, and servers must have it enabled to prevent system reboot.

The upcoming Ubuntu 20.04 “Focal Fossa” supports Canonical Livepatch.

Livepatch important for servers

If Ubuntu powers your server, then you should enable Canonical Livepatch. Livepatch will silently install Kernel updates without requiring a system reboot. However, it is also available for Desktop users but is less useful.

The entire purpose of Livepatch is to prevent the system reboot after the kernel updates; the desktop users will anyway restart the computer now and then. So Livepatch can be installed and set up but will rarely be used.

Also, it’s important to note that the Livepatch feature is free for up to 3 devices for personal use. You can set up Livepatch on Desktops, servers, virtual machines, and in the cloud. Organizations will need to pay for the service by subscribing to Ubuntu Advantage.

How to set up Canonical Livepatch in Ubuntu 20.04 “Focal Fossa”

For Ubuntu desktop users

  • Setting up livepatch on Ubuntu desktop is very simple. Open settings and go to Software & updates. Go to Livepatch tab.
Ubuntu 20.04 Livepatch settings
Ubuntu 20.04 Livepatch settings
  • Click the “Sign in” button and enter your Ubuntu credentials. If you do not have Ubuntu account, please create one.
Sign in to set up livepatch
Sign in to set up livepatch
Sign on Ubuntu Account
Sign on Ubuntu Account
  • After signed in, click Continue when the popup shows up confirming you are logged in.
turn on Livepatching in Ubuntu 20.04
turn on Livepatching in Ubuntu 20.04
  • And that is it. The livepatch is set up on your Ubuntu 20.04 Desktop.
Ubuntu livepatch
Ubuntu livepatch

Errors In Ubuntu 20.04 with Livepatch

You may encounter the following error when enabling Livepatch on Ubuntu 20.04 Focal Fossa

Failed to enable Livepatch: cannot enable machine: this machine ID is already enabled with a different key or is non-unique. Either "sudo canonical-livepatch disable" on the other machine, or regenerate a unique /etc/machine-id on this machine with "sudo rm /etc/machine-id /var/lib/dbus/machine-id && sudo systemd-machine-id-setup" server response: Conflicting machine-id
Livepatch error
Livepatch error

To fix the error, type the following commands in the terminal –

cp /etc/machine-id /etc/machine-id.original
cp /var/lib/dbus/machine-id /var/lib/dbus/machine-id.original
nano /etc/machine-id (to remove the existing value)
systemd-machine-id-setup
> Initializing machine ID from D-Bus machine ID.
cat /etc/machine-id

For Ubuntu servers

Setting up Canonical Livepatch service is even easier on Ubuntu servers. Head over to Ubuntu’s Livepatch page and select “Ubuntu user”. Click “Get your livepatch token”.

Canonical Livepatch service token
Canonical Livepatch service token

It will show your livepatch token and the commands to install and enable livepatch service. Now copy the commands one by one and run them on the server.

sudo snap install canonical-livepatch
sudo canonical-livepatch enable UNIQUE_TOKEN

It is done! The livepatch is set up and installed on the server. To check the status, run the following command –

canonical-livepatch status --verbose
Linux TutorialsUncategorizedhow-to