]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
2 years agoUse dnf when building foreign architectures 1592/head
Daan De Meyer [Tue, 30 May 2023 10:15:42 +0000 (12:15 +0200)] 
Use dnf when building foreign architectures

dnf5 does not support --forcearch yet which means it can't build
foreign architectures.

2 years agoRework architecture handling
Daan De Meyer [Mon, 29 May 2023 20:41:31 +0000 (22:41 +0200)] 
Rework architecture handling

Let's lock architectures down by making it an enum instead of a
free form string. We also introduce a bunch of mapping functions
to map the Architecture enum to qemu, distribution arches, efi
arches. We only support the architectures defined in the discoverable
partitions spec and use those architectures as the default representation.

2 years agoMerge pull request #1591 from DaanDeMeyer/exception-handling
Daan De Meyer [Sat, 27 May 2023 09:11:10 +0000 (11:11 +0200)] 
Merge pull request #1591 from DaanDeMeyer/exception-handling

Make sure we handle any exceptions thrown in MkosiAsyncioThread()

2 years agoci: Make sure we're running qemu with a vsock 1591/head
Daan De Meyer [Sat, 27 May 2023 09:01:14 +0000 (11:01 +0200)] 
ci: Make sure we're running qemu with a vsock

Let's add a little extra coverage by enforcing that qemu runs with
a vsock.

2 years agoMake sure we handle any exceptions thrown in MkosiAsyncioThread()
Daan De Meyer [Sat, 27 May 2023 08:54:20 +0000 (10:54 +0200)] 
Make sure we handle any exceptions thrown in MkosiAsyncioThread()

Any unhandled exceptions from run() are by default just printed to
stderr. Let's make sure that these exceptions cause mkosi itself to
fail by catching them and re-raising them when the thread is joined.

2 years agoMerge pull request #1583 from Cornelicorn/output-uids
Daan De Meyer [Fri, 26 May 2023 11:46:31 +0000 (13:46 +0200)] 
Merge pull request #1583 from Cornelicorn/output-uids

Improve basename symlinks

2 years agoAdd --all-architectures when we run bootctl
Daan De Meyer [Fri, 26 May 2023 11:27:41 +0000 (13:27 +0200)] 
Add --all-architectures when we run bootctl

To make sure that we install correctly even when doing cross builds

2 years agoVarious improvements
Daan De Meyer [Fri, 26 May 2023 10:01:35 +0000 (12:01 +0200)] 
Various improvements

- Move workspace and install/cache directory handling into MkosiState
- Stop running the build as the user running mkosi, this makes things
simpler as the root user in the userns can write to directories owned
by the user running mkosi but vice versa is not possible. The build
script still can't modify the build image as we mount the build overlay
read-only.
- Create directories that need to be owned by the user running mkosi
before switching to the user namespace
- Various refactorings

2 years agodebian: Fix foreign architecture builds
Daan De Meyer [Fri, 26 May 2023 10:16:50 +0000 (12:16 +0200)] 
debian: Fix foreign architecture builds

--force-architecture forces dpkg to install packages for other
architectures than the host architecture. --force-depends is required
because when building for arm64 it seems it can't quite figure out
all the pre-depends. For extra safety, we also set APT::Architectures
on top of APT::Architecture.

2 years agoAlways overwrite the basename symlink to point to the newest version 1583/head
Cornelius Hoffmann [Fri, 26 May 2023 09:37:41 +0000 (11:37 +0200)] 
Always overwrite the basename symlink to point to the newest version

Having the symlink point to the oldest image is somewhat counterintuitive

2 years agoFix wrong uid:gid on the basename symlink
Cornelius Hoffmann [Fri, 26 May 2023 07:31:50 +0000 (09:31 +0200)] 
Fix wrong uid:gid on the basename symlink

Before this would have the uid:gid of root in the uidmap space
The link is now created in the staging area first to make the change atomic,
so that the wrong uid:gid pair is never seen in the output directory

2 years agoAdd support for pesign to sign secure boot binaries
Daan De Meyer [Thu, 25 May 2023 19:33:09 +0000 (21:33 +0200)] 
Add support for pesign to sign secure boot binaries

sbsign is not packaged on CentOS so let's add support for pesign as
well as support for pesign was recently added to ukify as well.

2 years agoukify: always sign kernel inside of uki if secure boot is enabled
Malte Poll [Thu, 25 May 2023 09:53:47 +0000 (11:53 +0200)] 
ukify: always sign kernel inside of uki if secure boot is enabled

