[Unit] Description=Read Ubuntu Livepatch status (for kernelwatch) # Pulled in by kernelwatch-agent.service before each report. Skipped cleanly on # hosts without the Livepatch snap (or python3); the dashboard then treats a # pending kernel reboot as it always did. ConditionPathExists=/snap/bin/canonical-livepatch ConditionPathExists=/usr/bin/python3 [Service] Type=oneshot # `canonical-livepatch status` needs root and a snap cgroup, so it can't run in # the agent's unprivileged unit. The helper keeps only the running kernel's # fields. If Livepatch isn't enabled or fails, no file is written and the agent # reports nothing for it. ExecStart=/bin/sh -c '/snap/bin/canonical-livepatch status --format json | /usr/bin/python3 -I /usr/local/sbin/kernelwatch-livepatch > /run/kernelwatch/livepatch.new && mv /run/kernelwatch/livepatch.new /run/kernelwatch/livepatch || { rm -f /run/kernelwatch/livepatch.new; exit 1; }' RuntimeDirectory=kernelwatch RuntimeDirectoryMode=0755 RuntimeDirectoryPreserve=yes UMask=0022 TimeoutStartSec=2min # Root, no network. Snap's confinement (setuid snap-confine, mount namespaces) # rules out NoNewPrivileges, a capability bound, RestrictNamespaces and a # syscall filter, so the sandbox is limited to a read-only filesystem and no # network. User=root PrivateNetwork=yes ProtectSystem=strict ProtectHome=read-only PrivateTmp=yes