]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
20 months agoci: print version of used tools 2144/head
Joerg Behrmann [Sat, 9 Dec 2023 11:26:02 +0000 (12:26 +0100)] 
ci: print version of used tools

20 months agoci: exchange isort and pyflakes for ruff
Joerg Behrmann [Sat, 9 Dec 2023 11:23:41 +0000 (12:23 +0100)] 
ci: exchange isort and pyflakes for ruff

20 months agofix ruff warnings
Joerg Behrmann [Sat, 9 Dec 2023 11:17:32 +0000 (12:17 +0100)] 
fix ruff warnings

20 months agomkosi: include binutils in the packages for building
Josef Bacik [Fri, 8 Dec 2023 22:28:21 +0000 (22:28 +0000)] 
mkosi: include binutils in the packages for building

On aarch64 the dependencies are different than x86 and we don't end up
with binutils getting picked up, which means readelf isn't available for
systemd-ukify when using mkosi-kernel on aarch64.  Explicitly add
bintuils to the list of packages, this allows mkosi-kernel to work
properly on an aarch64 machine.

20 months agomkosi-initrd: Fix typo
Daan De Meyer [Fri, 8 Dec 2023 13:01:16 +0000 (14:01 +0100)] 
mkosi-initrd: Fix typo

Fixes #2138

20 months agoqemu: Become root when copying for Ephemeral=
Daan De Meyer [Thu, 7 Dec 2023 21:49:16 +0000 (22:49 +0100)] 
qemu: Become root when copying for Ephemeral=

To copy the directory, we need to be root (either real or in the
user namespace), so let's do just that.

20 months agoRemove no longer necessary __init__.py from mkosi.resources
Joerg Behrmann [Thu, 7 Dec 2023 19:13:35 +0000 (20:13 +0100)] 
Remove no longer necessary __init__.py from mkosi.resources

20 months agoMove off of the deprecated importlib.resources API
Joerg Behrmann [Thu, 7 Dec 2023 18:09:34 +0000 (19:09 +0100)] 
Move off of the deprecated importlib.resources API

Python 3.9 brought a new importlib.resources API and deprecated the old
one. This introduces a small shim to use the part of the APi that guarantees a
Path object, thus making our usage of this just pathlike.

20 months agoMerge pull request #2131 from DaanDeMeyer/fork
Daan De Meyer [Thu, 7 Dec 2023 18:26:15 +0000 (19:26 +0100)] 
Merge pull request #2131 from DaanDeMeyer/fork

Run image builds in a fork again

20 months agoHandle SIGTERM like a keyboard interrupt 2131/head
Daan De Meyer [Thu, 7 Dec 2023 11:51:13 +0000 (12:51 +0100)] 
Handle SIGTERM like a keyboard interrupt

Let's make sure we do proper cleanup on SIGTERM as well.

20 months agoLog "Interrupted by ..." when we interrupt a child process
Daan De Meyer [Thu, 7 Dec 2023 11:50:23 +0000 (12:50 +0100)] 
Log "Interrupted by ..." when we interrupt a child process

Instead of logging the full command line with exit status, let's
just log "Interrupted" when a child process is interrupted with CTRL+C.

20 months agoImprove exception handling for subprocess.run()
Daan De Meyer [Thu, 7 Dec 2023 11:48:53 +0000 (12:48 +0100)] 
Improve exception handling for subprocess.run()

Instead of having subprocess.run() kill child processes on exceptions
with SIGKILL, let's have it use SIGTERM instead. Because this is not
configurable, we have to override signal.SIGKILL with signal.SIGTERM
before we call subprocess.run().

20 months agoRun image builds in a fork again
Daan De Meyer [Thu, 7 Dec 2023 10:21:30 +0000 (11:21 +0100)] 
Run image builds in a fork again

This solves two problems:
- When not using a tools tree, we can run qemu outside of the user
namespace which means that we don't need to pass fds to /dev/kvm and
/dev/vhost-vsock to keep things working unprivileged
- The vmspawn verb we're about to introduce will not be able to run
properly inside a user namespace, so we need to make sure we're not
inside a user namespace after the image build.

