You are not logged in.

#1 Yesterday 15:31:48

libreros
Member
Registered: Yesterday
Posts: 1

Implementing a PopOS-style recovery partition with systemd-boot

Hi everyone,

I’m planning a new Arch installation and I want to mirror a feature I really liked in Pop OS, the built-in recovery partition.

My goal is to use systemd-boot. I’d like to have a dedicated partition on the drive containing the ISO that I can boot into directly from the systemd-boot menu. The idea is to have this so I can restore snapshots without needing a physical USB/Live CD if the main system fails.

I am aware of methods with grub bootloader and such, but I really want systemd boot.

I would be so glad if someone could give me good instructions on how to do this.
   
Any advice or links to relevant threads would be much appreciated. Thanks!

Offline

#2 Yesterday 15:40:22

cryptearth
Member
Registered: 2024-02-03
Posts: 1,973

Re: Implementing a PopOS-style recovery partition with systemd-boot

as systemd-boot is yet another linux-capable bootloader it shouldn't be much different than grub or others
in the end i might would skip the idea of booting an install iso but just setup a second minimal install and add a regular entry to your boot menu - this way you can control its toolset and version
or you could pretty much just clone ventoy onto a disk
or, if you're able to, setup your network to provide pxe netboot (either your router may support it or if you have setup a SBC like a raspberryPi)

Offline

#3 Yesterday 15:50:21

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,582

Re: Implementing a PopOS-style recovery partition with systemd-boot

cryptearth wrote:

as systemd-boot is yet another linux-capable bootloader it shouldn't be much different than grub or others]

What in the world...

systemd-boot is not a bootloader, and is certainly NOTHING like grub at all. It can't load an ISO directly, you'd have to extract the ISO beforehand and load things that way, not really what the OP is looking for.

Offline

#4 Yesterday 16:03:24

frostschutz
Member
Registered: 2013-11-15
Posts: 1,611

Re: Implementing a PopOS-style recovery partition with systemd-boot

If you have a working Grub entry you can usually convert it to other boot loaders.

The only thing Grub does, that most other bootloaders don't do, is "loop mounting" an ISO to access the kernel, initrd files within. But that's just convenience.

You can just do that part yourself. Loop mount it in Linux, copy these two files out to where your bootloader can access them.

mkdir /mnt/archiso
mount -o loop archlinux-20YY.MM.DD-x86_64.iso /mnt/archiso
cp /mnt/archiso/arch/boot/x86_64/vmlinuz-linux /boot/archiso-linux
cp /mnt/archiso/arch/boot/x86_64/initramfs-linux.img /boot/archiso-initramfs

Then use 'kernel archiso-linux' and 'initrd archiso-initramfs' in your bootloader. Plus required kernel parameters / options.

Everything else is handled by the initrd of the live cd which has to have its own loop mounting logic (if the ISO is a file on some other filesystem partition), or support finding the ISO by UUID on any partition (if the ISO was written directly to that partition), not just /dev/sr0 /dev/cdrom /dev/usbstick type devices.

If you already got a working Grub entry, the parameters would be just the same as Grub uses.

Personally I prefer writing the ISO to a partition directly. It can be mounted directly. Not mount a filesystem first then loop-mount an ISO within.

With GPT partitions you can even set a partition label for it.

For example with a multi-boot USB stick, I have partitions like this:

# parted /dev/disk unit mib print
[...]
52      120363MiB  121277MiB  914MiB                 iso-systemrescue-11.02          lvm
53      121278MiB  125661MiB  4383MiB                iso-tumbleweed-install-2024-10  lvm
54      125662MiB  126555MiB  893MiB                 iso-tumbleweed-gnome-2024-10    lvm
55      126556MiB  127675MiB  1119MiB                iso-archlinux-2024-10           lvm
56      127676MiB  133728MiB  6052MiB                iso-ubuntu-24.04.3-desktop      lvm
57      133729MiB  139167MiB  5438MiB                iso-ubuntu-25.10-desktop        lvm
58      139168MiB  140635MiB  1467MiB                iso-archlinux-2025-12           lvm
[...]
# file -sL /dev/disk/by-partlabel/iso-archlinux-2025-12
/dev/disk/by-partlabel/iso-archlinux-2025-12: ISO 9660 CD-ROM filesystem data (DOS/MBR boot sector) 'ARCH_202512' (bootable)
# blkid /dev/disk/by-partlabel/iso-archlinux-2025-12
/dev/disk/by-partlabel/iso-archlinux-2025-12: BLOCK_SIZE="2048" UUID="2025-12-01-16-13-59-00" LABEL="ARCH_202512" TYPE="iso9660" PTUUID="16da8f38" PTTYPE="dos" PARTLABEL="iso-archlinux-2025-12" PARTUUID="1321d1c7-c0bf-4927-a5a2-32e45822869d"

And that's more or less all there is to it. Download an ISO. Create a partition that matches its size and name it accordingly. Write the iso to the /dev/disk/by-partlabel/iso-thename.

The most difficult part is to figure out the boot parameters, especially for loop-mounting an iso file. You usually have to pass the filename for those, parameters often named like isoloop or similar, but there's no standard that works across distributions. Some don't support it at all. Ideally someone else already did that part and you can find it in the wiki or with google. Otherwise you have to check the bootloader on the iso itself, and possibly even unpack the initrd and see what it is doing.

For the 2025-12 archiso, it's `archisobasedir=arch archisosearchuuid=2025-12-01-16-13-59-00` (uuid as shown by blkid above, also see loader/entries/01-archiso-linux.conf on the archiso itself). For arch ISO as partition, it "just works" to copy those.

title ArchLinux ISO 2025-12
kernel /archiso-linux
initrd /archiso-initrd
options archisobasedir=arch archisosearchuuid=2025-12-01-16-13-59-00

Not tested, I don't use systemd-boot, but roughly that's the process, for me anyway

Last edited by frostschutz (Yesterday 17:03:13)

Offline

Board footer

Powered by FluxBB