5

After getting token from here and trying to enable livepatch:

sudo canonical-livepatch enable XXXXXXXXXXXXXXXXXX 

I get the following error message:

2020/08/31 17:19:57 error executing enable: cannot enable machine: bad temporary server status 500 (URL: https://livepatch.canonical.com/api/machine-tokens) server response: machine token already exists

How could I solve this problem and enable Canonical livepatch?

Ubuntu details:

NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

4 Answers4

9

EDIT (nearly 2 years later): This is the nuclear option, though I don't know of any cases where it has caused any real issues. Please try a simple disable and re-enable first. If that fails, try the snap remove and snap install steps. If the previous two things failed to fix it, read on:

I had this same problem today and I fixed it by doing the following:

  1. Disable Livepatch either through the GUI or by running canonical-livepatch disable as root
  2. Uninstall Livepatch with snap remove canonical-livepatch as root (optional. Try it first without doing this)
  3. Run the command rm /etc/machine-id as root to remove your current machine ID (if it says the file or directory doesn't exist, you can safely ignore it)
  4. Run the command systemd-machine-id-setup as root to regenerate the ID
  5. Reinstall Livepatch with snap install canonical-livepatch as root (if you removed it earlier)
  6. Either grab your key from https://auth.livepatch.canonical.com and follow the instructions there to re-enable or use the Livepatch GUI

If this works for you, please mark this answer as correct so I can get enough reputation to do stuff.

Edit: @scoobydoo had to run rm /etc/machine-id /var/lib/dbus/machine-id in step 3.

Riley
  • 140
  • 9
  • 2
    That works, thanks! I was looking for solutions for many days, none of them worked. Thank you! (A minor comment: after removing canonical-livepatch, it is unnecessary/not possible to disable livepatch.) – Benedek Dankó Sep 10 '20 at 09:31
  • 2
    Glad I could help! I edited my answer to fix that oversight. – Riley Sep 10 '20 at 20:15
  • 1
    This worked for me, thanks. I did not need to remove or re-install canonical-livepatch but I did need to rm /etc/machine-id /var/lib/dbus/machine-id – scoobydoo Jul 06 '21 at 05:50
1

Don't regenerate your machine-id unless you absolutely have to: you might simply need to uninstall and reinstall live patch. Assuming you have already disabled it via the GUI or command line (you should be prompted for your sudo password):

snap remove canonical-livepatch
snap install canonical-livepatch

Hit your search key (Windows key on many keyboards), search for Livepatch, and now enable from the GUI again. That worked for me and I didn't need to regenerate remove and remake the machine id.

GrayedFox
  • 191
0

I just did the following,.. as already had a token,.. that I had saved when 1st installed on my 18.04 m/c.

sudo canonical-livepatch disable       # to remove old UUID stuff
sudo canonical-livepatch enable xxxxxxxxxxxxxxxxxxxxxxxxxxxx

and got the following responses

Successfully disabled device. Removed machine-token: xxxxxxxxxxxxxxxxxxxxxxxxxxx
$ sudo canonical-livepatch enable xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Successfully enabled device. Using machine-token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Kulfy
  • 17,696
  • I also tried this first, but it didn't work, I couldn't enable canonical-livepatch in the last step. But @Riley 's instructions helped. – Benedek Dankó Oct 21 '20 at 09:07
0

Make sure to disconnect from your VPN, if you are using one. That was causing this issue for me.

Kosta
  • 1