This overrides the auto detection of ukify and always signs the kernel bevore embedding it in the uki (even if the kernel is already signed).
Rationale: When building Fedora 37 images, the Fedora provided kernel is signed with an expired key (id 2574709492).
I would like to add an additional signature with my own signing key to enable kexec and other features that require a correctly signed kernel image.

Co-authored-by: Otto Bittner <cobittner@posteo.net>
2 years agofix missing exist_ok for debian /usr
Cornelius Hoffmann [Wed, 24 May 2023 22:24:41 +0000 (00:24 +0200)] 
fix missing exist_ok for debian /usr

This would prevent having /usr in a skeleton tree

2 years agoFirstboot improvements
Daan De Meyer [Wed, 24 May 2023 12:33:49 +0000 (14:33 +0200)] 
Firstboot improvements

- Merge --root-password-hashed and --root-password-file into
  --root-password. If prefixed with hashed:, we treat it as a hashed
  root password.
- When not building an initrd, also store corresponding credentials
in /usr/lib/credstore, so that the settings work even if only /usr
is shipped in the final image. We don't do this for initrds since
those generally ship with /etc populated.
- Drop setting of firstboot.hostname which isn't actually used by
systemd-firstboot

2 years agoCompress centos 8 variant cpios with xz instead of zstd
Daan De Meyer [Tue, 23 May 2023 10:58:39 +0000 (12:58 +0200)] 
Compress centos 8 variant cpios with xz instead of zstd

The kernel for CentOS 8 and its variants doesn't ship with zstd
initrd compression support, so let's default to xz instead.

2 years agoRefactor image growing
Daan De Meyer [Mon, 22 May 2023 12:08:28 +0000 (14:08 +0200)] 
Refactor image growing

2 years agoUse systemd-repart to grow disk image
Daan De Meyer [Mon, 22 May 2023 12:08:28 +0000 (14:08 +0200)] 
Use systemd-repart to grow disk image

Using truncate isn't entirely right, let's do this properly by letting
systemd-repart handle it.

2 years agoMerge pull request #1571 from DaanDeMeyer/fixes
Daan De Meyer [Mon, 22 May 2023 08:01:38 +0000 (10:01 +0200)] 
Merge pull request #1571 from DaanDeMeyer/fixes

Fixes

2 years agorocky: Drop epel repository from bootable config 1571/head
Daan De Meyer [Mon, 22 May 2023 05:46:22 +0000 (07:46 +0200)] 
rocky: Drop epel repository from bootable config

systemd-boot is provided by the base repositories now so let's drop
the epel repository config.

2 years agoMake mkosi the foreground process again when child process finishes
Daan De Meyer [Sun, 21 May 2023 15:08:51 +0000 (17:08 +0200)] 
Make mkosi the foreground process again when child process finishes

We currently get "Job mkosi has stopped" when fetching running the
summary verb. Let's fix this by making sure we make mkosi the foreground
process again when we finish running a child process.

2 years agoMake sure we page summaries only once when there's multiple presets
Daan De Meyer [Sun, 21 May 2023 15:07:26 +0000 (17:07 +0200)] 
Make sure we page summaries only once when there's multiple presets

2 years agoReturn early if verb is "clean"
Daan De Meyer [Sun, 21 May 2023 15:06:35 +0000 (17:06 +0200)] 
Return early if verb is "clean"

Otherwise we start checking the inputs of the presets which we don't
wanna do if we're just cleaning outputs

2 years agoAdd RepartDirectories to summary
Daan De Meyer [Sun, 21 May 2023 15:06:12 +0000 (17:06 +0200)] 
Add RepartDirectories to summary

2 years agoUse slightly better dnf5 check
Daan De Meyer [Tue, 16 May 2023 12:17:58 +0000 (14:17 +0200)] 
Use slightly better dnf5 check

Instead of checking whether dnf5 exists all the time, just reuse
the first check results

2 years agoVarious dnf fixes
Daan De Meyer [Tue, 16 May 2023 09:16:28 +0000 (11:16 +0200)] 
Various dnf fixes

- Put the logs in a subdirectory of the workspace
- Make sure we configure the persistdir to be inside the workspace
as well. Otherwise dnf5 tries to use the system directory which fails
with a permission error
- Use the non-compat dnf5 option names instead of the compat ones