Compared to our original implementation of this way back with exception
propagation, this time we opt to do things differently by doing all
exception handling and logging inside the fork to avoid having to
propagate exceptions. This makes the overall implementation a lot
simpler.

We can also run the other verbs outside of the user namespace as long
as we're not using a tools tree. Because we want to keep support for
using a tools tree with all verbs, we keep support for running them
inside a user namespace as well. Because we already use INVOKING_USER
everywhere, this actually turns out to require very little changes. We
only need to make sure when starting virtiofsd that we unshare the user
namespace ourselves if we're not uid mapping.

20 months agoMerge pull request #2132 from DaanDeMeyer/fix-kmods
Daan De Meyer [Thu, 7 Dec 2023 17:49:45 +0000 (18:49 +0100)] 
Merge pull request #2132 from DaanDeMeyer/fix-kmods

Fix kmods

20 months agoDon't consider include filters when deciding whether to run depmod 2132/head
Daan De Meyer [Thu, 7 Dec 2023 12:33:29 +0000 (13:33 +0100)] 
Don't consider include filters when deciding whether to run depmod

The include filters only do something if there's an exclude filter,
so we don't need to run depmod if only include filters are defined.

20 months agoFix filter_kernel_modules()
Daan De Meyer [Thu, 7 Dec 2023 12:32:53 +0000 (13:32 +0100)] 
Fix filter_kernel_modules()

Make sure we skip the include/exclude logic if no filters are defined.

20 months agoMerge pull request #2128 from DaanDeMeyer/extensions
Daan De Meyer [Thu, 7 Dec 2023 17:15:38 +0000 (18:15 +0100)] 
Merge pull request #2128 from DaanDeMeyer/extensions

Add sysext, confext and portable support

20 months agoAdd sysext, confext and portable support 2128/head
Daan De Meyer [Wed, 6 Dec 2023 14:04:54 +0000 (15:04 +0100)] 
Add sysext, confext and portable support

Wwe also write the extension-release file in case of sysexts and
confexts and make sure we skip a bunch of our automatic features
when building extension  images or enabling the Overlay= option
as in these cases many of our automatic features are undesireable.

20 months agoMake sure networking works on debian
Daan De Meyer [Thu, 7 Dec 2023 14:11:33 +0000 (15:11 +0100)] 
Make sure networking works on debian

Also drop some unused stuff from the preset file.

20 months agomkosi-initrd: Fix md rules
Daan De Meyer [Thu, 7 Dec 2023 12:56:32 +0000 (13:56 +0100)] 
mkosi-initrd: Fix md rules

This somehow ended up being copied wrongly from dracut so let's fix
that.

20 months agoAdd QemuVsockCID= option
Daan De Meyer [Wed, 6 Dec 2023 17:06:16 +0000 (18:06 +0100)] 
Add QemuVsockCID= option

This makes it a bit more streamlined to run multiple VMs with vsock
concurrently.

20 months agomkosi-initrd: Apply cryptsetup creds to all instances of systemd-cryptsetup@.service
Daan De Meyer [Wed, 6 Dec 2023 08:52:59 +0000 (09:52 +0100)] 
mkosi-initrd: Apply cryptsetup creds to all instances of systemd-cryptsetup@.service

This follows the suggestion made in https://github.com/systemd/systemd/pull/30309
to apply "cryptsetup.*" credentials to all instances of
systemd-cryptsetup@.service instead of only to
systemd-cryptsetup@root.service.

20 months agodocs: Mention that all the sysext steps should be done in an empty dir
Daan De Meyer [Wed, 6 Dec 2023 09:58:42 +0000 (10:58 +0100)] 
docs: Mention that all the sysext steps should be done in an empty dir

20 months agodocs: Mention how to provide your own key and certificate
Daan De Meyer [Wed, 6 Dec 2023 09:26:05 +0000 (10:26 +0100)] 
docs: Mention how to provide your own key and certificate

20 months agoExecute user presets alongside system presets
Winterhuman [Wed, 6 Dec 2023 07:01:13 +0000 (07:01 +0000)] 
Execute user presets alongside system presets

