Restoring the Pop!_OS recovery entry in systemd-boot

· Updated · 4 min read · Linux
Pop_OS!

This guide restores a missing recovery entry in the systemd-boot menu of Pop!_OS 22.04. The recovery partition was still on disk; only its loader entry had gone, and recreating one file brought it back.

Written for Pop!_OS 22.04 in August 2022. The steps have not been retested on later releases.

I have run Pop!_OS as my daily driver for months, on a customised dual-boot install (Windows 11 and Pop!_OS) with Pop!_OS on btrfs. A few days before writing this I started getting I/O errors and suspected filesystem corruption. I tried to reboot into the recovery partition to check the filesystem and found the entry was gone from the boot menu. I am writing this as a reminder for myself in case it happens again.

The recovery partition is a full copy of the Pop!_OS installation disk and behaves like a live USB. From it you can repair or reinstall the system, either as a refresh install (which keeps your home directory) or a clean install (which resets all OS data). See Recovery Partition in the System76 documentation.

Keep regular backups of your system and personal files. This procedure should not put them at risk, but a backup costs nothing.

Assumptions

Pop!_OS was installed with the default encrypted layout: an EFI partition (FAT32), a recovery partition (FAT32), and a LUKS volume holding LVM with ext4 for / and swap (btrfs in my case).

The disk is /dev/sda. Run lsblk or fdisk -l to check yours. On my machine lsblk returns:

NAME            MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
loop0             7:0    0  27.1M  1 loop  /snap/chromium-ffmpeg/28
loop1             7:1    0  18.4M  1 loop  /snap/chromium-ffmpeg/30
loop2             7:2    0  55.5M  1 loop  /snap/core18/2409
loop3             7:3    0  55.6M  1 loop  /snap/core18/2538
loop4             7:4    0    62M  1 loop  /snap/core20/1587
loop5             7:5    0    62M  1 loop  /snap/core20/1611
loop6             7:6    0   103M  1 loop  /snap/lxd/23339
loop7             7:7    0   103M  1 loop  /snap/lxd/23367
loop8             7:8    0    47M  1 loop  /snap/snapd/16010
loop9             7:9    0    47M  1 loop  /snap/snapd/16292
sda               8:0    0 465.8G  0 disk  
├─sda1            8:1    0   498M  0 part  /boot/efi
├─sda2            8:2    0     4G  0 part  /recovery
└─sda3            8:3    0 461.3G  0 part  
  └─cryptdata   253:0    0 461.3G  0 crypt 
    ├─data-root 253:1    0 441.3G  0 lvm   /run/timeshift/backup
    │                                      /var/lib/docker/btrfs
    │                                      /home
    │                                      /
    └─data-swap 253:2    0    16G  0 lvm   [SWAP]
sdb               8:16   0 476.9G  0 disk  
├─sdb1            8:17   0   260M  0 part  
├─sdb2            8:18   0   128M  0 part  
├─sdb3            8:19   0   475G  0 part  
├─sdb7            8:23   0   525M  0 part  
└─sdb8            8:24   0     1G  0 part  

sdb holds Windows 11, sda is the SSD with Pop!_OS, and /dev/sda2 is the recovery partition. I ignore sdb. If Pop!_OS is not on sda for you, adjust the commands.

Check the boot menu entries

Pop!_OS uses systemd-boot, not GRUB. The entries live in /boot/efi/loader/entries. Open a terminal and become root:

sudo -i

List the entries:

$ cd /boot/efi/loader/entries
$ ls -l 
drwx------ 2 root root 4.0K Aug 16 16:35 ./
drwx------ 3 root root 4.0K Aug 16 16:48 ../
-rwx------ 1 root root  348 Aug 12 22:25 Pop_OS-current.conf*
-rwx------ 1 root root  366 Aug 12 22:25 Pop_OS-oldkern.conf*

There is no file for the recovery partition, so I recreate it.

By default Pop!_OS shows no boot menu; you hold the spacebar while systemd-boot starts to see it. To show the menu on every boot, edit /boot/efi/loader/loader.conf and add timeout 2 at the end. The file should end like this:

default Pop_OS-current
timeout 2

Recreate the entry

You need the UUID and the partition UUID (PARTUUID) of the recovery partition. Read both with:

$ blkid /dev/sda2
/dev/sda2: UUID="7D44-37D9" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="recovery" PARTUUID="581b8482-5689-49b6-bc0a-52ab82a514d7"

Your UUID and PARTUUID values will differ.

Create a new file in /boot/efi/loader/entries. I named it Recovery.conf. The template is:

title Pop!_OS recovery
linux /EFI/Recovery-{{ UUID }}/vmlinuz.efi
initrd /EFI/Recovery-{{ UUID }}/initrd.gz
options boot=casper hostname=recovery userfullname=Recovery username=recovery live-media-path=/casper-{{ UUID }} live-media=/dev/disk/by-partuuid/{{ PARTITION UUID }} noprompt

My file, with the values from the blkid output above:

title Pop!_OS recovery
linux /EFI/Recovery-7D44-37D9/vmlinuz.efi
initrd /EFI/Recovery-7D44-37D9/initrd.gz
options boot=casper hostname=recovery userfullname=Recovery username=recovery live-media-path=/casper-7D44-37D9 live-media=/dev/disk/by-partuuid/581b8482-5689-49b6-bc0a-52ab82a514d7 noprompt

Save the file, run sync to be safe, reboot and test the recovery entry.

To create a recovery partition from scratch, see Creating a Recovery Partition in Pop!_OS.