[PATCH v5 07/13] release: Compress installation images and remove live image

Demi Marie Obenour
2025-11-26T19:42:19Z

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.is/

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
Changes since v4:
- Replace a mention of "Try Spectrum" with a mention of the live image.
- Combine instructions for building an installer and a live image.
- Drop the config option for the compression level.
- Drop unnecessary quoting changes.
- Drop unnecessary 'set -euo pipefail'.

Changes since v3:
- Make the compression level configurable. The default is 1 so that
development builds finish in a reasonable amount of time. Release
builds should use compression level 9.

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 | 44 ++++++++++++++++--------
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 | 8 ++---
release/combined/grub.cfg.in | 5 ---
7 files changed, 35 insertions(+), 81 deletions(-)

diff --git a/Documentation/installation/getting-spectrum.adoc b/Documentation/installation/getting-spectrum.adoc
index 29803aa324b196119a03b22d7f1e2d7730e2c1eb..22c1fe310b56adecaac5ed7e87decbfd56881919 100644
--- a/Documentation/installation/getting-spectrum.adoc
+++ b/Documentation/installation/getting-spectrum.adoc
@@ -23,6 +23,17 @@ documentation for
https://nix.dev/manual/nix/2.24/advanced-topics/cores-vs-jobs.html[tuning
cores and jobs].

+To get Spectrum, run
+
+[source,shell]
+----
+git clone https://spectrum-os.org/git/spectrum
+----
+
+Then follow one of the instructions below. If you haven't set up the
+xref:binary-cache.adoc[binary cache], all of the following Nix commands
+will take a very long time.
+
== Trying Spectrum

If you want to try Spectrum out to get a feel for it, without
@@ -31,27 +42,30 @@ applications.

[source,shell]
----
-git clone https://spectrum-os.org/git/spectrum
cd spectrum/host/rootfs
nix-shell --run 'make run'
----

-This builds just enough of Spectrum to try it out in a VM, but it will
-still take a very long time.
+This builds just enough of Spectrum to try it out in a VM.

== 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.

-First, you need to build the Spectrum image:
+To build a live image, run:
+
+[source,shell]
+----
+nix-build spectrum/release/live
+----
+
+To build an installer, run:

[source,shell]
----
-git clone https://spectrum-os.org/git/spectrum
nix-build spectrum/release/combined
----

@@ -61,15 +75,17 @@ will take a very long time. When it's done, a symbolic link named
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".
+in Nixpkgs). Then boot your system from the USB drive
+
+If you built a live image, Spectrum should be ready for you to use.
+If you built an installer, you should see 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
reason to, as OS updates are not yet implemented, and persistent
-storage is not yet exposed to VMs. Using the "Try Spectrum" option to
-boot Spectrum will let you try out everything in Spectrum, without
+storage is not yet exposed to VMs. Using a live image to boot
+Spectrum will let you try out everything in Spectrum, without
having to go through the additional step of reinstalling Spectrum
every time you want to use a newer version.

diff --git a/host/initramfs/Makefile b/host/initramfs/Makefile
index 392dcfc8af3d6924fae717025124f228a2362b94..c3d600ad5a55d81b8ca9c7a3e182ef5f4fd90f4b 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_IMAGE):root:$$1
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..38210922ec165a36c33d99d08f04beabdc01ed53 100644
--- a/release/combined/eosimages.nix
+++ b/release/combined/eosimages.nix
@@ -14,9 +14,9 @@ runCommand "eosimages.img" {
} ''
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
+ 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