Adds `systemctl --root "$ROOT" --global preset-all` to the **Applying presets...** build step.

20 months agoMerge pull request #2124 from behrmann/pyrightfix
Daan De Meyer [Wed, 6 Dec 2023 08:22:47 +0000 (09:22 +0100)] 
Merge pull request #2124 from behrmann/pyrightfix

Fix pyright errors

20 months agoMake DistributionInstaller.architecture a classmethod 2124/head
Joerg Behrmann [Wed, 6 Dec 2023 08:17:05 +0000 (09:17 +0100)] 
Make DistributionInstaller.architecture a classmethod

This was already done in CentOS, but not in the base class.

20 months agoconfig: name parameter for MkosiJsonEncoder.default as in base class
Joerg Behrmann [Wed, 6 Dec 2023 08:16:33 +0000 (09:16 +0100)] 
config: name parameter for MkosiJsonEncoder.default as in base class

20 months agoMerge pull request #2122 from DaanDeMeyer/sysext
Jörg Behrmann [Wed, 6 Dec 2023 08:07:43 +0000 (09:07 +0100)] 
Merge pull request #2122 from DaanDeMeyer/sysext

docs: Add doc on generating system extensions with mkosi

20 months agodocs: Add doc on generating system extensions with mkosi 2122/head
Daan De Meyer [Tue, 5 Dec 2023 14:31:10 +0000 (15:31 +0100)] 
docs: Add doc on generating system extensions with mkosi

20 months agoStrip usr/lib/sysimage/libdnf5 when dnf5 is not installed
Daan De Meyer [Tue, 5 Dec 2023 14:30:45 +0000 (15:30 +0100)] 
Strip usr/lib/sysimage/libdnf5 when dnf5 is not installed

20 months agoMerge pull request #2120 from DaanDeMeyer/initrd
Zbigniew Jędrzejewski-Szmek [Tue, 5 Dec 2023 13:23:50 +0000 (14:23 +0100)] 
Merge pull request #2120 from DaanDeMeyer/initrd

mkosi-initrd: various improvements

20 months agomkosi-initrd: Port tests from old repository 2120/head
Daan De Meyer [Mon, 4 Dec 2023 07:12:51 +0000 (08:12 +0100)] 
mkosi-initrd: Port tests from old repository

This commit ports some of the tests from
https://github.com/systemd/mkosi-initrd/blob/main/.github/workflows/build-fedora.sh
over.

The LUKS test is modified to generate the LUKS root partition using
repart instead of doing it manually. For the LVM tests we're forced
to do it manually as systemd-repart doesn't support setting up LVM
(and probably never will).

We also add an initrd size test so we notice when initrds grow due
to distribution packaging changes.

20 months agoFix nspawn settings
Daan De Meyer [Tue, 5 Dec 2023 09:28:31 +0000 (10:28 +0100)] 
Fix nspawn settings

When --machine= is used, nspawn looks for a settings file named after
the machine so we have to make sure to copy to the right location.

While we're at it, let's also stop considering the nspawn settings
an output artifact, since this means we have to build the image to
apply new settings. Instead, let's copy the settings when running
the image and remove the copied file again afterwards. This means
that new settings are applied immediately instead of only after a
rebuild.

20 months agoTemporarily default to debian unstable for builtin image
Daan De Meyer [Mon, 4 Dec 2023 12:14:43 +0000 (13:14 +0100)] 
Temporarily default to debian unstable for builtin image

Booting off virtiofs only works properly from systemd v255 onwards
when virtiofs and virtio_pci are not builtin to the kernel so let's
default to unstable for now which has systemd v255.

20 months agomkosi-initrd: Ship preset to disable services by default
Daan De Meyer [Mon, 4 Dec 2023 09:58:02 +0000 (10:58 +0100)] 
mkosi-initrd: Ship preset to disable services by default

Debian doesn't ship any presets so all services are enabled by default.
Let's ship our own to disable everything by default instead.

20 months agomkosi-initrd: Enable cryptsetup.* credentials for systemd-gpt-auto-generator
Daan De Meyer [Mon, 4 Dec 2023 07:10:29 +0000 (08:10 +0100)] 
mkosi-initrd: Enable cryptsetup.* credentials for systemd-gpt-auto-generator

