]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
8 months agoarchive: pass sandbox to workdir() 3204/head
Luca Boccassi [Mon, 18 Nov 2024 10:41:34 +0000 (10:41 +0000)] 
archive: pass sandbox to workdir()

Otherwise callign from 50-mkosi.install will fail:

‣ Creating cpio archive /tmp/kernel-install.staging.jNm85k/microcode…
cpio: cannot change to directory `/work/tmp/tmpnlxrwb7k/initrd-microcode-root': No such file or directory
‣ "cpio --create --reproducible --renumber-inodes --null --format=newc --quiet --directory /work/tmp/tmpnlxrwb7k/initrd-microcode-root" returned non-zero exit code 2.

8 months agoMark 50-mkosi.install as executable
Luca Boccassi [Sun, 17 Nov 2024 22:35:21 +0000 (22:35 +0000)] 
Mark 50-mkosi.install as executable

Allows it to be symlinked in /etc/kernel/install.d to always use latest
main from a repository

8 months agoMerge pull request #3200 from DaanDeMeyer/passwd-symlink
Daan De Meyer [Sun, 17 Nov 2024 16:31:49 +0000 (17:31 +0100)] 
Merge pull request #3200 from DaanDeMeyer/passwd-symlink

Use passwd symlinks instead of bind mounts

8 months agoAdd packages required for --qemu-gui to Arch tools tree 3200/head
Daan De Meyer [Sat, 16 Nov 2024 16:07:40 +0000 (17:07 +0100)] 
Add packages required for --qemu-gui to Arch tools tree

8 months agoqemu: Use advanced form of specifying display
Daan De Meyer [Sat, 16 Nov 2024 16:07:18 +0000 (17:07 +0100)] 
qemu: Use advanced form of specifying display

8 months agoInstall pkcs11-provider and opensc in tools tree
Daan De Meyer [Sat, 16 Nov 2024 14:50:20 +0000 (15:50 +0100)] 
Install pkcs11-provider and opensc in tools tree

Required for signing with openssl pkcs11 provider.

8 months agoOnly allow certificate files when not using systemd-sbsign
Daan De Meyer [Sat, 16 Nov 2024 14:50:06 +0000 (15:50 +0100)] 
Only allow certificate files when not using systemd-sbsign

8 months agoFix condition to also check the certificate source type
Daan De Meyer [Sat, 16 Nov 2024 14:49:45 +0000 (15:49 +0100)] 
Fix condition to also check the certificate source type

8 months agoDon't require sbsigntools for secure boot auto enroll unless required
Daan De Meyer [Sat, 16 Nov 2024 14:49:03 +0000 (15:49 +0100)] 
Don't require sbsigntools for secure boot auto enroll unless required

If bootctl 257 or newer is installed, we don't use sbsigntools anymore
so don't require it in that case.

8 months agoAdd ToolsTreePackageDirectories=
Daan De Meyer [Sat, 16 Nov 2024 14:47:43 +0000 (15:47 +0100)] 
Add ToolsTreePackageDirectories=

Sometimes, we want to add locally built rpm packages to the default
tools tree. For example, systemd-repart depends on mkfs binaries that
might not be available on the host system, so the only way to run it
is from within the tools tree, which means we need a way to install
systemd-repart built from source within the tools tree.

8 months agoUse passwd symlinks instead of bind mounts
Daan De Meyer [Fri, 15 Nov 2024 15:24:18 +0000 (16:24 +0100)] 
Use passwd symlinks instead of bind mounts

Bind mounts don't reflect changes to the original files if they're
replaced instead of modified. Let's use symlinks instead so that
changes to the original files are always reflected.

Fixes #3189

8 months agosandbox: Make --symlink work on top of existing files and symlinks
Daan De Meyer [Fri, 15 Nov 2024 15:22:59 +0000 (16:22 +0100)] 
sandbox: Make --symlink work on top of existing files and symlinks

With the new mount API, we can mount on top of existing symlinks and
files, so let's make use of that for --symlink.

8 months agosandbox; Only readlink() if the target is a symlink
Daan De Meyer [Fri, 15 Nov 2024 15:18:31 +0000 (16:18 +0100)] 
sandbox; Only readlink() if the target is a symlink

8 months agoCheck against 257~devel instead of 257
Daan De Meyer [Sun, 17 Nov 2024 12:18:42 +0000 (13:18 +0100)] 
Check against 257~devel instead of 257

Otherwise the new --secure-boot-auto-enroll= option isn't used with
devel and rc versions of systemd bootctl.

8 months agoAdd sound device when QemuGui=true
Davide Cavalca [Fri, 15 Nov 2024 04:43:09 +0000 (20:43 -0800)] 
Add sound device when QemuGui=true

8 months agoAdd --debug-sandbox
Daan De Meyer [Fri, 15 Nov 2024 11:51:19 +0000 (12:51 +0100)] 
Add --debug-sandbox

This will help in debugging sandbox related issues. We run the sandbox
with strace and detach on execve() so we don't strace the command that
we're running.

8 months agoMerge pull request #3196 from DaanDeMeyer/excl
Jörg Behrmann [Fri, 15 Nov 2024 12:17:01 +0000 (13:17 +0100)] 
Merge pull request #3196 from DaanDeMeyer/excl

sandbox: Akways use O_EXCL with O_CREAT

8 months agoDetect home directories outside of /home properly
Daan De Meyer [Fri, 15 Nov 2024 10:27:09 +0000 (11:27 +0100)] 
Detect home directories outside of /home properly

Fixes #3191

8 months agoCheck for apt keyring in tools tree
Daan De Meyer [Thu, 14 Nov 2024 16:04:12 +0000 (17:04 +0100)] 
Check for apt keyring in tools tree

8 months agosandbox: Only create parent directories if dst does not exist yet 3196/head
Daan De Meyer [Fri, 15 Nov 2024 11:05:53 +0000 (12:05 +0100)] 
sandbox: Only create parent directories if dst does not exist yet

8 months agosandbox: Akways use O_EXCL with O_CREAT
Daan De Meyer [Fri, 15 Nov 2024 10:52:00 +0000 (11:52 +0100)] 
sandbox: Akways use O_EXCL with O_CREAT

In all cases we want to make sure that we're the ones creating the
file so let's specify O_EXCL.

9 months agoMake Check-Valid-Until=false a default flag for apt-get
Artyom Bakhtin [Thu, 14 Nov 2024 17:18:07 +0000 (17:18 +0000)] 
Make Check-Valid-Until=false a default flag for apt-get

Signed-off-by: Artyom Bakhtin <a@bakhtin.net>
9 months agoCheck that systemd-sbsign is available before using it.
Daan De Meyer [Thu, 14 Nov 2024 13:04:50 +0000 (14:04 +0100)] 
Check that systemd-sbsign is available before using it.

9 months agoFix new mypy error
Daan De Meyer [Thu, 14 Nov 2024 13:10:30 +0000 (14:10 +0100)] 
Fix new mypy error

9 months agoMake sure user provided cmdline is always last
Daan De Meyer [Mon, 11 Nov 2024 15:21:04 +0000 (16:21 +0100)] 
Make sure user provided cmdline is always last

Replaces #3158

9 months agoMerge pull request #3182 from NekkoDroid/image-identifier
Daan De Meyer [Thu, 14 Nov 2024 12:59:21 +0000 (13:59 +0100)] 
Merge pull request #3182 from NekkoDroid/image-identifier

Add %I specifier for subimages

9 months agoCheck that BuildSources= inputs are directories
Daan De Meyer [Tue, 12 Nov 2024 10:16:00 +0000 (11:16 +0100)] 
Check that BuildSources= inputs are directories

Fixes #3181

9 months agofixup: GitHub Action: Install all required mkosi dependencies
Davide Cavalca [Wed, 13 Nov 2024 02:41:12 +0000 (18:41 -0800)] 
fixup: GitHub Action: Install all required mkosi dependencies

8505a5303bb0c65991faf59a45409330e0c16a92 lost the --assume-yes
--no-install-recommends. While the former seems to be implicit in the
GitHub runner environment, the latter isn't, and it seems best to leave
both in place.

9 months agoFix man page reference to --tools-tree-packages
Davide Cavalca [Tue, 12 Nov 2024 04:52:25 +0000 (20:52 -0800)] 
Fix man page reference to --tools-tree-packages

This should be --tools-tree-package.

9 months agoExpose subimage name as envvar in scripts 3182/head
Michael Ferrari [Mon, 11 Nov 2024 12:34:50 +0000 (13:34 +0100)] 
Expose subimage name as envvar in scripts

9 months agoAdd %I specifier for subimages
Michael Ferrari [Mon, 11 Nov 2024 12:30:57 +0000 (13:30 +0100)] 
Add %I specifier for subimages

This expands to the name of the subimage (and an empty string for the
main image) and is the same value that is used for Dependencies=.

Fixes: #2566
9 months agoRefactor resolve_deps and reorder after configure
Michael Ferrari [Mon, 11 Nov 2024 01:18:22 +0000 (02:18 +0100)] 
Refactor resolve_deps and reorder after configure

As a configure script can modify the config in nearly any way it pleases
it is not impossible that dependencies may be resolved at runtime. So
just rerun dependency resolution after all configure scripts have done
their stuff.

9 months agoGitHub Action: Install all required mkosi dependencies
Davide Cavalca [Mon, 11 Nov 2024 14:07:35 +0000 (06:07 -0800)] 
GitHub Action: Install all required mkosi dependencies

9 months agoAdd support for systemd-sbsign and --certificate-source
Daan De Meyer [Tue, 5 Nov 2024 12:56:28 +0000 (13:56 +0100)] 
Add support for systemd-sbsign and --certificate-source

Matching PR for https://github.com/systemd/systemd/pull/35021
and https://github.com/systemd/systemd/pull/35057

9 months agoDon't put /usr/bin and /usr/sbin in front of extra search paths in $PATH
Daan De Meyer [Mon, 4 Nov 2024 11:51:27 +0000 (12:51 +0100)] 
Don't put /usr/bin and /usr/sbin in front of extra search paths in $PATH

Currently extra search paths don't get used because we always add /usr/bin
and /usr/sbin earlier in $PATH.

9 months agoMerge pull request #3166 from DaanDeMeyer/provider
Jörg Behrmann [Mon, 4 Nov 2024 01:19:08 +0000 (02:19 +0100)] 
Merge pull request #3166 from DaanDeMeyer/provider

Add support for openssl providers as key sources

9 months agoAdd support for openssl providers as key sources 3166/head
Daan De Meyer [Sun, 3 Nov 2024 17:08:07 +0000 (18:08 +0100)] 
Add support for openssl providers as key sources

9 months agoMake sure we only parse [Include] and [Host] from builtin configs as well
Daan De Meyer [Sun, 3 Nov 2024 19:31:01 +0000 (20:31 +0100)] 
Make sure we only parse [Include] and [Host] from builtin configs as well

When we're reusing the history, we were still parsing all sections
from builtin configs instead of only the [Include] and [Host] sections.

9 months agoRemove sandbox verb from needs_build()
Daan De Meyer [Sun, 3 Nov 2024 19:18:39 +0000 (20:18 +0100)] 
Remove sandbox verb from needs_build()

It's not a clear cut case whether the sandbox needs a build or not.
The needs_build() method was originally intended for verbs that need
a full image build but the sandbox build only needs the tools tree.
Also, the tools tree is only built if ToolsTree=default and not if
set explicitly.

More practically, we don't want the JSON history from .mkosi-private
to be used when using mkosi sandbox, and that's the only usage of
the needs_build() method, so to fix that problem let's remove the sandbox
verb from needs_build().

9 months agoMerge pull request #3161 from DaanDeMeyer/enroll
Daan De Meyer [Sun, 3 Nov 2024 13:10:24 +0000 (14:10 +0100)] 
Merge pull request #3161 from DaanDeMeyer/enroll

Add support for bootctl secure boot auto enrollment

9 months agoAdd support for bootctl secure boot auto enrollment 3161/head
Daan De Meyer [Fri, 1 Nov 2024 19:00:55 +0000 (20:00 +0100)] 
Add support for bootctl secure boot auto enrollment

Matching PR for https://github.com/systemd/systemd/pull/34948

9 months agoSort package list
Daan De Meyer [Sun, 3 Nov 2024 12:01:10 +0000 (13:01 +0100)] 
Sort package list

9 months agoAdd libseccomp to default tools tree
Daan De Meyer [Sun, 3 Nov 2024 12:00:48 +0000 (13:00 +0100)] 
Add libseccomp to default tools tree

Required by mkosi-sandbox

9 months agoPass configured environment to ukify
Daan De Meyer [Fri, 1 Nov 2024 18:54:32 +0000 (19:54 +0100)] 
Pass configured environment to ukify

9 months agoSet up a private session keyring for engine pin caching
Daan De Meyer [Fri, 1 Nov 2024 18:50:10 +0000 (19:50 +0100)] 
Set up a private session keyring for engine pin caching

If we're using an engine as a key source, let's set up a private
session keyring and configure systemd tooling to store pins in the
session keyring with infinite lifetime. This means systemd will only
prompt for a pin once per key and reuse the cached pin from the session
keyring from that point onwards. The session keyring is automatically
removed when mkosi exits.

9 months agoSet zero owner UUID for secure boot signature databases
Daan De Meyer [Fri, 1 Nov 2024 17:50:44 +0000 (18:50 +0100)] 
Set zero owner UUID for secure boot signature databases

Makes things more reproducible compared to using a random UUID.

9 months agoMerge pull request #3164 from DaanDeMeyer/sandbox
Daan De Meyer [Sun, 3 Nov 2024 09:47:44 +0000 (10:47 +0100)] 
Merge pull request #3164 from DaanDeMeyer/sandbox

Add sandbox verb

9 months agoAdd some extra tools tree packages to the default image 3164/head
Daan De Meyer [Sat, 2 Nov 2024 20:26:56 +0000 (21:26 +0100)] 
Add some extra tools tree packages to the default image

Now that we have mkosi sandbox, let's add ruff, mypy and pytest to
the tools tree so that they can be used with mkosi sandbox.

9 months agoAdd sandbox verb
Daan De Meyer [Sat, 2 Nov 2024 17:57:31 +0000 (18:57 +0100)] 
Add sandbox verb

In systemd, to run the integration tests, we need to run meson on
the host which will itself invoke mkosi to run the integration tests.
This means all the dependencies to run meson need to be installed on
the host. This doesn't just mean meson needs to be installed, but also
a compiler and various required build dependencies of systemd to allow
building tools invoked by mkosi to build the image.

To avoid having to install these dependencies on the host system, let's
introduce a sandbox verb which runs a command in the mkosi sandbox that's
also used by other verbs such as boot, qemu and shell. This then allows
extra required tools to be installed in the tools tree via ToolsTreePackages=
to allow running these commands without having to install them on the host
system.

9 months agoDrop tools tree from cache manifest
Daan De Meyer [Sat, 2 Nov 2024 19:39:53 +0000 (20:39 +0100)] 
Drop tools tree from cache manifest

The existing check is too primitive and actually causes issues when
using the new mkosi sandbox verb we'll add in the next commit so let's
drop it.

9 months agoAlways mount in /usr/share/factory from the host in relaxed sandbox
Daan De Meyer [Sat, 2 Nov 2024 17:55:51 +0000 (18:55 +0100)] 
Always mount in /usr/share/factory from the host in relaxed sandbox

If we're using /etc from the host, also use /usr/share/factory from
the host to account for symlinks from /etc into /usr/share/factory.

9 months agoDon't mount sandbox.py to /sandbox.py in relaxed sandbox
Daan De Meyer [Sat, 2 Nov 2024 15:35:44 +0000 (16:35 +0100)] 
Don't mount sandbox.py to /sandbox.py in relaxed sandbox

In a relaxed sandbox we'll never execute apivfs_script_cmd() or
chroot_script_cmd() so there's no need to mount sandbox.py in.

9 months agoAdd PATH entries beneath the user's home to PATH in relaxed sandbox
Daan De Meyer [Sat, 2 Nov 2024 15:11:07 +0000 (16:11 +0100)] 
Add PATH entries beneath the user's home to PATH in relaxed sandbox

This handles the case where a user adds ~/.local/bin to the PATH.
Let's make sure we use that even when running with a tools tree.
This might not work for binaries that are built against libraries
from the user's host /usr but there's lots of tools that will either
be statically compiled or written in an interpreted language like
python that will still work even when we switch out /usr from underneath
them.

9 months agoIgnore crypto mount if it only contains empty directories
Daan De Meyer [Sat, 2 Nov 2024 15:09:29 +0000 (16:09 +0100)] 
Ignore crypto mount if it only contains empty directories

Let's beef up the crypto mount check and check if there are only
empty directories in the mount and ignore it if that's the case.
This handles the case where e.g. on Arch installing pesign leads
to /etc/pki containing only /etc/pki/pesign as an empty directory.

9 months agoDon't remove default tools tree when mkosi -ff is used
Daan De Meyer [Sat, 2 Nov 2024 15:08:05 +0000 (16:08 +0100)] 
Don't remove default tools tree when mkosi -ff is used

Generally when -ff is specified users won't want to remove the
default tools tree if they're using one, so let's stop doing that.
The default tools tree is still removed when mkosi -f clean is invoked.

9 months agoMake default tools tree output name distribution independent
Daan De Meyer [Sat, 2 Nov 2024 15:06:42 +0000 (16:06 +0100)] 
Make default tools tree output name distribution independent

We included the distribution name when we first added this because
the tools tree distribution was different depending on which distribution
we were building. Now that we choose the tools tree distribution based on
the host distribution, this doesn't make much sense anymore, so get rid
of the distribution in the default tools tree output name and name it just
"tools" instead.

9 months agoMake asyncio imports lazy
Daan De Meyer [Sat, 2 Nov 2024 20:37:24 +0000 (21:37 +0100)] 
Make asyncio imports lazy

This is low hanging fruit to reduce the startup time a little.

9 months agoBump github/codeql-action from 3.26.10 to 3.27.0
dependabot[bot] [Fri, 1 Nov 2024 22:46:29 +0000 (22:46 +0000)] 
Bump github/codeql-action from 3.26.10 to 3.27.0

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.10 to 3.27.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/e2b3eafc8d227b0241d48be5f425d47c2d750a13...662472033e021d55d94146f66f6058822b0b39fd)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
9 months agoBump actions/checkout from 4.2.0 to 4.2.2
dependabot[bot] [Fri, 1 Nov 2024 22:46:22 +0000 (22:46 +0000)] 
Bump actions/checkout from 4.2.0 to 4.2.2

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/d632683dd7b4114ad314bca15554477dd762a938...11bd71901bbe5b1630ceea73d27597364c9af683)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
9 months agoRemove BuildDirectory= from PrepareScripts=
Michael Ferrari [Fri, 1 Nov 2024 12:24:21 +0000 (13:24 +0100)] 
Remove BuildDirectory= from PrepareScripts=

The BuildDirectory= is meant for files which are non-essential and can
be recreated during the build process of the image, so source files that
need to be acquired should be saved somewhere within the $BUILDROOT to
be cached for runs when PrepareScripts= aren't run (assuming incremental
builds).

9 months agoFix qemu gui output on aarch64
Davide Cavalca [Thu, 31 Oct 2024 22:52:42 +0000 (15:52 -0700)] 
Fix qemu gui output on aarch64

9 months agoMerge pull request #3156 from DaanDeMeyer/subuid
Daan De Meyer [Thu, 31 Oct 2024 21:51:23 +0000 (22:51 +0100)] 
Merge pull request #3156 from DaanDeMeyer/subuid

Map current user to root in subuid user namespace

9 months agoMap current user to root in subuid user namespace 3156/head
Daan De Meyer [Thu, 31 Oct 2024 10:58:28 +0000 (11:58 +0100)] 
Map current user to root in subuid user namespace

By mapping the current user to root in the subuid user namespace,
we don't have to change the ownership of all the files in the directory
tree to root in the subuid uid/gid range. This means that on btrfs
filesystems, we can do a subvolume snapshot instead of an expensive
full tree recursion to copy each file individually.

9 months agoShow a proper error message if /etc/subuid or /etc/subgid doesn't exist.
Daan De Meyer [Thu, 31 Oct 2024 11:00:52 +0000 (12:00 +0100)] 
Show a proper error message if /etc/subuid or /etc/subgid doesn't exist.

9 months agoMerge pull request #3157 from DaanDeMeyer/engine
Jörg Behrmann [Thu, 31 Oct 2024 17:04:07 +0000 (18:04 +0100)] 
Merge pull request #3157 from DaanDeMeyer/engine

Improvements for signing with engines

9 months agoPass through stdin to various signing tools if an engine is used 3157/head
Daan De Meyer [Thu, 31 Oct 2024 11:40:30 +0000 (12:40 +0100)] 
Pass through stdin to various signing tools if an engine is used

The engine might have a pin that needs to be entered via stdin so
let's pass through stdin if that's the case so that users can enter
the pin.

9 months agoBind /run when an engine might be used instead of only /run/pcscd
Daan De Meyer [Thu, 31 Oct 2024 11:36:09 +0000 (12:36 +0100)] 
Bind /run when an engine might be used instead of only /run/pcscd

It's not guaranteed that the engine will be the pkcs#11 one so let's
bind the entirety of /run in case another daemon might be used with
a socket elsewhere in /run.

9 months agoParse local drop-in configuration files
Stephen Larew [Wed, 30 Oct 2024 18:35:19 +0000 (11:35 -0700)] 
Parse local drop-in configuration files

9 months agoNever clean output directory when Format=none
Daan De Meyer [Wed, 30 Oct 2024 09:38:05 +0000 (10:38 +0100)] 
Never clean output directory when Format=none

If Format=none no outputs can be produced at all so let's make sure
we always keep the previous outputs intact when Format=none regardless
of whether -f is specified or not.

9 months agoqemu: move removable_flag into device_type
Jörg Behrmann [Wed, 30 Oct 2024 09:01:44 +0000 (10:01 +0100)] 
qemu: move removable_flag into device_type

Also drop the no longer needed noqa for the overly long line.

Followup for 1c3e71b1.

9 months agoUse scsi-hd when QemuRemovable is enabled
Stephen Larew [Wed, 30 Oct 2024 00:18:00 +0000 (17:18 -0700)] 
Use scsi-hd when QemuRemovable is enabled

9 months agoCheck if firmware subdirectory still exists before trying to remove it
Antonio Alvarez Feijoo [Tue, 29 Oct 2024 12:25:03 +0000 (13:25 +0100)] 
Check if firmware subdirectory still exists before trying to remove it

Detected with `mkosi-initrd`:

```
Calculating required kernel modules and firmware
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/mkosi/run.py", line 64, in uncaught_exception_handler
    yield
  File "/usr/lib/python3.11/site-packages/mkosi/run.py", line 105, in fork_and_wait
    target(*args, **kwargs)
  File "/usr/lib/python3.11/site-packages/mkosi/__init__.py", line 4450, in run_build
    build_image(
  File "/usr/lib/python3.11/site-packages/mkosi/__init__.py", line 3668, in build_image
    run_depmod(context)
  File "/usr/lib/python3.11/site-packages/mkosi/__init__.py", line 2721, in run_depmod
    process_kernel_modules(
  File "/usr/lib/python3.11/site-packages/mkosi/kmod.py", line 248, in process_kernel_modules
    p.rmdir()
  File "/usr/lib64/python3.11/pathlib.py", line 1156, in rmdir
    os.rmdir(self)
FileNotFoundError: [Errno 2] No such file or directory: '/var/tmp/mkosi-workspace-9r8egfmc/root/usr/lib/firmware/yamaha'
```

Fixes c0d596dbee111f4730b26045a1f4d7da68a66047

9 months agoMerge pull request #3146 from DaanDeMeyer/clean
Jörg Behrmann [Tue, 29 Oct 2024 11:59:51 +0000 (12:59 +0100)] 
Merge pull request #3146 from DaanDeMeyer/clean

Remove access to the output directory in build scripts and only run clean scripts when we clean up the output dir

9 months agoopensuse: remove sysuser-shadow from initrd
Antonio Alvarez Feijoo [Tue, 29 Oct 2024 08:22:45 +0000 (09:22 +0100)] 
opensuse: remove sysuser-shadow from initrd

SUSE-ish utility pulled by some rpm scriptlets that calls systemd-sysusers or
shadow tools to create users and groups during installation.

9 months agoRemove access to the output directory in build scripts 3146/head
Daan De Meyer [Mon, 28 Oct 2024 20:27:30 +0000 (21:27 +0100)] 
Remove access to the output directory in build scripts

With mkosi -t none, we can rerun the build script without cleaning
the output directory. This creates an awkward situation, as the build
script might create new outputs but is unable to remove previous ones,
which could lead to weird situations where the output directory contains
artifacts from multiple builds.

Let's tighten this up by disallowing access to the output directory in
build scripts. Users can still copy from the build script to the output
directory by doing the copy from a post-installation script which is not
invoked when we run mkosi -t none so it only runs when we've cleaned up
the output directory.

9 months agoOnly run clean scripts when we clean up the output directory
Daan De Meyer [Mon, 28 Oct 2024 20:19:28 +0000 (21:19 +0100)] 
Only run clean scripts when we clean up the output directory

Clean scripts are intended to clean up the output directory, so let's
only run them when we actually decide to clean up the output directory.

9 months agoUnset $CONFIG in prepare scripts
Septatrix [Mon, 28 Oct 2024 14:56:09 +0000 (15:56 +0100)] 
Unset $CONFIG in prepare scripts

9 months agoMake sure verbs run in the current working directory
Daan De Meyer [Mon, 28 Oct 2024 14:14:28 +0000 (15:14 +0100)] 
Make sure verbs run in the current working directory

9 months agoMerge pull request #3142 from DaanDeMeyer/firmware
Jörg Behrmann [Mon, 28 Oct 2024 15:13:03 +0000 (16:13 +0100)] 
Merge pull request #3142 from DaanDeMeyer/firmware

Delete empty firmware subdirectories

9 months agoDelete empty firmware subdirectories 3142/head
Daan De Meyer [Mon, 28 Oct 2024 13:36:32 +0000 (14:36 +0100)] 
Delete empty firmware subdirectories

Fixes #3124

9 months agoUse firmwared variable in one more place
Daan De Meyer [Mon, 28 Oct 2024 13:36:18 +0000 (14:36 +0100)] 
Use firmwared variable in one more place

9 months agoAllow specifying OpenPGP implementation to use for signing
Wiktor Kwapisiewicz [Thu, 19 Sep 2024 13:17:27 +0000 (15:17 +0200)] 
Allow specifying OpenPGP implementation to use for signing

Fixes: https://github.com/systemd/mkosi/issues/3042
9 months agoopensuse: remove which from initrd
Antonio Alvarez Feijoo [Mon, 28 Oct 2024 08:05:25 +0000 (09:05 +0100)] 
opensuse: remove which from initrd

`less` had hard requirements on `which` and `file` (so also `file-magic` and
`libmagic1`), reworked via packaging in Tumbleweed (
https://build.opensuse.org/request/show/1218137) and available since snapshot
20241025.

9 months agomkosi-initrd: honor x-initrd.attach options in crypttab
Antonio Alvarez Feijoo [Tue, 22 Oct 2024 14:49:39 +0000 (16:49 +0200)] 
mkosi-initrd: honor x-initrd.attach options in crypttab

9 months agoMerge pull request #3131 from NekkoDroid/no-more-split-uki
Daan De Meyer [Fri, 25 Oct 2024 15:30:30 +0000 (17:30 +0200)] 
Merge pull request #3131 from NekkoDroid/no-more-split-uki

Allow more granular control on which artifacts are output

9 months agokernel-install: fix move of cpio output file
Antonio Alvarez Feijoo [Fri, 25 Oct 2024 15:08:58 +0000 (17:08 +0200)] 
kernel-install: fix move of cpio output file

Its name is already `initrd` since 6b0dfe58f3f04264f1df5cb90b7091195913562f

Otherwise:

```
‣  /tmp/tmpgpvfc6y8/initrd.cpio.zst size is 44.9M, consumes 44.9M.
‣ Copying /tmp/tmpgpvfc6y8/initrd to /tmp/kernel-install.staging.KXnXSC/initrd
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/mkosi/run.py", line 64, in uncaught_exception_handler
    yield
  File "/usr/lib64/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/kernel/install.d/50-mkosi.install", line 167, in main
    shutil.move(next(context.staging_area.glob("initrd*.cpio*")), context.staging_area / "initrd")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration
/usr/lib/kernel/install.d/50-mkosi.install failed with exit status 1.
```

9 months agoman/mkosi-initrd: fix description of --output option
Antonio Alvarez Feijoo [Fri, 25 Oct 2024 13:50:12 +0000 (15:50 +0200)] 
man/mkosi-initrd: fix description of --output option

Follow-up for 6b0dfe58f3f04264f1df5cb90b7091195913562f

9 months agoSet qemu drive caching options for qemu drives as well
Daan De Meyer [Wed, 23 Oct 2024 09:50:15 +0000 (11:50 +0200)] 
Set qemu drive caching options for qemu drives as well

We already set these for the scratch device, let's make sure we set
them for any drives we allocate as well.

We also make sure the drive size is aligned to the page size so qemu
can use O_DIRECT.

9 months agoMerge pull request #3137 from DaanDeMeyer/stuff
Daan De Meyer [Tue, 22 Oct 2024 18:21:46 +0000 (20:21 +0200)] 
Merge pull request #3137 from DaanDeMeyer/stuff

Various fixes

9 months agomkosi-initrd: Include virtio_blk module 3137/head
Daan De Meyer [Tue, 22 Oct 2024 17:41:35 +0000 (19:41 +0200)] 
mkosi-initrd: Include virtio_blk module

9 months agoUse virtio-blk-pci unless scsi-hd is really needed
Daan De Meyer [Tue, 22 Oct 2024 17:40:10 +0000 (19:40 +0200)] 
Use virtio-blk-pci unless scsi-hd is really needed

https://www.qemu.org/2021/01/19/virtio-blk-scsi-configuration/
mentions that for performance critical use cases, virtio-blk should
be preferred so let's use virtio-blk unless we actually need scsi-hd.

9 months agoMake qemu drives and scratch device NOCOW as well
Daan De Meyer [Tue, 22 Oct 2024 17:35:51 +0000 (19:35 +0200)] 
Make qemu drives and scratch device NOCOW as well

These will face lots of random writes as well so let's make these
NOCOW as well.

9 months agoDon't unconditionally enable epel for mkosi-initrd
Daan De Meyer [Sun, 20 Oct 2024 08:58:08 +0000 (10:58 +0200)] 
Don't unconditionally enable epel for mkosi-initrd

Whether to enable epel or not should be up to the user, not hard coded
by us, so drop the config snippet that enables the epel repositories.

follow-up for 886f091a743a6ac808c20ef59e9cf7e20703376d

To enable the epel repositories for mkosi-initrd, you'd do something
like the following:

"""
[Distribution]
Distribution=centos
Release=9
Repositories=epel,epel-next

[Include]
Include=mkosi-initrd
"""

We don't currently have a way to enable the epel repositories when
using mkosi-initrd, because it always uses the exact same repositories
as the host system. However, erofs-utils can still be installed by just
including it using /usr/lib/mkosi-initrd/mkosi.conf without a match
section.

9 months agoImplement default values for the simple config parser
Daan De Meyer [Mon, 21 Oct 2024 18:02:22 +0000 (20:02 +0200)] 
Implement default values for the simple config parser

9 months agoMake SplitArtifacts= take a list of values 3131/head
Michael Ferrari [Sun, 20 Oct 2024 11:11:32 +0000 (13:11 +0200)] 
Make SplitArtifacts= take a list of values

This allows more precision on which artifacts are actually split out of
the image and placed into the output directory. Defaults to splitting
the UKI, vmlinuz and the initrd out.

9 months agoRefactor copy_{uki,vmlinuz,initrd}
Michael Ferrari [Thu, 17 Oct 2024 19:52:28 +0000 (21:52 +0200)] 
Refactor copy_{uki,vmlinuz,initrd}

A follow-up commit will introduce the ability to disable copying these
to the output directory, so refactor all the logic so that they are
contained within their respectiv functions.

9 months agoopensuse: prevent zypper from pulling busybox in the initrd
Antonio Alvarez Feijoo [Fri, 18 Oct 2024 09:43:32 +0000 (11:43 +0200)] 
opensuse: prevent zypper from pulling busybox in the initrd

zypper's internal logic selects busybox-package variants of packages that are
required via dependency and not explicitly listed to install, which also causes
busybox to be added to the initrd.

Also, remove the shadow package (the equivalent to the shadow-utils package in
Fedora).

9 months agoMove copy_nspawn_settings
Michael Ferrari [Fri, 18 Oct 2024 09:08:04 +0000 (11:08 +0200)] 
Move copy_nspawn_settings

9 months agoFix conf with settings in Content instead of Build
Antonio Alvarez Feijoo [Wed, 16 Oct 2024 13:33:05 +0000 (15:33 +0200)] 
Fix conf with settings in Content instead of Build

Follow-up for 6912dc0ea0c7e20900a9b5d2c43343c1c782e91c

9 months agoFix mkosi-initrd conf for CentOS EPEL
Antonio Alvarez Feijoo [Wed, 16 Oct 2024 08:28:14 +0000 (10:28 +0200)] 
Fix mkosi-initrd conf for CentOS EPEL

Fixes #3127