Systemd is developing the ability to download system images via HTTP

Lennart Poettering proposed to include a change in the system manager systemd that allows booting the system using a root file system image obtained from an external host via HTTP. The change boils down to extending systemd with the ability not only to download a disk image via HTTP at the initial boot stage, but also to unpack the downloaded image, bind it to a block device in loopback mode, mount the block device as /sysroot and boot the system from it.

Support for downloading disk images during system boot using systemd-import-generator is already included in systemd 257. The rest of the functionality is still at the stage of a working prototype, requiring further development. The implementation does not yet support the full boot cycle, but in the future, the functionality is planned to be extended to booting via UEFI HTTP Boot of universal kernel images UKI (Unified Kernel Image), which combine in one file a bootloader for UEFI (UEFI boot stub), a Linux kernel image, and an initrd system environment loaded into memory.

The URL for loading the system image is planned to be calculated based on the URL specified for the EFI image in the UEFI HTTP Boot settings (for example, when loading via EFI HTTP Boot "http://example.com/somedir/myimage.efi", the UKI initrd handler will load the rootfs image as "http://example.com/somedir/myimage.raw.xz"). In the future, in addition to HTTP as a transport for obtaining an image, it is planned to add support for NVMe-over-TCP technology, which allows access to NVMe drives over the network (NVM Express over Fabrics) using the TCP protocol.

It is assumed that booting from images received from an external host will simplify the organization of testing modern immutable operating systems on real hardware. The developer can create an image with the system environment on his computer using the mkosi utility and make it available via HTTP using the mkosi -f serve command. On the computer on which the system operation needs to be tested, it is enough to enable booting via HTTP in EFI and add the URL of the image to be booted using the command: kernel-bootcfg —add-uri=http://192.168.47.11:8081/image.efi —title=testloop —boot-order=0

After that, you can simply reboot the computer and it will load a standard UKI kernel image, which will then load the disk image prepared by the developer from the root FS. Until HTTP boot is disabled in EFI, each subsequent reboot of the computer will result in loading a fresh system image. Local disks are not affected in any way during such testing.

Source: opennet.ru

Add a comment