systemd-cryptsetup will read credentials in the "cryptsetup" namespace but
none of the generated service units import credentials from that namespace
yet. Let's add a dropin to have systemd-cryptsetup@root.service (generated
by systemd-gpt-auto-generator) load these credentials by default so that we
can use them in integration tests.

Upstream PR in systemd related to this: https://github.com/systemd/systemd/pull/30309

20 months agoSuspend stdin capture if --capture=no is specified
Daan De Meyer [Mon, 4 Dec 2023 05:52:54 +0000 (06:52 +0100)] 
Suspend stdin capture if --capture=no is specified

20 months agoPassthrough stdin/stdout in Image
Daan De Meyer [Mon, 4 Dec 2023 05:38:58 +0000 (06:38 +0100)] 
Passthrough stdin/stdout in Image

20 months agoInstall less in default images initrds
Daan De Meyer [Mon, 4 Dec 2023 05:38:31 +0000 (06:38 +0100)] 
Install less in default images initrds

20 months agoDon't pass --debug when running mkosi clean
Daan De Meyer [Sun, 3 Dec 2023 13:25:23 +0000 (14:25 +0100)] 
Don't pass --debug when running mkosi clean

20 months agoqemu: Don't synthesize root= if it's provided on the kernel command line
Daan De Meyer [Sun, 3 Dec 2023 13:24:48 +0000 (14:24 +0100)] 
qemu: Don't synthesize root= if it's provided on the kernel command line

20 months agoqemu: Use full output path everywhere
Daan De Meyer [Sun, 3 Dec 2023 13:23:58 +0000 (14:23 +0100)] 
qemu: Use full output path everywhere

Let's make sure we use whatever the configured output format is instead
of going via the symlink we create in the output directory.

20 months agotree: Pass in use_subvolumes feature instead of MkosiConfig object
Daan De Meyer [Sun, 3 Dec 2023 12:21:35 +0000 (13:21 +0100)] 
tree: Pass in use_subvolumes feature instead of MkosiConfig object

This makes the tree functions a little more generic.

20 months agomkosi-initrd: Move tests to pytest
Daan De Meyer [Sun, 3 Dec 2023 10:59:34 +0000 (11:59 +0100)] 
mkosi-initrd: Move tests to pytest

While we're at it, also build our default images with a mkosi-initrd
produced initrd to verify that it boots.

20 months agomkosi-initrd: Add opensuse support
Daan De Meyer [Sun, 3 Dec 2023 11:19:25 +0000 (12:19 +0100)] 
mkosi-initrd: Add opensuse support

20 months agomkosi-initrd: Default to cleaning package manager metadata
Daan De Meyer [Sun, 3 Dec 2023 11:17:33 +0000 (12:17 +0100)] 
mkosi-initrd: Default to cleaning package manager metadata

Various package managers are pulled in as dependencies of core
system software (dpkg by dash on Debian, rpm by kmod via
suse-module-tools on opensuse) so let's default to always cleaning
package manager metadata even if the package manager is installed.

We still allow disabling it as having the package manager metadata
available is useful when debugging dependencies and why specific
packages are installed in the initrd.

20 months agomkosi-initrd: Apply centos specific config to RHEL as well
Daan De Meyer [Sun, 3 Dec 2023 11:00:49 +0000 (12:00 +0100)] 
mkosi-initrd: Apply centos specific config to RHEL as well

20 months agoIntroduce name() method for MkosiConfig
Daan De Meyer [Sun, 3 Dec 2023 10:57:40 +0000 (11:57 +0100)] 
Introduce name() method for MkosiConfig

20 months agomkosi-initrd: Bring Arch and Debian up-to-date with Fedora
Daan De Meyer [Sun, 3 Dec 2023 10:36:31 +0000 (11:36 +0100)] 
mkosi-initrd: Bring Arch and Debian up-to-date with Fedora

20 months agomkosi-initrd: Exclude more files on Arch
Daan De Meyer [Sun, 3 Dec 2023 10:35:50 +0000 (11:35 +0100)] 
mkosi-initrd: Exclude more files on Arch