2 years agoPass firstboot settings to generated initrd as well
Daan De Meyer [Mon, 15 May 2023 13:55:32 +0000 (15:55 +0200)] 
Pass firstboot settings to generated initrd as well

It generally doesn't make sense to have these differ between the
initrd and the rootfs, so let's pass these settings through to the
initrd as well.

The only setting we don't pass through is the root shell as configuring
a different root shell might mean installing extra packages which might
be undesireable in the initrd.

2 years agoOnly clean cache images if cache dir exists
Daan De Meyer [Mon, 15 May 2023 13:47:35 +0000 (15:47 +0200)] 
Only clean cache images if cache dir exists

2 years agoDo not check inputs up front
Daan De Meyer [Fri, 12 May 2023 12:59:16 +0000 (14:59 +0200)] 
Do not check inputs up front

They could be generated by the previous preset

2 years agoMerge pull request #1563 from DaanDeMeyer/fix-needs-build
Jörg Behrmann [Fri, 12 May 2023 12:24:32 +0000 (14:24 +0200)] 
Merge pull request #1563 from DaanDeMeyer/fix-needs-build

Fix needs_build()

2 years agoCheck inputs/outputs before removing any files. 1563/head
Daan De Meyer [Fri, 12 May 2023 11:31:15 +0000 (13:31 +0200)] 
Check inputs/outputs before removing any files.

2 years agoFix needs_build()
Daan De Meyer [Fri, 12 May 2023 11:10:10 +0000 (13:10 +0200)] 
Fix needs_build()

2 years agoDon't install a boot loader if we can't find bootctl
Daan De Meyer [Fri, 12 May 2023 08:42:54 +0000 (10:42 +0200)] 
Don't install a boot loader if we can't find bootctl

Also fail if a bootable image is requested and we can't find bootctl.

2 years agoDon't install a boot loader if no kernels are installed
Daan De Meyer [Fri, 12 May 2023 08:40:03 +0000 (10:40 +0200)] 
Don't install a boot loader if no kernels are installed

If a bootable image has not been explicitly requested, don't install
a boot loader if we can't find any kernel images installed in the image.

2 years agoCheck for btrfs before invoking run()
Daan De Meyer [Fri, 12 May 2023 08:13:31 +0000 (10:13 +0200)] 
Check for btrfs before invoking run()

check= does not handle missing binaries so let's check explicitly
before running btrfs.

2 years agoDo not reuse cache if there is no manifest
Daan De Meyer [Fri, 12 May 2023 06:26:26 +0000 (08:26 +0200)] 
Do not reuse cache if there is no manifest

This makes sure there's no need to remove the cache manually to
make sure the manifest gets generated.

2 years agoMerge pull request #1557 from DaanDeMeyer/vsock
Daan De Meyer [Fri, 12 May 2023 06:10:08 +0000 (08:10 +0200)] 
Merge pull request #1557 from DaanDeMeyer/vsock

Add a feature for enabling/disabling qemu vsock usage

2 years agoAdd a feature for enabling/disabling qemu vsock usage 1557/head
Daan De Meyer [Thu, 11 May 2023 13:26:52 +0000 (15:26 +0200)] 
Add a feature for enabling/disabling qemu vsock usage

2 years agoMove qemu logic into qemu.py
Daan De Meyer [Thu, 11 May 2023 13:18:38 +0000 (15:18 +0200)] 
Move qemu logic into qemu.py

We also introduce a new function qemu_check_vsock_support()

2 years agoMake config_kvm a proper ConfigFeature
Daan De Meyer [Thu, 11 May 2023 13:09:54 +0000 (15:09 +0200)] 
Make config_kvm a proper ConfigFeature

2 years agoMerge pull request #1555 from DaanDeMeyer/notify
Daan De Meyer [Thu, 11 May 2023 12:10:23 +0000 (14:10 +0200)] 
Merge pull request #1555 from DaanDeMeyer/notify

Propagate systemd exit status from the VM

2 years agoci: Add console=ttyS0 to the kernel command line 1555/head
Daan De Meyer [Thu, 11 May 2023 12:07:09 +0000 (14:07 +0200)] 
ci: Add console=ttyS0 to the kernel command line

It's the default but since we override the default we lose the
default value so add it back explicitly.

2 years agoUse /efi as the ESP path when building the image
Daan De Meyer [Thu, 11 May 2023 11:42:21 +0000 (13:42 +0200)] 
Use /efi as the ESP path when building the image

