Public bug reported:

On an Ubuntu 26.10 desktop installed with hardware-backed (TPM) disk
encryption, boot is managed by snapd and /boot/grub is a bind mount of
the ubuntu-boot partition's EFI/ubuntu directory, so /boot/grub/grub.cfg
is snapd's run-mode GRUB config. boot-managed-by-snapd (4build2) is
installed and is meant to keep the deb boot stack off such systems.

Running "sudo apt install kubuntu-desktop" pulls in grub2-common (which
ships /usr/sbin/update-grub), and several of the new packages' postinst
scripts then run update-grub. grub-mkconfig replaces snapd's grub.cfg
with a config generated from /etc/grub.d, and the next boot fails in
GRUB with:

error: file `/EFI/ubuntu/x86_64-efi/luks2.mod' not found.
error: no such device: <uuid of the LUKS container>.
error: no server is specified.

HOW GRUB2-COMMON GETS IN

kubuntu-desktop 1.503:
- Depends: memtest86+ -> memtest86+ 8.10-2 Depends: grub-common (provided by 
grub2-common 2.14-2ubuntu3)
- Depends: plymouth-theme-kubuntu-logo -> plymouth-theme-kubuntu-logo 1:26.10.2 
Depends: grub2-common
- Recommends: grub-theme-breeze

boot-managed-by-snapd 4build2 conflicts with grub-efi-amd64(-signed),
grub-efi-arm64(-signed), grub-pc, linux-firmware, linux-image, nullboot,
secureboot-db, shim and shim-signed, but not grub-common or
grub2-common, so nothing stops this.

WHAT RAN UPDATE-GRUB (from /var/log/apt/term.log)

Setting up memtest86+ (8.10-2)…
Generating grub configuration file ...
Setting up plymouth-theme-kubuntu-logo (1:26.10.2)…
Generating grub configuration file ...
Setting up kubuntu-settings-desktop (1:26.10.2)…
Generating grub configuration file ...

Other installed packages whose maintainer scripts call update-grub once
it exists: friendly-recovery, kdump-tools, plymouth-theme-spinner,
systemd-sysv. So any later upgrade of these can repeat the breakage.

The generated config has no Linux entry: /etc/grub.d/10_linux finds no
kernels, because the kernel comes from the pc-kernel snap. Its only boot
entries are the memtest86+ ones from /etc/grub.d/20_memtest86+ (plus
UEFI firmware settings), and those load cryptodisk/luks2 and search for
the LUKS container as $root.

A FIX LIKE THE ONE DISCUSSED WON'T WORK FOR KUBUNTU

The discussion on https://discourse.ubuntu.com/t/only-memtest-and-uefi-
settings-in-grub-menu/84952 says the plan for this release is for boot-
managed-by-snapd to conflict with grub-common. Because kubuntu-desktop
Depends on memtest86+, which Depends on grub-common, that would make
kubuntu-desktop uninstallable on TPM-FDE systems. It would also mean apt
proposes removing kubuntu-desktop on systems where both are already
installed, leaving Plasma marked as auto-removable.

A diversion that makes update-grub a no-op on snapd-managed systems (as
discussed for 26.04), or a check in update-grub itself, would avoid
that. Making memtest86+ a Recommends in kubuntu-desktop would help too.

WORKAROUND USED

1. Recover from the GRUB shell by chainloading /EFI/ubuntu/kernel.efi from the 
ubuntu-boot partition with "snapd_recovery_mode=run $snapd_full_cmdline_args" 
(after "load_env --file /EFI/ubuntu/grubenv").
2. Restore snapd's run-mode config: copy snapd 2.78's 
bootloader/assets/data/grub.cfg (Snapd-Boot-Config-Edition 3; identical to the 
copy embedded in the snapd binary) to /run/mnt/ubuntu-boot/EFI/ubuntu/grub.cfg.
3. Stop it happening again: "dpkg-divert --local --rename --divert 
/usr/sbin/update-grub.distrib --add /usr/sbin/update-grub", plus a no-op 
/usr/sbin/update-grub stub so maintainer scripts don't fail.

ENVIRONMENT
- Ubuntu 26.10 (stonking), classic hybrid install with TPM FDE (model 
canonical/ubuntu-classic-2610-amd64)
- snapd 2.78+ubuntu26.10, pc gadget 26.10-1 (rev 229), pc-kernel 7.3.0-11.12 
(rev 3931)
- boot-managed-by-snapd 4build2, grub2-common 2.14-2ubuntu3, memtest86+ 8.10-2, 
kubuntu-desktop 1.503
- Lenovo ThinkPad T14 Gen 4

** Affects: boot-managed-by-snapd (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: kubuntu-meta (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: memtest86+ (Ubuntu)
     Importance: Undecided
         Status: New

** Also affects: kubuntu-meta (Ubuntu)
   Importance: Undecided
       Status: New

** Also affects: memtest86+ (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2177215

Title:
  Installing kubuntu-desktop on a TPM-FDE (snapd-managed boot) system
  pulls in grub2-common; update-grub then overwrites snapd's grub.cfg
  and the system no longer boots

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/boot-managed-by-snapd/+bug/2177215/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to