Let's exclude a bunch of unnecessary stuff on Arch.

20 months agoImplement WithDocs= for apt
Daan De Meyer [Sun, 3 Dec 2023 10:04:38 +0000 (11:04 +0100)] 
Implement WithDocs= for apt

20 months agomkosi-initrd: Strip all files starting with vmlinuz
Daan De Meyer [Sun, 3 Dec 2023 08:20:19 +0000 (09:20 +0100)] 
mkosi-initrd: Strip all files starting with vmlinuz

Fedora has started shipping vmlinuz-virt.efi in the kernel modules
directory so we have to make sure we strip that from the initrd as
well.

20 months agomkosi-initrd: Strip documentation from the initrd
Daan De Meyer [Sun, 3 Dec 2023 08:19:58 +0000 (09:19 +0100)] 
mkosi-initrd: Strip documentation from the initrd

20 months agomkosi-initrd: Configure locale to C.UTF-8
Daan De Meyer [Sun, 3 Dec 2023 08:18:54 +0000 (09:18 +0100)] 
mkosi-initrd: Configure locale to C.UTF-8

This will make sure all other locale data is strippped out on rpm
based distributions.

20 months agomkosi-initrd: Remove System.map
Daan De Meyer [Sun, 3 Dec 2023 08:17:09 +0000 (09:17 +0100)] 
mkosi-initrd: Remove System.map

System.map is primarily intended for debugging kernel oopses so let's
not include it in generated initrds which saves 8.4M.

20 months agoinitrd: again drop shadow-utils from initrd
Zbigniew Jędrzejewski-Szmek [Wed, 8 Nov 2023 17:16:22 +0000 (18:16 +0100)] 
initrd: again drop shadow-utils from initrd

We save 4MB, and also 300kB for libsemanage.

20 months agomkosi-initrd: Allow setting output format from CLI
Daan De Meyer [Sun, 3 Dec 2023 08:13:32 +0000 (09:13 +0100)] 
mkosi-initrd: Allow setting output format from CLI

It's useful to build the initrd as a directory for debugging.

20 months agoConfigure rpm _install_langs if locale is configured
Daan De Meyer [Sat, 2 Dec 2023 09:04:55 +0000 (10:04 +0100)] 
Configure rpm _install_langs if locale is configured

If the _install_langs macro is defined, rpm will only install locale
data corresponding to the locales in _install_langs. If Locale= is
set and macros.lang doesn't exist already, let's configure it ourselves
with _install_langs to save on disk space.

20 months agoAllow configuring rpm in package manager trees
Daan De Meyer [Sat, 2 Dec 2023 08:34:05 +0000 (09:34 +0100)] 
Allow configuring rpm in package manager trees

Up until now, we've been unconditionally using the rpm configuration
from the host system. Unfortunately we can't entirely get rid of this
as rpm doesn't operate with an empty configuration and the configuration
is tightly coupled to the rpm version.

However, let's at least make sure we don't use any rpm configuration from
/etc and let's allow users to add extra rpm configuration themselves using
package manager trees.

By using $RPM_CONFIGDIR, we can configure where rpm looks for its main
configuration. We allow users to configure various rpm configuration in their
package manager trees and then copy over any missing files from the host
afterwards.

Because the /etc config directories are hardcoded in rpm, we have to resort
to mounting an empty directory on top of /etc/rpm if it exists.

20 months agoSpecify --no-dereference in copy_tree()
Daan De Meyer [Sat, 2 Dec 2023 08:32:38 +0000 (09:32 +0100)] 
Specify --no-dereference in copy_tree()

We try to follow cp -a semantics, which includes --no-dereference,
so let's make sure we specify it explicitly.

20 months agoAdd clobber argument for copy_tree()
Daan De Meyer [Sat, 2 Dec 2023 08:31:21 +0000 (09:31 +0100)] 
Add clobber argument for copy_tree()

Let's allow specifying that copy_tree() should not overwrite
existing files. Because of a messy backwards incompatible change
in coreutils v9.2, we're forced to use a different option depending
on the cp version.

