3

A few hours ago my Canonical Livepatch stopped working. I searched for the solution and than decided to reinstall Canonical Livepatch. Now I am getting the following error:

Failed to enable Livepatch: cannot enable machine: cannot send request: 
  Post https://livepatch.canonical.com/api/machine-tokens: EOF

I could not find anything online about this problem so I'm posting. Thanks for your time.

Zanna
  • 69,223
  • 56
  • 216
  • 327
Mao Runzhi
  • 31
  • 4
  • Same here as well. `error executing enable: cannot enable machine: bad server status 401 (URL: https://livepatch.canonical.com/api/machine-tokens) server response: unauthorized` – Alexey Shcherbakov Aug 28 '20 at 19:31

1 Answers1

2

After a while i was able to find a solution, so to speak. Well, sorta. Nevertheless, it works like a charm in my particular situation.

1) sudo canonical-livepatch disable
2) sudo snap remove canonical-livepatch
3) sudo cp /etc/machine-id /etc/machine-id.original
4) sudo cp /var/lib/dbus/machine-id /var/lib/dbus/machine-id.original
5) gedit /etc/machine-id 
(remove everything and save empty machine-id)
6) sudo systemd-machine-id-setup

reboot

7) sudo snap install canonical-livepatch

Now proceed to (https://auth.livepatch.canonical.com/) and obtain the token, then

8) sudo canonical-livepatch enable [your token]

Your livepatch should work from this point pretty stable and apply necessary updates.

Source: Canonical livepatch failed when I tried to enable token

Alexey Shcherbakov
  • 91
  • 1
  • 1
  • 10
  • I have tried your solution but it does not work in my case. This is what I have on my terminal after applying your solution: "canonical-livepatch 9.5.5 from Canonical✓ installed" and "Successfully enabled device. Using machine-token:xxxxxxxxxxxxxxxx" but also in Software & Updates there is: "Canonical Livepatch has experienced an internal error. Please refer to https://wiki.ubuntu.com/Kernel/Livepatch#CommonIssues for further information." and Lifepatch status in the top bar have red exclamation mark. – Mao Runzhi Aug 30 '20 at 13:47
  • Have you tried this one, for the instance? `sudo canonical-livepatch refresh` By the way, can you provide the output: `sudo canonical-livepatch status --verbose`, `systemctl status snap.canonical-livepatch.canonical-livepatchd.service` and `grep livepatch /var/log/syslog` (upload the results on https://pastebin.ubuntu.com/) I myself have a little to no experience, but maybe i can work out something in the meantime. – Alexey Shcherbakov Aug 30 '20 at 20:51
  • I have tried refresh which gives me following output: sudo canonical-livepatch refresh checking for patches nothing to apply kernel: 5.4.0-42.46-generic patch state: ✗ the application caused a crash last time it was applied, check system logs with `journalctl -f -t canonical-livepatch` patch version: 70.3 xxx@xxx:~$ journalctl -f -t canonical-livepatch No journal files were found. Anyhow here is the output:"https://pastebin.ubuntu.com/p/3x8yRBBvcx/" Thanks. – Mao Runzhi Aug 30 '20 at 22:01
  • `canonical-livepatch[883]: System contains non-livepatch tainted modules. canonical-livepatch[883]: Module may have caused kernel crash! Not inserting module. canonical-livepatch[883]: To override this warning, remove /var/snap/canonical-livepatch/common/locks/livepatch_Ubuntu_5_4_0_42_46_generic_70_70.3` Considering this lines, i presume, that you'll need to do as follows: remove `livepatch_Ubuntu_5_4_0_42_46_generic_70_70.3` file. I suggest you moving it or rename, just in case. Than reboot your pc. – Alexey Shcherbakov Aug 31 '20 at 00:10
  • Removed and changed name. Rebooted. Folder "/var/snap/canonical-livepatch/common/locks" is empty but after trying commands from your previous post i have same result as before:" Aug 31 10:10:23 tze canonical-livepatch[890]: during refresh: cannot apply patches: lock file "/var/snap/canonical-livepatch/common/locks/livepatch_Ubuntu_5_4_0_42_46_generic_70_70.3" already exists" – Mao Runzhi Aug 31 '20 at 08:26
  • According to the line Aug 30 15:21:01 `tze canonical-livepatch[3020]: during refresh: cannot apply patches: cannot apply update: cannot execute finitModule syscall: operation not permitted` it's PROBABLY refers to SecureBoot issues explaning at (https://wiki.ubuntu.com/Kernel/Livepatch), but, frankly said, i lack the necessary knowledge about this situation. I suggest you fill the bug report at (https://bugs.launchpad.net/canonical-livepatch-client/+bug/1833566) or ask someone more experienced. I'm sorry for not able to be of any help. – Alexey Shcherbakov Aug 31 '20 at 16:15
  • Just few minutes ago I received 179,3 MB of update. Livepatch status in the top bar is safe (green) again. I guess it was some kind of bug. Thanks a lot for your help, I have learned few useful commands from your posts, Best wishes. – Mao Runzhi Aug 31 '20 at 17:17