We used to use /boot because kernel-install would hardcode it but since
we don't use kernel-install anymore, let's use /efi instead. This way,
if anyone wants to install grub, they can do so in /boot and package
/boot up as an XBOOTLDR partition.

2 years agoci: Simplify checks
Daan De Meyer [Thu, 11 May 2023 11:53:15 +0000 (13:53 +0200)] 
ci: Simplify checks

Instead of mounting the filesystem and checking the contents of the
failed-services file, let's just shut down the machine with a non-zero
exit status if there are failed services. This works for both nspawn
and qemu now that we have the vsock notify socket set up.

2 years agoaction: Allow unprivileged access to kvm, vhost-vsock and vhost-net devices
Daan De Meyer [Thu, 11 May 2023 08:55:18 +0000 (10:55 +0200)] 
action: Allow unprivileged access to kvm, vhost-vsock and vhost-net devices

These are restricted on Debian/Ubuntu but we want to allow running
unprivileged qemu so let's loosen the permissions on these devices
to make that possible.

2 years agoFix vhost-vsock access check
Daan De Meyer [Thu, 11 May 2023 09:50:55 +0000 (11:50 +0200)] 
Fix vhost-vsock access check

Let's make sure we use exactly the same open() command that qemu
uses to check if we can access the /dev/vhost-vsock device.

2 years agoDrop kernel modules add/remove debug log messages
Daan De Meyer [Thu, 11 May 2023 09:37:54 +0000 (11:37 +0200)] 
Drop kernel modules add/remove debug log messages

Too noisy when there's lots of kernel modules

2 years agoPropagate systemd exit status from the VM
Daan De Meyer [Thu, 11 May 2023 08:45:54 +0000 (10:45 +0200)] 
Propagate systemd exit status from the VM

Let's make use of the new vmm.notify_socket credential to fetch
systemd's exit status from the VM and propagate it as our own exit
status, just like already happens automatically for containers with
systemd-nspawn.

2 years agoci: Drop epel repository for alma
Daan De Meyer [Thu, 11 May 2023 09:10:49 +0000 (11:10 +0200)] 
ci: Drop epel repository for alma

systemd-boot should be available in the base OS now.

2 years agoaction: Drop linux-modules-extra-azure again
Daan De Meyer [Thu, 11 May 2023 08:47:26 +0000 (10:47 +0200)] 
action: Drop linux-modules-extra-azure again

This doesn't work since the modules don't match the running kernel
version.

2 years agoFix output check
Daan De Meyer [Wed, 10 May 2023 16:54:40 +0000 (18:54 +0200)] 
Fix output check

2 years agoaction: Install extra azure modules package
Daan De Meyer [Wed, 10 May 2023 14:14:59 +0000 (16:14 +0200)] 
action: Install extra azure modules package

This contains the erofs kernel module which is required for mounting
erofs filesystems in systemd-nspawn.

2 years agoaction: Sort package list
Daan De Meyer [Wed, 10 May 2023 14:13:59 +0000 (16:13 +0200)] 
action: Sort package list

2 years agoFix failure when we have a build script without build packages
Daan De Meyer [Wed, 10 May 2023 12:56:47 +0000 (14:56 +0200)] 
Fix failure when we have a build script without build packages

2 years agoubuntu: Use linux-kvm package in CI
Daan De Meyer [Wed, 10 May 2023 08:15:24 +0000 (10:15 +0200)] 
ubuntu: Use linux-kvm package in CI

2 years agoDon't check for /usr/lib/kernel/cmdline on the host system
Daan De Meyer [Wed, 10 May 2023 08:13:27 +0000 (10:13 +0200)] 
Don't check for /usr/lib/kernel/cmdline on the host system

2 years agoFix --sign-expected-pcr
Daan De Meyer [Tue, 9 May 2023 15:01:28 +0000 (17:01 +0200)] 
Fix --sign-expected-pcr

Fall out from the introduction of ConfigFeature

2 years agoOnly try to apply ACL to image output if it's a directory
Daan De Meyer [Tue, 9 May 2023 09:56:35 +0000 (11:56 +0200)] 
Only try to apply ACL to image output if it's a directory

2 years agoMerge pull request #1548 from DaanDeMeyer/cache
Daan De Meyer [Tue, 9 May 2023 09:53:19 +0000 (11:53 +0200)] 
Merge pull request #1548 from DaanDeMeyer/cache

