systemd-sysupdate will fail if the OS image does not fit in the partitions that the installer created. Therefor, the partitions need to be very large so that there is plenty of room for the OS to grow. Furthermore, systemd-sysupdate requires both A and B copies of both the root and verity partitions. mkfs.ext4 is not able to produce images with files large enough to hold both the primary and backup copy of the root partition [1]. Reducing the sizes of partitions to be little greater than the size of the root filesystem image does not help. The produced file is still too large. Therefore, compress the image, which causes it to be small enough that mkfs.ext4 can handle it. This breaks the option to use the installer as a live image. Therefore, remove it. This option will return once Spectrum switches to the GNOME OS installer [2]. However, it is still possible to build a live image that is separate from the installer. Document how to build and use it. GRUB2 does support compressed loopback images, but these presumably buffer the whole image in memory. Since the entire installer will be replaced, making it work is not considered worthwhile. [1]: https://github.com/tytso/e2fsprogs/issues/254 [2]: https://spectrum-os.org/lists/archives/spectrum-devel/87wm4dlkhz.fsf@alyssa.... Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> --- Changes since v2: - Remove live image test instead of skipping it. - Document the change. - Document that there is still a live image available, though it is separate from the installer. - Document how to build the live image. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> --- Documentation/installation/getting-spectrum.adoc | 31 +++++++++++++++++++----- host/initramfs/Makefile | 8 ------ host/initramfs/etc/probe | 20 --------------- release/checks/integration/meson.build | 2 +- release/checks/integration/try.c | 29 ---------------------- release/combined/eosimages.nix | 11 +++++---- release/combined/grub.cfg.in | 5 ---- 7 files changed, 32 insertions(+), 74 deletions(-) diff --git a/Documentation/installation/getting-spectrum.adoc b/Documentation/installation/getting-spectrum.adoc index 29803aa324b196119a03b22d7f1e2d7730e2c1eb..e7806e0f92793320bf0cdcbdd11dbc4e713275c7 100644 --- a/Documentation/installation/getting-spectrum.adoc +++ b/Documentation/installation/getting-spectrum.adoc @@ -42,10 +42,30 @@ still take a very long time. == Installing Spectrum To install Spectrum on a computer, you can use a USB drive as a -bootable Spectrum installer device. When booting a system from the -installer device, you will be able to choose whether to try out -Spectrum without installing it on your system (as a live image), or to -install it to your computer's internal storage. +bootable Spectrum installer device. You will need to choose whether to +try out Spectrum without installing it on your system (as a live image), +or to install it to your computer's internal storage. + +=== Building A Live Image + +First, you need to build the Spectrum image: + +[source,shell] +---- +git clone https://spectrum-os.org/git/spectrum +nix-build spectrum/release/live +---- + +If you haven't set up the xref:binary-cache.adoc[binary cache], this +will take a very long time. When it's done, a symbolic link named +"result" will appear in the current directory, pointing to the +installer image. Write that image to a USB drive, for example using +`dd` (command line) or +https://gitlab.com/bztsrc/usbimager[`usbimager`] (graphical, available +in Nixpkgs). Boot your system from the USB drive, and Spectrum should +be ready for you to use. + +=== Building The Installer First, you need to build the Spectrum image: @@ -62,8 +82,7 @@ installer image. Write that image to a USB drive, for example using `dd` (command line) or https://gitlab.com/bztsrc/usbimager[`usbimager`] (graphical, available in Nixpkgs). Boot your system from the USB drive, and you should see -a menu allowing you to choose between "Try Spectrum" and "Install -Spectrum". +a menu allowing you to "Install Spectrum". NOTE: While it's possible to install Spectrum to your internal storage, at this point in Spectrum's development there is not much diff --git a/host/initramfs/Makefile b/host/initramfs/Makefile index 383aa856d0b886325f3505a7596b08dad31a4851..db33ff86e9cd994efd4ce50acdf881d69ba79299 100644 --- a/host/initramfs/Makefile +++ b/host/initramfs/Makefile @@ -43,14 +43,6 @@ build/live.img: ../../scripts/format-uuid.awk ../../scripts/make-gpt.sh ../../sc $(ROOT_FS):root:$$1:Spectrum_'$(VERSION)' mv $@.tmp $@ -build/loop.tar: build/live.img - $(TAR) -cf $@ build/live.img - -build/loop.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/loop.ext4 - bash ../../scripts/make-gpt.sh $@.tmp \ - build/loop.ext4:56a3bbc3-aefa-43d9-a64d-7b3fd59bbc4e - mv $@.tmp $@ - clean: rm -rf build .PHONY: clean diff --git a/host/initramfs/etc/probe b/host/initramfs/etc/probe index 4cbd00db52c1a7128b5c619a43d415675feaee0b..013092b6dcc5b82db7302c1ae7e6d8a4f5a0b802 100755 --- a/host/initramfs/etc/probe +++ b/host/initramfs/etc/probe @@ -2,26 +2,6 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is> -if -n { - # If this is a Spectrum installer eosimages partition, we might be - # booting from the installer, and should loopback mount the images. - importas -i mdev MDEV - if { - backtick -E type { lsblk -lnpo PARTTYPE $mdev } - test $type = 56a3bbc3-aefa-43d9-a64d-7b3fd59bbc4e - } - if { - forx -pE module { ext4 loop } - modprobe $module - } - backtick -E uuid { lsblk -lnpo PARTUUID $mdev } - if { mkdir -p /mnt/${uuid} } - if { mount $mdev /mnt/${uuid} } - find /mnt/${uuid} -name *.img -exec - losetup -Pf {} - ; -} - # Check whether we now have all the partitions we need to boot. importas -i rootfs_uuid ROOTFS_UUID diff --git a/release/checks/integration/meson.build b/release/checks/integration/meson.build index 7214e47ba1ec23c247c8b76e5c8d94aff1ce1fd6..7bf8f51e4c762d2279ed6064ae1a87cb9b07494c 100644 --- a/release/checks/integration/meson.build +++ b/release/checks/integration/meson.build @@ -11,7 +11,7 @@ run_qemu = find_program('../../../scripts/run-qemu.sh') lib = static_library('spectrum-integration-test', 'lib.c') -foreach test : ['appimage', 'late-serial', 'networking', 'portal', 'try'] +foreach test : ['appimage', 'late-serial', 'networking', 'portal'] test(test, executable(test, test + '.c', link_with : lib), timeout : 400, args : [run_qemu]) diff --git a/release/checks/integration/try.c b/release/checks/integration/try.c deleted file mode 100644 index 4b874c0a7e9b48324497450fb5488e04576fd43b..0000000000000000000000000000000000000000 --- a/release/checks/integration/try.c +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: EUPL-1.2+ -// SPDX-FileCopyrightText: 2025 Alyssa Ross <hi@alyssa.is> - -#include "lib.h" - -#include <stdlib.h> -#include <string.h> - -void test(struct config c) -{ - struct vm *vm; - - c.drives.img = getenv_or_die("COMBINED_PATH"); - - vm = start_qemu(c); - - start_console_thread(vm, "GNU GRUB "); - wait_for_prompt(vm); - - start_console_thread(vm, "~ # "); - - // Assume that Try Spectrum is the first menu entry. - if (fputc('\n', vm_console_writer(vm)) == EOF) { - fputs("error writing to console\n", stderr); - exit(EXIT_FAILURE); - } - - wait_for_prompt(vm); -} diff --git a/release/combined/eosimages.nix b/release/combined/eosimages.nix index 0ac4c48374e7098a2b91f61fc07cebb2042ffbdc..9921d9bcc89cc38271f83a970815f1060b3780e0 100644 --- a/release/combined/eosimages.nix +++ b/release/combined/eosimages.nix @@ -12,11 +12,12 @@ runCommand "eosimages.img" { unsafeDiscardReferences = { out = true; }; dontFixup = true; } '' + set -euo pipefail mkdir dir cd dir - ln -s $image $imageName - sha256sum $imageName > $imageName.sha256 - tar -chf $NIX_BUILD_TOP/eosimages.tar * - tar2ext4 -i $NIX_BUILD_TOP/eosimages.tar -o $out - e2label $out eosimages + ln -s -- "$image" "$imageName" + gzip -9 < "$image" > "$imageName.gz" + sha256sum -- "$imageName.gz" > "$imageName.gz.sha256" + tar -ch -- "$imageName.gz" "$imageName.gz.sha256" | tar2ext4 -o "$out" + e2label "$out" eosimages '') (_: {}) diff --git a/release/combined/grub.cfg.in b/release/combined/grub.cfg.in index a8e73a3b4dc0d643cf575e3cc545ec9ff72380cb..a22f5fc96ba6451d44c0f9768a15a1f48c5dce1c 100644 --- a/release/combined/grub.cfg.in +++ b/release/combined/grub.cfg.in @@ -15,11 +15,6 @@ set gfxpayload=keep terminal_output gfxterm terminal_output console -menuentry "Try Spectrum" { - loopback live (hd0,gpt3)/Spectrum-0.0-x86_64-generic.0.Live.img - chainloader (live,gpt1)/EFI/Linux/spectrum.efi -} - menuentry "Install Spectrum" { set root=(hd0,gpt2) linux @linux@ @kernelParams@ -- 2.52.0