DaanDeMeyer [Mon, 11 Aug 2025 13:26:50 +0000 (15:26 +0200)]
mkosi-tools: Drop systemd-boot-efi package
There's no need to install systemd-boot, systemd-stub, ... in the
tools tree as these are picked up from inside the image so let's stop
installing systemd-boot-efi in the tools tree.
Luca Boccassi [Sat, 9 Aug 2025 14:05:48 +0000 (15:05 +0100)]
mkosi-tools: move systemd-boot package to conf file matching older releases
Since debian 13/ubuntu 25.04 the tools needed at build time
(bootctl) are in the systemd-boot-tools package, so there's
no need to pull in the systemd-boot package in the tools image,
since it is an integration point that sets up the local ESP and
so on
Alberto Planas [Wed, 6 Aug 2025 10:58:55 +0000 (12:58 +0200)]
Drop microsecond resolution for datetime.now()
The RPM INSTALLTIME attribute is an integer represetantion of the
installation time of the package, and datetime.now is a date
representation of a float timestamp. This can produce some rounding
errors is powerful build servers.
For example, if the variable `_init_timestamp` has a value XXXXX.1 but
in the same sub-second the package gets installed, the registered
installation time will be the integer representation (XXXXX), making the
comparison done for exclusion of the package to be `True`.
This patch will remove the microsecond granularity of the datetime,
converting the timestamp on its integer representation, instead of the
default float one. The comparison is still done in the datetime data
type.
mkosi-initrd/vm: ensure TPM2 core modules are installed in the initrd
On arm64 the tpm_tis modules are not built-in, so /dev/tpmrm0 does
not show up in the initrd and it times out, and unlocking using
the tpm doesn't work.
Ensure the modules are included in the initrd if they are not
built in.
FirmwareVariables: allow generating during image build
The build immediately fails if FirmwareVariables=%O/somefile is used, as
the config parser won't be able to find it, so it is not possible to
generate it during the image build itself (e.g: mkosi.postoutput)
in order to add generated keys to MOK. Set required=False.
Deniz Adrian [Wed, 23 Jul 2025 20:04:53 +0000 (22:04 +0200)]
ensure builds with cache over device boundaries
when running mkosi with the default cache dir/XDG_CACHE_HOME on a
different device than the mkosi working directory, mkosi falls back to
trying to copy the cache using `copy_tree` from tree.py.
the cache contains symlinks which are pointing to files on the host:
e.g. `mkosi.cache/debian...cache/usr/bin/mt -> /etc/alternatives/mt`
`os.listxattr()` defaults to `follow_symlinks=True`, which leads to
`FileNotFoundError`s if the files don't exist on the host, which stops
the build.
this patch ignores symlinks, but feels like a workaround, as our
assumption would be that such absolute links should not be traversed
outside the chroot in the first place.
Change UnifiedKernelImages to enum and accept signed/unsigned
With custom firmware we enroll our keys in db, so local UKIs can be
built and there's no need to fail the build. Many distributions
ship signed bootloaders, but they still don't ship UKIs.
Add an enum and a parser (to keep backward compat), and if set to
unsigned build locally instead of failing when the bootloader is
signed.
hpet is an emulated clocksource that is generally discouraged in favor
of kvm-clock or tsc for virtual machines. While mkosi's virtual machines
already use kvm-clock, leaving hpet enabled causes qemu on the host to
consume a non-trivial amount of cpu, so let's disable the hpet feature since
we're not making use of it anyway.
EDK2 nowadays does provide secureboot for arm. Not only that, TPM2 support is
only enabled in builds that enable secure boot, probably because it's all
part of the TCG modules.
Default to uefi_secure_boot on arm too, like x86.
Also do not pass qemu x86-only configuration options that break booting
arm.
nfs-utils-2.8.4 will provide its own nfsroot-generator [1] to allow mounting the
real rootfs via NFSv4, so this initrd profile will enable this feature.
mkosi-tools: make sure p11-kit dir exists when configuring module
Fixes this failure, since I guess the dir may not exist:
‣ Running prepare script /tmp/tmphh1uwz2a/resources/mkosi-tools/mkosi.prepare…
/work/prepare: line 4: /buildroot/usr/share/p11-kit/modules/opensc.module: No such file or directory
Do not try to install packages that are listed in RemovePackages=
This allows using RemovePackages= in mkosi.local.conf to prevent
certain packages listed in the regular configuration from being
installed in the first place.
We also add RemovePackages= to the cache manifest because it now
affects the cached images.
opensuse: pull in grep/gzip/xz explicitly to avoid busybox in main image
Problem: 1: the installed busybox-xz-1.37.0-34.1.noarch conflicts with 'xz' provided by the to be installed xz-5.8.1-1.1.aarch64
Solution 1: deinstallation of busybox-xz-1.37.0-34.1.noarch
Solution 2: do not install xz-5.8.1-1.1.aarch64
It's both shorter, and doesn't give the wrong impression that this
is about security sandboxing, so let's rename the sandbox name to
just box. Keep the old name as well of course for compat.
Currently, if /work does not exist, we go into the exception handler which
doesn't do anything if the errno is ENOENT, even though we still need to
remove the parent directory.
If we're running inside mkosi sandbox, we don't parse the default
tools tree configuration, which this test depends on, so skip it
when running in the sandbox.
DaanDeMeyer [Mon, 30 Jun 2025 21:38:01 +0000 (23:38 +0200)]
mkosi-tools: Make sure opensc module is registered with p11-kit
Otherwise openssl will fail to load keys off a yubikey when using
pkcs11-provider. For more discussion and why this isn't the default
everywhere, see https://gitlab.archlinux.org/archlinux/packaging/packages/opensc/-/issues/2.
Daan De Meyer [Wed, 25 Jun 2025 10:47:56 +0000 (12:47 +0200)]
sandbox: Work around extra file descriptor opened by importing ctypes since python 3.14
Since python 3.14, importing ctypes opens an extra file descriptor which is used to allocate libffi
closures which are in turn used by ctypes to pass python functions as C callback function pointers. We
don't use this functionality, yet the file descriptor is still opened and messes with the file descriptor
packing logic since the file descriptor to libffi will be passed as a packed file descriptor to the
executable we're invoking. To avoid that from happening, we close libffi's file descriptor after importing
ctypes.
See https://github.com/python/cpython/issues/135893.
Luca Boccassi [Sat, 21 Jun 2025 16:54:48 +0000 (17:54 +0100)]
mkosi-obs: support splitting out and compressing partitions
Need to recompress the verity-sig partition after creating it,
and deleting the non-compressed split out partitions that are
already present as compressed but that sd-repart re-creates
when doing the signature attach operation.
Luca Boccassi [Sat, 21 Jun 2025 16:53:39 +0000 (17:53 +0100)]
compress: do not attempt to compress skipped partitions
When doing offline verity signing, split partitions and compression are
enabled, we attempt to compress a non-existing partition (verity-sig)
which will be created only later.
Do not attempt to compress partitions that are marked to be skipped by
repart.
Daan De Meyer [Fri, 20 Jun 2025 08:46:12 +0000 (10:46 +0200)]
Ensure directories exist before running sync scripts
run_sync_scripts() assumes the workspace directory exists but we only
create it later on at the moment. Let's create directories before running
sync scripts to fix this issue.
Daan De Meyer [Thu, 29 May 2025 14:20:54 +0000 (16:20 +0200)]
Bind mount /etc from tools tree into relaxed sandbox
Config from /etc often references stuff in /usr. Two examples I've
encountered are shell config from /etc/profile and dnf5 blowing up
when there's plugin configuration in /etc without the corresponding
plugin being installed.
To work around such issues, let's use /etc from the tools tree in the
relaxed sandbox instead of /etc from the host. This also saves the user
from having to create directories in their host's /etc to be able to use
mkosi sandbox.
systemd-boot-efi is only available for EFI architectures, but
we use mkosi to do the integration tests on all architectures,
so this commit breaks them:
5044s E: Package 'systemd-boot-efi' has no installation candidate
Xavier Moffett [Fri, 30 May 2025 00:34:06 +0000 (20:34 -0400)]
fix: Remove `erofs-utils` from initrd
No longer necessary, since fsck is no longer invoked by systemd for
read-only filesystems. This fixes a bug causing the initrd stage
of Ubuntu images to fail.
Daan De Meyer [Wed, 4 Jun 2025 14:04:33 +0000 (16:04 +0200)]
ci: Drop differential shellcheck
We already run shellcheck on all scripts as part of the main CI job,
so we don't really get any benefit of a differential shellcheck as all
our code is already checked by shellcheck so let's just drop it.
Jörg Behrmann [Wed, 4 Jun 2025 09:04:26 +0000 (11:04 +0200)]
resources: add systemd-boot-efi
Since
https://salsa.debian.org/systemd-team/systemd/-/commit/a4bdf87f03e06fe687f0bf7596af31d0f2ac80b1
systemd-boot is not pulled in automatically by systemd-boot anymore
Daan De Meyer [Thu, 29 May 2025 08:36:29 +0000 (10:36 +0200)]
mkosi-tools: Introduce debug profile and move perf to it
perf pulls in a ton of dependencies (> 100 extra packages on Fedora).
Let's introduce a separate debug profile and move perf to it to avoid
everyone having to pull in all these packages for a tool they most likely
won't use.
Daan De Meyer [Thu, 29 May 2025 18:01:16 +0000 (20:01 +0200)]
ci: Use ext4 temporarily
The commit causing https://lore.kernel.org/linux-fsdevel/20250115185608.GA2223535@zen.localdomain/T/#u
got backported to the ubuntu stable kernel. While it has been reverted
upstream, the revert still hasn't reached the ubuntu stable kernel,
so let's use ext4 temporarily until that's the case.