Add some very basic cache invalidation

2 years agoMake sure the initrd outputs are prefixed with the image name 1548/head
Daan De Meyer [Tue, 9 May 2023 09:23:13 +0000 (11:23 +0200)] 
Make sure the initrd outputs are prefixed with the image name

This makes sure that they're cleaned up in unlink_output() together with the image.

2 years agoAdd some very basic cache invalidation
Daan De Meyer [Tue, 9 May 2023 09:09:26 +0000 (11:09 +0200)] 
Add some very basic cache invalidation

Let's compare the packages, build packages, repositories and the
contents of the prepare script. This doesn't cover everything but
should be sufficient to catch most changes without having to run
with "-ff".

2 years agoMake sure we build initrd with same force as final image
Daan De Meyer [Tue, 9 May 2023 09:07:29 +0000 (11:07 +0200)] 
Make sure we build initrd with same force as final image

2 years agoMove save_cache() next to reuse_cache_tree()
Daan De Meyer [Tue, 9 May 2023 08:36:52 +0000 (10:36 +0200)] 
Move save_cache() next to reuse_cache_tree()

Also rename reuse_cache_tree() to reuse_cache().

2 years agoGet rid of build_stuff()
Daan De Meyer [Tue, 9 May 2023 08:16:05 +0000 (10:16 +0200)] 
Get rid of build_stuff()

The distinction between build_stuff() and build_image() is quite
arbitrary these days. build_stuff() used to build multiple images,
and build_image() would build a single image, but that's not the
case anymore, so let's merge build_stuff() into build_image().

2 years agoGet rid of init_mount_namespace()
Daan De Meyer [Tue, 9 May 2023 08:07:20 +0000 (10:07 +0200)] 
Get rid of init_mount_namespace()

Let's just unshare the mount namespace as well as part of
become_root(). Also stop making every mount a slave mount, since
we don't really care about host mounts propagating into our mount
namespace.

2 years agoDo not cache skeleton trees
Daan De Meyer [Tue, 9 May 2023 07:55:24 +0000 (09:55 +0200)] 
Do not cache skeleton trees

There's no point, we're either copying the files from the cache or
from the skeleton tree, so let's not duplicate those files
unnecessarily.

2 years agoGet rid of for_cache argument of build_image()
Daan De Meyer [Tue, 9 May 2023 07:50:41 +0000 (09:50 +0200)] 
Get rid of for_cache argument of build_image()

It's trivial to save and reuse the cache directly in build_image(),
so let's get rid of for_cache and just do the logic directly in
build_image().

2 years agoMerge pull request #1547 from DaanDeMeyer/fixes
Luca Boccassi [Mon, 8 May 2023 23:38:51 +0000 (00:38 +0100)] 
Merge pull request #1547 from DaanDeMeyer/fixes

Fixes

2 years agochmod /etc/machine-id and not the root directory 1547/head
Daan De Meyer [Mon, 8 May 2023 20:41:52 +0000 (22:41 +0200)] 
chmod /etc/machine-id and not the root directory

Fixes #1546

2 years agoMore ACL fixes
Daan De Meyer [Mon, 8 May 2023 20:25:43 +0000 (22:25 +0200)] 
More ACL fixes

Let's make sure we actually add ACLs to directories that initally
don't exist yet.

2 years agoMerge pull request #1545 from DaanDeMeyer/erofs
Daan De Meyer [Mon, 8 May 2023 14:06:18 +0000 (16:06 +0200)] 
Merge pull request #1545 from DaanDeMeyer/erofs

action: Install erofs-utils and drop zypper

2 years agoaction: Install erofs-utils and drop zypper 1545/head
Daan De Meyer [Mon, 8 May 2023 13:57:16 +0000 (15:57 +0200)] 
action: Install erofs-utils and drop zypper

2 years agoMerge pull request #1543 from DaanDeMeyer/firstboot
Daan De Meyer [Mon, 8 May 2023 13:39:24 +0000 (15:39 +0200)] 
Merge pull request #1543 from DaanDeMeyer/firstboot

Adopt systemd-firstboot

2 years agoSet tty size and term for /dev/console as well 1543/head
Daan De Meyer [Mon, 8 May 2023 07:40:09 +0000 (09:40 +0200)] 
Set tty size and term for /dev/console as well

When emergency.service is started, it's started connected to
/dev/console, so make sure we configure default term and tty size
for that one as well.