20 months agoDon't complain about compression for non-compressible output formats
Daan De Meyer [Sat, 2 Dec 2023 08:24:22 +0000 (09:24 +0100)] 
Don't complain about compression for non-compressible output formats

20 months agomkosi-initrd: Only include core + host's loaded modules and firmware
Daan De Meyer [Fri, 1 Dec 2023 15:24:04 +0000 (16:24 +0100)] 
mkosi-initrd: Only include core + host's loaded modules and firmware

The initramfs produced by mkosi-initrd's kernel-install plugin is only
intended to be used on the host system that's building it. Let's take
advantage of that and only include the currently loaded modules and
firmware in the initramfs to cut down the size.

For safety reasons we always include some core modules regardless of
whether they're loaded on the host or not.

20 months agoAdd KernelModulesIncludeHost= and KernelModulesInitrdIncludeHost=
Daan De Meyer [Fri, 1 Dec 2023 15:18:25 +0000 (16:18 +0100)] 
Add KernelModulesIncludeHost= and KernelModulesInitrdIncludeHost=

These look at /proc/modules and add all modules in there to the list
of modules to keep. Useful when building images intended to be used on
the host system only.

This commit also optimizes filter_kernel_modules() which was previously
O(n)^2.

20 months agomkosi-initrd: Include firmware from host as well
Daan De Meyer [Fri, 1 Dec 2023 14:14:26 +0000 (15:14 +0100)] 
mkosi-initrd: Include firmware from host as well

Some modules don't work without the corresponding firmware, so make
sure we copy in the corresponding firmware from the host as well.

20 months agoMerge pull request #2118 from DaanDeMeyer/tests
Daan De Meyer [Fri, 1 Dec 2023 14:32:11 +0000 (15:32 +0100)] 
Merge pull request #2118 from DaanDeMeyer/tests

ci: Fix environment passthrough

20 months agoci: Bump timeout to 1h 2118/head
Daan De Meyer [Fri, 1 Dec 2023 13:31:57 +0000 (14:31 +0100)] 
ci: Bump timeout to 1h

We now run tests for all formats within the same job which needs
more time to complete so let's bump the timeout t 1h.

20 months agotest: Test directory image boot in qemu if virtiofsd is available
Daan De Meyer [Fri, 1 Dec 2023 13:29:50 +0000 (14:29 +0100)] 
test: Test directory image boot in qemu if virtiofsd is available

20 months agotests: Fix Distribution creation
Daan De Meyer [Fri, 1 Dec 2023 13:12:19 +0000 (14:12 +0100)] 
tests: Fix Distribution creation

20 months agoci: Fix environment passthrough
Daan De Meyer [Fri, 1 Dec 2023 10:22:21 +0000 (11:22 +0100)] 
ci: Fix environment passthrough

When using sudo we need to make sure to pass through environment
variables.

Also run summary() as part of the boot tests to help with debugging.

20 months agoMerge pull request #2117 from DaanDeMeyer/tests
Jörg Behrmann [Fri, 1 Dec 2023 12:56:30 +0000 (13:56 +0100)] 
Merge pull request #2117 from DaanDeMeyer/tests

Move integration tests into python

20 months agoMove integration tests into python 2117/head
Daan De Meyer [Fri, 1 Dec 2023 10:22:21 +0000 (11:22 +0100)] 
Move integration tests into python

Instead of vendor locking ourselves to Github Actions, let's move
the integration tests into python so we can run them locally and
on other CI systems.

We opt to use unittest style test cases so that we can have a
configurable base class that can be used for various integration
tests. Unfortunately, I haven't found a nice and type safe way to
make pytest fixtures configurable so we opt for unittest instead.

Note that while we use the subTest() feature of unittest, pytest
still considers test_boot() a single test because it doesn't support
this particular feature of unittest. Ideally we switch our test runner
to something else in the future which does support the subTest() feature.

We always run steps that can run unprivileged without privileges even
if we're running as root so that tests can be run locally with root
privileges without ending up with a bunch of files owned by root
afterwards.

20 months agoImplement RemovePackages= for Arch
Daan De Meyer [Fri, 1 Dec 2023 09:30:42 +0000 (10:30 +0100)] 
Implement RemovePackages= for Arch

