Canonical Livepatch: Request for installation and auto-connection of system-files plugs

Hello,

The canonical-livepatch snap has added 3 new system-files plugs etc-kernel-postinst-d, etc-apt-conf-d and boot-grub. These plugs are required to enable a new feature for improved reboot recommendations to Livepatch users. Please review and allow the use and auto-connection of this plug.

  1. etc-kernel-postinst-d: The purpose of this plug is to allow write access to the file /etc/kernel/postinst.d/livepatch-kernel-installed . This file will consist of a simple shell script that writes a kernel installed marker to /run/canonical-livepatch-kernel-installed. This marker is then consumed by another process. The purpose of writing this marker is to allow for early exits, when a package other than a kernel package is being installed through apt.
  2. etc-apt-conf-d: The purpose of this plug is to allow write access to the file /etc/apt/apt.conf.d/20canonical-livepatch. This file will be inserted by the canonical-livepatch snap. The inserted file will register an apt Post-Invoke hook that runs a script after apt’s dpkg call sequence. The script will influence automatic reboots and system restart notifications when Canonical Livepatch provides security coverage for vulnerabilities in the running kernel. The script that runs here will consume the marker created by the /etc/kernel/postinst.d/livepatch-kernel-installed script mentioned above.
  3. boot-grub: The purpose of this plug is to allow read access to the files /boot/grub/grub.cfg and /boot/grub/grubenv. This is required for the canonical-livepatch snap to read the GRUB configuration and GRUB environment to determine the kernel that will be booted on the next reboot. Determining this is important for the canonical-livepatch snap to provide reboot recommendations. Since the host’s /boot is not bind-mounted into the snap’s mount namespace, we access these files through /var/lib/snapd/hostfs/.

Inserting the above-mentioned scripts from the canonical-livepatch snap would allow the unattended-upgrades and update-notifier scripts in the kernel post-install directory to remove their Livepatch dependent code that violated separation of concerns. This would solve a long-standing bug while not compromising on the intended feature.

Reading the grub config and environment also provides Livepatch with the necessary information to accurately provide reboot recommendations, thereby enhancing the initially intended feature.


name: canonical-livepatch

description: Canonical Livepatch patches high and critical linux kernel vulnerabilities removing the immediate need to reboot to upgrade the kernel, instead allowing the downtime to be scheduled. It is a part of the Ubuntu Pro offering.
The Canonical Livepatch Client is an application that runs on your machine and periodically checks for patches.
See our docs at https://ubuntu.com/security/livepatch/docs/livepatch

snapcraft: PRIVATE
upstream: PRIVATE
upstream-relation: Canonical owned and managed snap. I am an engineer working on this project.
plugs:
  etc-kernel-postinst-d:
    interface: system-files
    attributes:
      write:
        - /etc/kernel/postinst.d/livepatch-kernel-installed
    request-type: installation and auto-connection
    reasoning: insert a script that writes a kernel installed marker to /run/canonical-livepatch-kernel-installed. The marker is then consumed by other processes to enable early exits. (See above for more details and context).

  etc-apt-conf-d:
    interface: system-files
    attributes:
      write:
        - /etc/apt/apt.conf.d/20canonical-livepatch
    request-type: installation and auto-connection
    reasoning: insert a file that registers an apt Post-Invoke hook that runs a script after apt’s dpkg call sequence. This script is responsible for influencing automatic reboots and system restart notifications based on Livepatch security coverage and vulnerabilities fixed in the next-boot kernel. (See above for more details and context).

  boot-grub:
    interface: system-files
    attributes:
      read:
        - /var/lib/snapd/hostfs/boot/grub/grub.cfg
        - /var/lib/snapd/hostfs/boot/grub/grubenv
    request-type: installation and auto-connection
    reasoning: read the GRUB configuration and GRUB environment to determine the kernel that will be booted on the next reboot. Determining this is important for the canonical-livepatch snap to provide reboot recommendations. (See above for more details and context).

This request has been added to the queue for review by the @reviewers team.

Hi @prinsonf7

+1 from me to grant access to requested files using system-files interface with auto-connection. What do other reviewers think?

1 Like

Hello @prinsonf7 :slight_smile:

This is also a +1 from me for installation and auto-connection of all three plugs. The request is well-scoped and consistent with the snap’s purpose!

1 Like

Hi @prinsonf7

Please upload the new revision of the snap with the new system-files interfaces.

1 Like

Hello @shishirsub10 . We will upload the new revision to snapstore this week, most likely tomorrow. Thank you for the approvals!

Have these plugs been tested on Ubuntu Core ?

Neither of the two /etc directories exist there, I’m not sure of that will be handled gracefully when you pre-seed livepatch in an Ubuntu Core image and uninstallable snaps make the Core image unbootable without any user feedback.

Hello @ogra . These plugs have not been tested on Ubuntu Core. Livepatch Client has also been shipped with another plug that writes to /etc for around 4 years now. That plug might also cause issues when pre-seeding on Core, if these do.

I believe we can continue this discussion elsewhere and run some tests to find out if the errors are handled gracefully when Livepatch is installed on Ubuntu Core systems.

1 Like

+2 votes for, 0 against, granting installation and auto-connection of all three system-files plugs to the canonical-livepatch snap. This now live!

1 Like