2 years agoACL fixes
Daan De Meyer [Sun, 7 May 2023 19:18:53 +0000 (21:18 +0200)] 
ACL fixes

- Toggle ACLs only if they're actually set in the first place on
inputs
- Toggle ACLs on skeleton and extra trees as well

2 years agoOutput size of each UKI we assemble
Daan De Meyer [Sun, 7 May 2023 18:06:30 +0000 (20:06 +0200)] 
Output size of each UKI we assemble

2 years agoMake KernelModulesInclude take priority over KernelModulesExclude=
Daan De Meyer [Sun, 7 May 2023 17:42:53 +0000 (19:42 +0200)] 
Make KernelModulesInclude take priority over KernelModulesExclude=

If exclude takes priority over include, it becomes hard to exclude
directories of drivers except for a few. If include takes priority
over exclude, we can do stuff like exclude "drivers/gpu/*" and
include "drivers/gpu/nvidia" to only include nvidia drivers.

The current behavior easily be reproduced by adding exclude "*"
followed by include patterns.

2 years agoAdd KernelModulesInclude= and KernelModulesExclude=
Daan De Meyer [Sun, 7 May 2023 16:18:13 +0000 (18:18 +0200)] 
Add KernelModulesInclude= and KernelModulesExclude=

These are like KernelModulesInitrdInclude= and
KernelModulesInitrdExclude= but they apply to the image itself
instead of to the kernel modules initrd.

The main use case is when using mkosi as an initramfs builder and
you want to exclude kernel modules from the initramfs but it can
also be useful when distros only ship large kernel packages that
you want to trim down.

2 years agoarch: Always exclude initramfs generator if we're doing a bootable image
Daan De Meyer [Sun, 7 May 2023 13:16:31 +0000 (15:16 +0200)] 
arch: Always exclude initramfs generator if we're doing a bootable image

The current condition is wrong as we'll generate an initrd ourselves
if none are provided by the user, so update the condition to not install
initramfs generators unless generating a bootable image is explicitly
disabled.

2 years agoKernel modules initramfs improvements
Daan De Meyer [Sun, 7 May 2023 13:05:23 +0000 (15:05 +0200)] 
Kernel modules initramfs improvements

- Use relative paths over full absolute paths
- Put all the firmware directories into the initramfs as well (just
the dirs, not all the firmware files)
- Return sets from resolve kernel modules function
- Operate on sorted lists of the sets to improve reproduciblity
- Split out filter_kernel_modules()
- Take builtin modules into account as well
- Use name field instead of filename from modinfo output
- Stop using joinpath() in favor of parentheses

2 years agoFall back to regular copying if doing a btrfs snapshot fails
Daan De Meyer [Sun, 7 May 2023 13:02:35 +0000 (15:02 +0200)] 
Fall back to regular copying if doing a btrfs snapshot fails

2 years agoGive disk images some extra free disk space when we boot them
Daan De Meyer [Sun, 7 May 2023 07:10:19 +0000 (09:10 +0200)] 
Give disk images some extra free disk space when we boot them

truncate creates the extra disk space sparse so this doesn't affect
the host's disk usage. The extra disk space will have to be partitioned
to be usable inside the image though (but this is perfect for systemd's
use case as we want to partition the free space with systemd-repart).

2 years agoIntroduce separate settings for configuring the verity key/certificate
Daan De Meyer [Sat, 6 May 2023 12:06:28 +0000 (14:06 +0200)] 
Introduce separate settings for configuring the verity key/certificate

These also default to mkosi.key and mkosi.crt but give the option to
use different files if required.

2 years agoFix sections for a number of settings
Daan De Meyer [Sat, 6 May 2023 11:45:13 +0000 (13:45 +0200)] 
Fix sections for a number of settings

Let's move a bunch of settings to a section that makes more sense
for them. No functional change, just moving stuff around.

2 years agoMake secure boot key and certificate required if set
Daan De Meyer [Sat, 6 May 2023 11:34:27 +0000 (13:34 +0200)] 
Make secure boot key and certificate required if set

If these are explicitly configured, we should make sure the paths
exist.

2 years agoMake key generation generic
Daan De Meyer [Sat, 6 May 2023 11:31:22 +0000 (13:31 +0200)] 
Make key generation generic

Let's put generated keys in mkosi.key and mkosi.crt, and remove the
secure boot nomenclature from the key generation options. This allows
us to reuse the keys for other signing operations as well.