20 months agoUse mkosi.local.conf for local configuration
Daan De Meyer [Thu, 30 Nov 2023 19:59:15 +0000 (20:59 +0100)] 
Use mkosi.local.conf for local configuration

Let's move our common configuration to mkosi.conf now that we have
mkosi.local.conf for local configuration.

20 months agoFix licensing
Daan De Meyer [Thu, 30 Nov 2023 11:11:36 +0000 (12:11 +0100)] 
Fix licensing

Add GPL2 license to the repository and fix the SPDX license identifiers
for the dracut files to GPL-2.0-only.

20 months agodocs: format paths as monospace
Joerg Behrmann [Thu, 30 Nov 2023 08:36:19 +0000 (09:36 +0100)] 
docs: format paths as monospace

20 months agoFix ImageId= docs
Daan De Meyer [Wed, 29 Nov 2023 20:39:42 +0000 (21:39 +0100)] 
Fix ImageId= docs

- We don't patch it into partition labels anymore
- We already patch os-release ourselves so let's not use it as an
  example of what to do with $IMAGE_ID for users.

20 months agomkosi-initrd: Copy md and dm udev rules from dracut
Daan De Meyer [Wed, 29 Nov 2023 07:55:06 +0000 (08:55 +0100)] 
mkosi-initrd: Copy md and dm udev rules from dracut

Until these are upstreamed into their corresponding projects, let's
carry the rules in mkosi-initrd.

20 months agoRevert "ci: enable jammy-proposed-updates to get new libsolv"
Luca Boccassi [Wed, 29 Nov 2023 16:05:39 +0000 (16:05 +0000)] 
Revert "ci: enable jammy-proposed-updates to get new libsolv"

libsolv has migrated to jammy-updates, so we can disable the
proposed-updates repository again.

This reverts commit 698834c7794f0100eba8ff17125cffc8f6ac8a63.

20 months agoStop using workspace cache subdirectory
Daan De Meyer [Wed, 29 Nov 2023 11:53:05 +0000 (12:53 +0100)] 
Stop using workspace cache subdirectory

We don't do this for configured cache directories anymore, so don't
do it for workspace cache directories anymore either.

20 months agoMerge pull request #2084 from behrmann/reprouid
Daan De Meyer [Wed, 29 Nov 2023 10:37:55 +0000 (11:37 +0100)] 
Merge pull request #2084 from behrmann/reprouid

util: add a fallback username and home for INVOKING_USER

20 months agomounts: use INVOKING_USER in mount_passwd instead of hardcoding /home 2084/head
Joerg Behrmann [Wed, 29 Nov 2023 10:20:08 +0000 (11:20 +0100)] 
mounts: use INVOKING_USER in mount_passwd instead of hardcoding /home

20 months agoutil: make name and home of INVOKING_USER methods that cache their results
Joerg Behrmann [Tue, 21 Nov 2023 09:47:41 +0000 (10:47 +0100)] 
util: make name and home of INVOKING_USER methods that cache their results

At test time, e.g. during reproducible builds, usernames are not guaranteed to
be resolvable, because NSS is deliberately broken. Hence, only try to resolve
either only if needed and cache the result, so it stays the same across
invocations.

This unfortunately can no longer be achieved by combining @classmethod with
@property, since the combination, which had only been allowed since Python 3.9,
was deprecated again in Python 3.11.

Fixes: #2081
20 months agoSpeed up empty_directory()
Daan De Meyer [Tue, 28 Nov 2023 16:36:27 +0000 (17:36 +0100)] 
Speed up empty_directory()

Let's invoke rm once instead of N times.

20 months agoSet atime and mtime of scripts to zero
Daan De Meyer [Tue, 28 Nov 2023 16:35:03 +0000 (17:35 +0100)] 
Set atime and mtime of scripts to zero

Otherwise, stuff like meson reconfigure will rerun every time because
we write the script again every time we run the build script.

20 months agoAdd useradd script
Daan De Meyer [Tue, 28 Nov 2023 11:39:59 +0000 (12:39 +0100)] 
Add useradd script