2 years agoReduce ESP default size to 512MB
Daan De Meyer [Sat, 6 May 2023 11:17:43 +0000 (13:17 +0200)] 
Reduce ESP default size to 512MB

Now that we compress the Debian kernel modules initramfs, we can
reduce the default ESP size to 512MB again as it's large enough to
fit the Debian initramfs even with all kernel modules included.

2 years agoAllow skipping presets with a [Match] section
Daan De Meyer [Sat, 6 May 2023 10:07:59 +0000 (12:07 +0200)] 
Allow skipping presets with a [Match] section

If a preset's main config file has a [Match] section and it doesn't
match, do not add the preset to the list of presets.

2 years agoOnly check if given initrds exist if we're building a bootable image
Daan De Meyer [Sat, 6 May 2023 09:55:48 +0000 (11:55 +0200)] 
Only check if given initrds exist if we're building a bootable image

This allows disabling the initrd build without failing the final
image build that uses it.

2 years agoWrite all systemd units and dropins to /usr/ instead of /etc
Daan De Meyer [Sat, 6 May 2023 09:54:15 +0000 (11:54 +0200)] 
Write all systemd units and dropins to /usr/ instead of /etc

We want to accomodate images that only ship a /usr partition so let's
start by writing all of our dropins and units to /usr.

2 years agoAdopt systemd-firstboot
Daan De Meyer [Fri, 5 May 2023 20:14:18 +0000 (22:14 +0200)] 
Adopt systemd-firstboot

We keep it simple and just adopt the same settings that firstboot
has and pass them through directly.

This commit also reworks how we reset the machine ID, random seed
and a few other files.

2 years agoKernel modules initrd improvements
Daan De Meyer [Fri, 5 May 2023 14:15:41 +0000 (16:15 +0200)] 
Kernel modules initrd improvements

- Let's compress the kernel modules initrd on Debian to at least
reduce the disk usage required for the initrd. Not required for other
distros since those compress their kernel modules already individually.
- Add option --kernel-modules-initrd to enable/disable usage of the
kernel modules initrd. Can be used to disable it if the main initrd
already contains the necessary kernel modules
- Add options --kernel-modules-initrd-include/exclude to allow
including/excluding the initrds to put in the kernel modules initrd
by regex patterns.

2 years agoMerge pull request #1541 from DaanDeMeyer/subvolume
Daan De Meyer [Fri, 5 May 2023 14:15:11 +0000 (16:15 +0200)] 
Merge pull request #1541 from DaanDeMeyer/subvolume

Various new features and cleanups

2 years agoDrop man page from the repo 1541/head
Daan De Meyer [Fri, 5 May 2023 09:02:34 +0000 (11:02 +0200)] 
Drop man page from the repo

Let's just generate it on demand with pandoc when needed instead of
storing it in the repo. I initially pushed for putting in the repo
because the mkosi AUR package pulled in hundreds of Haskell dependencies
for pandoc when installing mkosi to build the manpage, but that's an
Arch issue and not something to solve in mkosi. Also, mkosi moved
from the AUR to the community repo these days so it's not an issue
on Arch anymore either.

2 years agoAdd Bootable= match
Daan De Meyer [Fri, 5 May 2023 08:06:44 +0000 (10:06 +0200)] 
Add Bootable= match

2 years agoIntroduce --use-subvolumes
Daan De Meyer [Fri, 5 May 2023 06:57:10 +0000 (08:57 +0200)] 
Introduce --use-subvolumes

Let's optionally use subvolumes to speed up copies when incremental
builds or base trees are used.

2 years agoSet dnf logdir to the workspace directory
Daan De Meyer [Fri, 5 May 2023 08:57:56 +0000 (10:57 +0200)] 
Set dnf logdir to the workspace directory

Let's not clutter the image with dnf logs.

2 years agoIntroduce ConfigFeature
Daan De Meyer [Fri, 5 May 2023 06:56:48 +0000 (08:56 +0200)] 
Introduce ConfigFeature

2 years agoRemove dead code
Daan De Meyer [Fri, 5 May 2023 08:42:39 +0000 (10:42 +0200)] 
Remove dead code

2 years agoMerge pull request #1538 from DaanDeMeyer/stable
Daan De Meyer [Fri, 5 May 2023 08:40:46 +0000 (10:40 +0200)] 
Merge pull request #1538 from DaanDeMeyer/stable

Make sure a stable path to the output path exists