Let's automatically invoke useradd with --root when executed outside
of the image chroot.

Fixes #2089

20 months agoFix --genkey-valid-days and --genkey-common-name
Daan De Meyer [Tue, 28 Nov 2023 11:44:46 +0000 (12:44 +0100)] 
Fix --genkey-valid-days and --genkey-common-name

Fixes #2077

20 months agoUse zst as zstd file extension
Daan De Meyer [Tue, 28 Nov 2023 16:04:14 +0000 (17:04 +0100)] 
Use zst as zstd file extension

20 months agoFix user provided kernel not being used
Daan De Meyer [Tue, 28 Nov 2023 13:33:11 +0000 (14:33 +0100)] 
Fix user provided kernel not being used

20 months agoUse the main tool name in error when tool is not found
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2023 11:10:11 +0000 (12:10 +0100)] 
Use the main tool name in error when tool is not found

We would say that we cannnot find /usr/lib/systemd/ukify, which
is somewhat confusing, since we're looking for ukify in $PATH
first, and only for /usr/lib/systemd/ukify as a fallback.

This also avoids a second which call on the results of a which call.

20 months agoAdd microcode support
Daan De Meyer [Tue, 28 Nov 2023 10:39:04 +0000 (11:39 +0100)] 
Add microcode support

Let's make sure we add early CPIO initrds containing microcode when
building bootable images. To make early loading of microcode work, an
uncompressed initrd has to be prepended to the list of initrds containing
the microcode at a canonical location.

20 months agoRun depmod even if Bootable=no
Daan De Meyer [Tue, 28 Nov 2023 09:17:51 +0000 (10:17 +0100)] 
Run depmod even if Bootable=no

Bootable=no disables the kernel modules logic but users might still want
to generate a bootable image so let's run the depmod logic unconditionally.

20 months agoDo not trigger bwrap's max arg limit when running modinfo
Daan De Meyer [Tue, 28 Nov 2023 09:38:01 +0000 (10:38 +0100)] 
Do not trigger bwrap's max arg limit when running modinfo

We might potentially pass a lot of modules at once to modinfo which
could trigger bwrap's max argument limit so make sure to chunk things
up to avoid hitting the limit.

20 months agoautologin: use a helper method to reduce boilerplate
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2023 11:12:25 +0000 (12:12 +0100)] 
autologin: use a helper method to reduce boilerplate

I kept the generated option strings exactly the same. In some cases we
put the baud before the device name or placeholder, and in other cases in
the opposite order, but maybe there's some reason for this.

The unit file is changed to use just 'aggety' instead of the full path,
and the leading whitespace is dropped. Both things should have no effect,
but make the resulting file nicer to read.

20 months agoAdd ability to create passwordless root account (#2093)
Nils K [Mon, 27 Nov 2023 22:14:28 +0000 (23:14 +0100)] 
Add ability to create passwordless root account (#2093)

To create a passwordless root account one may specify `hashed:` without passing
an actual hash.

20 months agoMerge pull request #2073 from behrmann/ttyama0
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2023 10:39:13 +0000 (11:39 +0100)] 
Merge pull request #2073 from behrmann/ttyama0

Ttyama0

20 months agokmod: normalise module names
Joerg Behrmann [Sun, 26 Nov 2023 13:14:32 +0000 (14:14 +0100)] 
kmod: normalise module names

The file names of modules use dashes, e.g.

    /usr/lib/modules/6.6.2-arch1-1/kernel/drivers/nvme/common/nvme-common.ko.zst

but the dependency names modinfo gives us use underscores, e.g.

    name=nvme_common

Fixes: #2092
20 months agoAdd Building RHEL and RHEL UBI images with mkosi to README
Joerg Behrmann [Sat, 25 Nov 2023 10:52:08 +0000 (11:52 +0100)] 
Add Building RHEL and RHEL UBI images with mkosi to README

20 months agoFixed capitalization of `SignExpectedPcr`
Michael Ferrari [Wed, 22 Nov 2023 12:47:12 +0000 (13:47 +0100)] 
Fixed capitalization of `SignExpectedPcr`

Fixes: #2086