]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
11 months agoMount /etc/ld.so.cache into the sandbox if it exists 2984/head
Daan De Meyer [Wed, 28 Aug 2024 07:20:23 +0000 (09:20 +0200)] 
Mount /etc/ld.so.cache into the sandbox if it exists

Otherwise libraries in non-standard locations won't be found at runtime.

11 months agoDon't mount stuff twice from different sources in sandbox
Daan De Meyer [Wed, 28 Aug 2024 06:53:57 +0000 (08:53 +0200)] 
Don't mount stuff twice from different sources in sandbox

We were mounting /var/tmp and /etc/resolv.conf twice in chroot_cmd(),
let's make sure we avoid doing that by moving the CLI options into
the respective _script_cmd() functions.

11 months agoUse system python if python binary is interpreter is not in /usr
Daan De Meyer [Tue, 27 Aug 2024 15:05:03 +0000 (17:05 +0200)] 
Use system python if python binary is interpreter is not in /usr

Same fix as #2982, but for the python_binary() function.

11 months agoSpecify --noprep when building rpms from source
Daan De Meyer [Tue, 27 Aug 2024 11:04:48 +0000 (13:04 +0200)] 
Specify --noprep when building rpms from source

rpm upstream is moving in this direction as well so let's update our
docs to match.

11 months agoUse python3 in sandbox if host interpreter is not in /usr
Daan De Meyer [Tue, 27 Aug 2024 12:57:48 +0000 (14:57 +0200)] 
Use python3 in sandbox if host interpreter is not in /usr

We only mount /usr into the sandbox, so if mkosi is invoked from a
venv we'll fail to execute the apivfs script or chroot script in the
sandbox as it will try to use an interpreter that isn't available.

Let's check if the used interpreter is relative to /usr and only use
it to execute the chroot and apivfs scripts in the sandbox if it is.

11 months agoMerge pull request #2980 from DaanDeMeyer/sync-scripts
Jörg Behrmann [Tue, 27 Aug 2024 10:42:48 +0000 (12:42 +0200)] 
Merge pull request #2980 from DaanDeMeyer/sync-scripts

Run sync scripts for all images again

11 months agoRun sync scripts for all images again 2980/head
Daan De Meyer [Tue, 27 Aug 2024 09:12:50 +0000 (11:12 +0200)] 
Run sync scripts for all images again

Fixes https://github.com/systemd/mkosi/commit/af66d2391b17d21b6892759e4f4f97684ba1945b

11 months agoMake running sync scripts possible without a context
Daan De Meyer [Tue, 27 Aug 2024 09:10:17 +0000 (11:10 +0200)] 
Make running sync scripts possible without a context

11 months agoMove sandbox tree logic into Config.sandbox()
Daan De Meyer [Tue, 27 Aug 2024 09:08:40 +0000 (11:08 +0200)] 
Move sandbox tree logic into Config.sandbox()

11 months agoRename internal pkgmngr dir to sandbox_tree
Daan De Meyer [Tue, 27 Aug 2024 08:51:45 +0000 (10:51 +0200)] 
Rename internal pkgmngr dir to sandbox_tree

11 months agodocs: Sort list of universal settings
Daan De Meyer [Tue, 27 Aug 2024 08:42:13 +0000 (10:42 +0200)] 
docs: Sort list of universal settings

11 months agoman: mention the empty arguments in help
Zbigniew Jędrzejewski-Szmek [Mon, 26 Aug 2024 16:08:43 +0000 (19:08 +0300)] 
man: mention the empty arguments in help

The autogenerated help for --distribution/--format/… looks like {a,b,…,} (with
an emtpy arg at the end), and it is not obvious what this means. Describe the
empty args in the man page.

11 months agoazure: Deal with repository changes
Daan De Meyer [Mon, 26 Aug 2024 09:41:54 +0000 (11:41 +0200)] 
azure: Deal with repository changes

The preview repositories are now a layer on top of the prod repositories,
so let's adapt mkosi to that.

11 months agoDon't skip build if output format is "none"
Daan De Meyer [Mon, 26 Aug 2024 08:35:23 +0000 (10:35 +0200)] 
Don't skip build if output format is "none"

If the output format is none we always want to rebuild.

11 months agoRework grub conditions
Daan De Meyer [Mon, 26 Aug 2024 09:16:47 +0000 (11:16 +0200)] 
Rework grub conditions

- Use -o instead of || as it's unclear whether || is supported or not
- Use quotes more
- Use [ ] as alias for test

Fixes #2974

11 months agoman: fix SourceDateEpoch= section
Antonio Alvarez Feijoo [Mon, 26 Aug 2024 08:26:37 +0000 (10:26 +0200)] 
man: fix SourceDateEpoch= section

11 months agoMerge pull request #2973 from DaanDeMeyer/metadata
Daan De Meyer [Fri, 23 Aug 2024 20:13:17 +0000 (22:13 +0200)] 
Merge pull request #2973 from DaanDeMeyer/metadata

Rework repository metadata handling

11 months agoMake more trees required 2973/head
Daan De Meyer [Fri, 23 Aug 2024 18:34:23 +0000 (20:34 +0200)] 
Make more trees required

- Tools tree is a universal setting and has to be available at the start
- Sandbox trees are a universal setting and have to be available at the start
- Skeleton trees should be available at the start to make sure caching works
  properly

11 months agoRename package manager trees to sandbox trees
Daan De Meyer [Fri, 23 Aug 2024 18:28:05 +0000 (20:28 +0200)] 
Rename package manager trees to sandbox trees

The package manager trees are mounted in for every command we run
so let's rename them to sandbox trees instead of package manager
trees.

11 months agoRework repository metadata handling
Daan De Meyer [Fri, 23 Aug 2024 17:01:46 +0000 (19:01 +0200)] 
Rework repository metadata handling

- Stop copying repository metadata into the image.

This is too fragile to ever work properly. If the image is ever
used as a base tree, the caller would also need the exact same package
manager configuration for this to be remotely useful, as well as constantly
rebuild the image to keep the repository metadata up to date.

- Stop picking up repository metadata from the image

For the same reason, we can't use repository metadata from any
base trees automatically. It should be explicitly provided by the user
along with the required package manager configuration.

- Share the same repository metadata snapshot between the main and subimage
  builds

Let's ensure that the main image and all subimages are built of the
exact same repository metadata snapshot. Now that we enforce that all
subimages use the same distro, release, architecture, repositories and
everything else that's package manager related, we can use the same
metadata snapshot for every build.

- Rename package_cache_dir in Context to metadata_dir as there's only
metadata in this directory and never any packages.

11 months agoDo not allow configuring universal collection based settings in subimages
Daan De Meyer [Fri, 23 Aug 2024 17:00:09 +0000 (19:00 +0200)] 
Do not allow configuring universal collection based settings in subimages

For the next commit, we want to enforce all subimages to use the same
package manager trees, repositories and package directories, so let's
not allow adding any extra of those in subimages anymore.

11 months agoSimplify run_verb() logic
Daan De Meyer [Fri, 23 Aug 2024 16:44:04 +0000 (18:44 +0200)] 
Simplify run_verb() logic

- Handle Verb.clean separately from builds
- Move most checks to the front before we clean up the previous results.
- Get rid of check_outputs()
- If main image needs a build, clean all subimages as well

11 months agoPrepend extra search paths to $PATH earlier
Daan De Meyer [Thu, 22 Aug 2024 19:35:47 +0000 (21:35 +0200)] 
Prepend extra search paths to $PATH earlier

We should do this before checking if tools are available to make
sure the tools in extra search paths are taken into account.

11 months agoDon't fork for run_sync()
Daan De Meyer [Thu, 22 Aug 2024 18:27:56 +0000 (20:27 +0200)] 
Don't fork for run_sync()

Not required so let's be more efficient by not forking

11 months agoAdd missing directory checks in copy_tree()
Daan De Meyer [Thu, 22 Aug 2024 13:46:06 +0000 (15:46 +0200)] 
Add missing directory checks in copy_tree()

11 months agoci: Disable Arch Linux image with Ubuntu tools tree
Daan De Meyer [Thu, 22 Aug 2024 13:06:35 +0000 (15:06 +0200)] 
ci: Disable Arch Linux image with Ubuntu tools tree

archlinux-keyring in Ubuntu Noble is already too old. Until it's
updated, let's disable the CI build.

For the Github Action we add the kernel-utils ppa which does have
an updated archlinux-keyring.

11 months agofedora: Get rawhide GPG key from github
Daan De Meyer [Thu, 22 Aug 2024 10:10:50 +0000 (12:10 +0200)] 
fedora: Get rawhide GPG key from github

fedora.gpg is always out-of-date when rawhide branches, so let's
instead fetch the rawhide key from distribution-gpg-keys on Github
which does seem to get updated before rawhide branches.

11 months agoMerge pull request #2967 from DaanDeMeyer/fix
Daan De Meyer [Thu, 22 Aug 2024 12:52:34 +0000 (14:52 +0200)] 
Merge pull request #2967 from DaanDeMeyer/fix

Two fixes

11 months agoMove creation of context.root out of Context() 2967/head
Daan De Meyer [Thu, 22 Aug 2024 11:42:20 +0000 (13:42 +0200)] 
Move creation of context.root out of Context()

On btrfs systems, we're unnecessarily creating a subvolume only to
remove it again immediately afterwards if we're building from a cached
image. So let's move the creation of root outside of Context() so
we can only create it as a subvolume after we've potentially checked
caches first.

11 months agoDon't run run_clean() in a forked child anymore
Daan De Meyer [Thu, 22 Aug 2024 11:43:33 +0000 (13:43 +0200)] 
Don't run run_clean() in a forked child anymore

No need anymore so let's not fork unnecessarily.

11 months agoOptimize copy_tree() a little
Daan De Meyer [Thu, 22 Aug 2024 11:18:30 +0000 (13:18 +0200)] 
Optimize copy_tree() a little

Only run cp_version() if we absolutely need to. If we do a btrfs
snapshot or the destination does not exist or is empty, there's no
need to add --keep-directory-symlink and thus we don't need to run
cp_version() either.

11 months agoMerge pull request #2833 from DaanDeMeyer/azure
Daan De Meyer [Thu, 22 Aug 2024 10:51:56 +0000 (12:51 +0200)] 
Merge pull request #2833 from DaanDeMeyer/azure

Add support for Azure Linux

11 months agoAdd support for Azure Linux 2833/head
Daan De Meyer [Thu, 4 Jul 2024 12:34:17 +0000 (14:34 +0200)] 
Add support for Azure Linux

Azure Linux looks a lot like Fedora Linux so we opt to share configuration
between Azure and Fedora/CentOS and inherit the Azure definition from
Fedora.

11 months agoFix fixup_vmlinuz_location()
Daan De Meyer [Thu, 4 Jul 2024 12:30:52 +0000 (14:30 +0200)] 
Fix fixup_vmlinuz_location()

We have to resolve the path before we check if the symlink is relative
to /boot.

11 months agoSpecify --renumber-inodes when calling cpio
Daan De Meyer [Thu, 22 Aug 2024 08:22:41 +0000 (10:22 +0200)] 
Specify --renumber-inodes when calling cpio

This helps with making initrds reproducible as the sequence of inodes
will always be stable starting from 1.

11 months agoMerge pull request #2956 from DaanDeMeyer/var
Daan De Meyer [Thu, 22 Aug 2024 09:28:48 +0000 (11:28 +0200)] 
Merge pull request #2956 from DaanDeMeyer/var

Introduce mkosi-sandbox and stop using subuids for image builds

11 months agoIntroduce mkosi-sandbox and stop using subuids for image builds 2956/head
Daan De Meyer [Fri, 16 Aug 2024 21:41:49 +0000 (23:41 +0200)] 
Introduce mkosi-sandbox and stop using subuids for image builds

Over the last years, we've accumulated a rather nasty set of workarounds
for various issues in bubblewrap:

- We contributed setpgid to util-linux and use it if available because
  bubblewrap does not support making its child process the foreground
  process.
- We added the innerpid logic to run() because bubblewrap does not forward
  signals to the separate child process it runs in the sandbox which meant
  they were getting SIGKILLed when we killed bubblewrap, preventing proper
  cleanup from happening.
- bubblewrap does not provide a proper way to detect whether the command
  was found in the sandbox or not, which meant we had to execute command -v
  within the sandbox separately to check whether the command exists or not.
- We had to add extra logic to make sure / was a mount in the initramfs to
  allow running mkosi in the initramfs as bubblewrap does not fall back to
  MS_MOVE if pivot_root() doesn't work.
- We had to stitch together shell invocations after bubblewrap but before
  executing the actual command we want to run to make sure directories had
  the correct mode as bubblewrap creates everything with mode 0700 which was
  too restrictive in many cases for us. This was fixed with new --perms and
  --chmod options in bubblewrap 0.5 but we had to keep compat with 0.4
  because that's what's shipped in CentOS Stream 9.
- We had to figure out a shell hack to do overlayfs mounts as these are not
  supported by bubblewrap (even though a PR for the feature has been open for
  years).
- We had to introduce a Mount struct to pass around mounts so we could deduplicate
  and sort them before passing them to bubblewrap as bubblewrap did not do this
  itself.
- Debugging all the above was made all the harder by the fact that bubblewrap's
  source code is full of tech debt from its history of being a setuid tool
  instead of using user namespaces. Getting any fixes into upstream is almost
  impossible as the tool is practically unmaintained.

Aside from bubblewrap, our other source of troubles has been newuidmap/newgidmap.
Running as a user within the subuid range configured in /etc/sub{u,g}id has
meant we're constantly fixing ownership and permissions issues where stuff needs
to be chowned and chmodded everywhere to make sure the current user and the
subuid user can access the proper files. Another unfortunate side effect is that
users end up with many files owned by the subuid root user in their home
directories when building images with mkosi;

Let's fix all these issues at once by getting rid of bubblewrap and
newuidmap/newgidmap.

bubblewrap is replaced with a new tool mkosi-sandbox. It looks and behaves a
lot like bubblewrap, except it's much less code and much more flexible to fit
our needs, allowing us to get rid of all the hacks we've built up over the years to
work around issues that didn't get fixed in bubblewrap.

To get rid of newuidmap/newgidmap, a rework of our user namespacing was needed.
The need to use newuidmap/newgidmap came from the assumption that we need a full
65k subuid range to do unprivileged image builds, as distributions ship packages
containing files and directories that are not owned by the root user. After some
investigation, it turns out that there's very few files and directories not owned
by root in distribution packages if you ignore /var. If we could temporarily
ignore the ownership on these files and directories until we can get distributions
to only ship root owned files in /usr and /etc of their packages, we could simply
map the current user to root in a user namespace and get rid of the subuid range
completely.

Turns out that's possible with a seccomp filter. seccomp allows you to make all
chown() syscalls succeed without actually doing anything. The files and directories
end up owned by the root user instead. If we assume this is OK and are OK with
instructing users to use tmpfiles to fix up the permissions on first boot if needed,
a seccomp filter like this is sufficient to allow us to get rid of doing image
builds within a subuid user namespace.

It turns out we can go one step further. It turns out that for the majority of
the image build, one doesn't actually need to be the root user. Only package
managers and systemd-repart need the current user to be mapped to root to do their
job correctly. The reason we did the entire build mapped to root until now was
that we need to do a few mounts as part of the image build process and for now
I was under the assumption that you needed to be root for that. It turns out that
when you unshare a user namespace, you get a full set of capabilities regardless
of whether you're root or some other uid in the user namespace. The only difference
is that when you exec a subprocess as root, the capabilities aren't lost, whereas
they are when you exec a subprocess as a non-root user. This can be avoided by
adding the capabilities of the non-root user to the inheritable and ambient set.
Once that's done, any subprocess exec'd by a non-root user in the user namespace
can mount as many bind and overlay mounts as they can think of.

The above allows us to run most of the image build under the current user uid
instead of root, only switching to root when running package managers, invoking
systemd-repart or systemd-tmpfiles, or when chroot-ing into the image. This allows
us to get rid of various hacks we had to look up the proper user name or home
directory.

Specifically, we can get rid of the following:

- mkosi-as-caller can become a noop since we now by default run the build as the
  caller.
- Lots of chmod()'s and chown()'s can be removed
- All uses of INVOKING_USER.uid/gid can be removed, and most can be replaced with
  simple os.getuid()/os.getgid()
- We can use /etc/passwd and /etc/group from the host instead of building our own
- We can get rid of the Acl= option as the user will now be able to remove (almost)
  all files written by mkosi.
- We don't have to rchown the package manager cache directory anymore after each
  build. Root user builds will now use the system cache instead of the per user
  cache.
- We can get rid of the Mount struct as mkosi-sandbox dedups and sorts operations
  itself.

One thing to note is that if we're invoked as root, none of the seccomp or capabilities
stuff applies and it is all skipped as it's not required in that case. This means that
when building as root it's still possible to have more than one user in the generated
image unlike when building unprivileged. Also note that users can still be added to
/etc/passwd and such, they just can't own any files or directories in the image itself
until the image is booted.

11 months agoSet DEFAULT_HOSTNAME in os-release when specified (fixes #2673)
Septatrix [Tue, 20 Aug 2024 19:05:02 +0000 (21:05 +0200)] 
Set DEFAULT_HOSTNAME in os-release when specified (fixes #2673)

11 months agoapt: Remove mounts argument from invoke()
Daan De Meyer [Wed, 21 Aug 2024 06:17:51 +0000 (08:17 +0200)] 
apt: Remove mounts argument from invoke()

11 months agoMerge pull request #2954 from NekkoDroid/executable-mkosi-version
Daan De Meyer [Tue, 20 Aug 2024 10:42:17 +0000 (12:42 +0200)] 
Merge pull request #2954 from NekkoDroid/executable-mkosi-version

Add executable `mkosi.version` support for generating the version dynamically

11 months agoClean up version bump logic 2954/head
Michael Ferrari [Wed, 14 Aug 2024 20:19:00 +0000 (22:19 +0200)] 
Clean up version bump logic

11 months agoAdd executable `mkosi.version` support
Michael Ferrari [Wed, 7 Aug 2024 09:37:48 +0000 (11:37 +0200)] 
Add executable `mkosi.version` support

`mkosi.version` is executed during configuration parsing, as opposed
to reading the contents of `mkosi.version`. This allows querying the
version before the build without needing to manually adjust the version
beforehand.

This allows using date based versioning by writing a script outputting
`date '+%Y-%m-%d'` or using git tag based versioning by outputting
`git describe --tags`.

11 months agoDo not generate random seed when running bootctl install
Daan De Meyer [Mon, 19 Aug 2024 13:15:40 +0000 (15:15 +0200)] 
Do not generate random seed when running bootctl install

11 months agoDon't include excluded subimages in default dependencies
Daan De Meyer [Mon, 19 Aug 2024 11:22:54 +0000 (13:22 +0200)] 
Don't include excluded subimages in default dependencies

11 months agoMerge pull request #2959 from DaanDeMeyer/split
Jörg Behrmann [Mon, 19 Aug 2024 08:53:13 +0000 (10:53 +0200)] 
Merge pull request #2959 from DaanDeMeyer/split

Various improvements

11 months agoci: Add missing shebangs 2959/head
Daan De Meyer [Fri, 16 Aug 2024 22:47:56 +0000 (00:47 +0200)] 
ci: Add missing shebangs

No clue how this worked before.

11 months agoci: Improve formatting a bit
Daan De Meyer [Fri, 16 Aug 2024 22:47:17 +0000 (00:47 +0200)] 
ci: Improve formatting a bit

11 months agomkosi-initrd: Remove /var/cache/ldconfig/aux-cache
Daan De Meyer [Sun, 18 Aug 2024 12:54:10 +0000 (14:54 +0200)] 
mkosi-initrd: Remove /var/cache/ldconfig/aux-cache

The file is not reproducible so let's remove it so that reproducible
initrds can be built by default.

Fixes #2957

12 months agoSet SYSTEMD_IN_CHROOT for package managers
Daan De Meyer [Fri, 16 Aug 2024 21:41:00 +0000 (23:41 +0200)] 
Set SYSTEMD_IN_CHROOT for package managers

systemd's built-in chroot detection doesn't work when unprivileged
so tell it explicitly that we're in a chroot.

12 months agoOptimize remove_files()
Daan De Meyer [Fri, 16 Aug 2024 08:30:04 +0000 (10:30 +0200)] 
Optimize remove_files()

12 months agoOptimize clean_package_manager_metadata()
Daan De Meyer [Fri, 16 Aug 2024 08:29:33 +0000 (10:29 +0200)] 
Optimize clean_package_manager_metadata()

12 months agokali: A distribution based on Debian: https://www.kali.org/
Andreas Oberritter [Thu, 4 Jul 2024 08:28:46 +0000 (10:28 +0200)] 
kali: A distribution based on Debian: https://www.kali.org/

Kali includes many packages suitable for offensive security tasks.
It follows a rolling release model and serves fewer architectures
than Debian.

Building a kali image requires installing kali-archive-keyring:
- Source: https://gitlab.com/kalilinux/packages/kali-archive-keyring
- Packages: https://pkg.kali.org/pkg/kali-archive-keyring

12 months agoCheck for required tools earlier
Daan De Meyer [Mon, 12 Aug 2024 09:55:53 +0000 (11:55 +0200)] 
Check for required tools earlier

Let's check for required tools before we run sync or configure scripts
so that all required tools are checked before we actually use them.

12 months agoAlways specify _sourcedir as an absolute path
Daan De Meyer [Mon, 12 Aug 2024 10:08:06 +0000 (12:08 +0200)] 
Always specify _sourcedir as an absolute path

Relative _sourcedir was never supported by rpm:
https://github.com/rpm-software-management/rpm/issues/3208#issuecomment-2283520243

12 months agoFix loaded host modules filter
Markus Weippert [Sat, 10 Aug 2024 07:36:56 +0000 (09:36 +0200)] 
Fix loaded host modules filter

Module filenames might use dashes instead of underscores.
Also, anchoring the filename to a directory avoids including unrelated
modules (e.g. exfat vs fat).

12 months agoAdd --wipe-build-dir to allow clearing the build directory independently
Daan De Meyer [Fri, 9 Aug 2024 10:15:09 +0000 (12:15 +0200)] 
Add --wipe-build-dir to allow clearing the build directory independently

Currently, to clear the build directory, -ff has to be used which
also clears the image cache. Let's add --wipe-build-dir (-w) to allow
clearing only the build directory without clearing the image cache.

12 months agoMerge pull request #2946 from bluca/os_release
Luca Boccassi [Thu, 8 Aug 2024 13:25:53 +0000 (15:25 +0200)] 
Merge pull request #2946 from bluca/os_release

os-release fixes for Debian and derivatives

12 months agodistributions: drop Debian workaround for lack of VERSION_CODENAME 2946/head
Luca Boccassi [Wed, 7 Aug 2024 22:39:06 +0000 (23:39 +0100)] 
distributions: drop Debian workaround for lack of VERSION_CODENAME

It has been present since Debian 9, so we can rely on it now.
It is wrong on sid, but that's a separate issue that this old
workaround doesn't solve anyway.

12 months agodistributions: try reading /etc/os-release first
Luca Boccassi [Wed, 7 Aug 2024 22:35:39 +0000 (23:35 +0100)] 
distributions: try reading /etc/os-release first

It might be a local modification by an image builder, read it first
as per specification instructions

12 months agoMerge pull request #2947 from DaanDeMeyer/debian
Luca Boccassi [Thu, 8 Aug 2024 12:00:11 +0000 (14:00 +0200)] 
Merge pull request #2947 from DaanDeMeyer/debian

debian: Fix up os-release for unstable/sid builds

12 months agodebian: Fix up os-release for unstable/sid builds 2947/head
Daan De Meyer [Thu, 8 Aug 2024 11:09:46 +0000 (13:09 +0200)] 
debian: Fix up os-release for unstable/sid builds

The version codename for unstable/sid builds is indistinguishable from
testing. Let's make sure we fix that up ourselves so that unstable image
builds can be properly distinguished from testing builds.

12 months agoCheck /etc/os-release as well in configure_os_release()
Daan De Meyer [Thu, 8 Aug 2024 11:09:02 +0000 (13:09 +0200)] 
Check /etc/os-release as well in configure_os_release()

It might not be a symlink. If that's the case, fix it up as well.

12 months agoMerge pull request #2944 from DaanDeMeyer/fix
Daan De Meyer [Wed, 7 Aug 2024 05:34:46 +0000 (07:34 +0200)] 
Merge pull request #2944 from DaanDeMeyer/fix

Don't pass down empty lists to subimages unless explicitly configured

12 months agoDon't pass down empty lists to subimages unless explicitly configured 2944/head
Daan De Meyer [Tue, 6 Aug 2024 07:57:46 +0000 (09:57 +0200)] 
Don't pass down empty lists to subimages unless explicitly configured

This makes sure that subimages use default values for list based
settings unless they were explicitly configured in configuration or
on the command line or have a non-empty default value in the main
image.

Fixes #2874

12 months agoDon't use for loop to create subimages in test
Daan De Meyer [Tue, 6 Aug 2024 07:56:56 +0000 (09:56 +0200)] 
Don't use for loop to create subimages in test

This gives us more flexibility in configuring the individual subimages.

12 months agoStore finalized values only on config object
Daan De Meyer [Tue, 6 Aug 2024 07:55:56 +0000 (09:55 +0200)] 
Store finalized values only on config object

This allows us to use context.config to determine whether a value
was specified in a configuration file or not.

12 months agoStore default values in separate namespace
Daan De Meyer [Tue, 6 Aug 2024 07:55:01 +0000 (09:55 +0200)] 
Store default values in separate namespace

This allows us to check whether a value was explicitly configured
in configuration files or on the CLI.

12 months agoProperly escape paths in virtiofsd scope names
Daan De Meyer [Mon, 5 Aug 2024 14:04:47 +0000 (16:04 +0200)] 
Properly escape paths in virtiofsd scope names

12 months agoClarify that inherited settings take priority over CLI/main settings
Daan De Meyer [Mon, 5 Aug 2024 12:24:41 +0000 (14:24 +0200)] 
Clarify that inherited settings take priority over CLI/main settings

If "inherited" settings are configured explicitly in subimages, those
values should take priority over values configured in the main config
and CLI.

12 months agoMake `{SYSEXT,CONFEXT}_SCOPE` configurable
Michael Ferrari [Mon, 5 Aug 2024 08:53:45 +0000 (10:53 +0200)] 
Make `{SYSEXT,CONFEXT}_SCOPE` configurable

By setting `SYSEXT_SCOPE` and `CONFEXT_SCOPE` environment variables the
values to write to the extension-release file can be configured.

12 months agoMerge pull request #2941 from DaanDeMeyer/scope
Daan De Meyer [Mon, 5 Aug 2024 10:43:15 +0000 (12:43 +0200)] 
Merge pull request #2941 from DaanDeMeyer/scope

Make ImageId= and ImageVersion= overridable by subimages

12 months agoAllow SectorSize= to be overridden by subimages 2941/head
Daan De Meyer [Mon, 5 Aug 2024 08:46:46 +0000 (10:46 +0200)] 
Allow SectorSize= to be overridden by subimages

Fixes #2939

12 months agoMake ImageId= and ImageVersion= overridable by subimages
Daan De Meyer [Mon, 5 Aug 2024 08:15:11 +0000 (10:15 +0200)] 
Make ImageId= and ImageVersion= overridable by subimages

Fixes #2938

12 months agoIntroduce SettingScope
Daan De Meyer [Mon, 5 Aug 2024 08:10:54 +0000 (10:10 +0200)] 
Introduce SettingScope

Let's also have a concept of inheritable settings which are inherited
by subimages but can be overridden.

12 months agoAdd "Building vagrant images with mkosi" to the readme
Daan De Meyer [Fri, 2 Aug 2024 18:39:50 +0000 (20:39 +0200)] 
Add "Building vagrant images with mkosi" to the readme

12 months agoMerge pull request #2935 from DaanDeMeyer/repository-key-fetch
Daan De Meyer [Fri, 2 Aug 2024 19:20:46 +0000 (21:20 +0200)] 
Merge pull request #2935 from DaanDeMeyer/repository-key-fetch

Enable RepositoryKeyFetch= by default on Ubuntu without a tools tree

12 months agoEnable RepositoryKeyFetch= by default on Ubuntu without a tools tree 2935/head
Daan De Meyer [Fri, 2 Aug 2024 08:14:49 +0000 (10:14 +0200)] 
Enable RepositoryKeyFetch= by default on Ubuntu without a tools tree

Ubuntu does not have distribution-gpg-keys yet, so let's enable
RepositoryKeyFetch= for it by default when a tools tree is not used.

12 months agoUse debian as the default tools tree again on Ubuntu
Daan De Meyer [Fri, 2 Aug 2024 08:13:20 +0000 (10:13 +0200)] 
Use debian as the default tools tree again on Ubuntu

Debian has distribution-gpg-keys which Ubuntu doesn't. As we'll likely
keep running into similar scenarios in the future, let's just stick with
Debian as Ubuntu's default tools tree.

12 months agoExit early if output format is none and there are no build scripts
Daan De Meyer [Fri, 2 Aug 2024 11:16:17 +0000 (13:16 +0200)] 
Exit early if output format is none and there are no build scripts

In systemd, the build script is part of a subimage so the build is
done as part of the subimage and there's nothing to do for the main
image. To speed things up a bit, exit early if there are no build
scripts and the output format is none.

12 months agoMerge pull request #2931 from DaanDeMeyer/debian
Jörg Behrmann [Fri, 2 Aug 2024 08:03:42 +0000 (10:03 +0200)] 
Merge pull request #2931 from DaanDeMeyer/debian

 Introduce RepositoryKeyFetch=

12 months agoIntroduce RepositoryKeyFetch= 2931/head
Daan De Meyer [Thu, 1 Aug 2024 10:37:50 +0000 (12:37 +0200)] 
Introduce RepositoryKeyFetch=

This setting controls whether we'll fetch GPG keys remotely or not.
We disable it by default so that we only rely on locally available GPG
keys for checking package and repository metadata signatures.

This new setting only affects dnf/zypper based distributions as apt
and pacman do not support retrieving GPG keys remotely in the first
place.

zypper does not trust GPG keys listed in gpgkey= by default so we import
local GPG keys manually with rpm to work around that.

Fixes #757

12 months agotests: Reduce duplication
Daan De Meyer [Thu, 1 Aug 2024 14:38:30 +0000 (16:38 +0200)] 
tests: Reduce duplication

Let's reduce the amount of duplication in the tests.

12 months agotests: Pass host environment when invoking mkosi
Daan De Meyer [Thu, 1 Aug 2024 14:37:14 +0000 (16:37 +0200)] 
tests: Pass host environment when invoking mkosi

12 months agoOnly use unshare to become root if we're actually going to use a scope
Daan De Meyer [Thu, 1 Aug 2024 14:35:36 +0000 (16:35 +0200)] 
Only use unshare to become root if we're actually going to use a scope

If the relevant environment variables are not set, scope_cmd() will
return an empty list and we won't use a scope after all. In that case
we don't need to use unshare either to become root and can rely on our
own become_root() function so check whether we're actually going to use
a scope or not.

12 months agotests: Simplify initrd tests
Daan De Meyer [Thu, 1 Aug 2024 13:26:32 +0000 (15:26 +0200)] 
tests: Simplify initrd tests

Let's get rid of the fixtures and just rely on the default initrd
built as part of the image itself. This also means any settings
picked up from mkosi.local.conf are applied to the initrd build.

12 months agoBump redhat-plumbers-in-action/differential-shellcheck
dependabot[bot] [Thu, 1 Aug 2024 22:38:02 +0000 (22:38 +0000)] 
Bump redhat-plumbers-in-action/differential-shellcheck

Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 5.3.0 to 5.4.0.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/redhat-plumbers-in-action/differential-shellcheck/compare/60c9f2b924a9c5a2ddbb25e7b23e8e11b56faab9...cc6721c45a8800cc666de45493545a07a638d121)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
12 months agoBump github/codeql-action from 3.25.11 to 3.25.15
dependabot[bot] [Thu, 1 Aug 2024 22:37:58 +0000 (22:37 +0000)] 
Bump github/codeql-action from 3.25.11 to 3.25.15

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.11 to 3.25.15.
- [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/b611370bb5703a7efb587f9d136a52ea24c5c38c...afb54ba388a7dca6ecae48f608c4ff05ff4cc77a)

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

Signed-off-by: dependabot[bot] <support@github.com>
12 months agotests: Drop workaround for older Ubuntu
Daan De Meyer [Thu, 1 Aug 2024 13:13:24 +0000 (15:13 +0200)] 
tests: Drop workaround for older Ubuntu

12 months agoci: add nop versions of all scripts to our integration tests
Jörg Behrmann [Thu, 1 Aug 2024 07:53:38 +0000 (09:53 +0200)] 
ci: add nop versions of all scripts to our integration tests

12 months agoopensuse: Rename gpgurls to gpgkeys
Daan De Meyer [Thu, 1 Aug 2024 10:32:13 +0000 (12:32 +0200)] 
opensuse: Rename gpgurls to gpgkeys

12 months agoFix RepositoryKeyCheck docs
Daan De Meyer [Thu, 1 Aug 2024 09:44:28 +0000 (11:44 +0200)] 
Fix RepositoryKeyCheck docs

12 months agoInstall distribution-gpg-keys in Debian/Ubuntu tools tree if available
Daan De Meyer [Thu, 1 Aug 2024 09:11:16 +0000 (11:11 +0200)] 
Install distribution-gpg-keys in Debian/Ubuntu tools tree if available

It recently got into debian testing so let's add it to the tools tree.

12 months agoUse apt search patterns a little more
Daan De Meyer [Thu, 1 Aug 2024 09:10:13 +0000 (11:10 +0200)] 
Use apt search patterns a little more

Let's use apt search patterns more to match packages that are only
available on specific ubuntu/debian releases.

12 months agoMerge pull request #2929 from DaanDeMeyer/fixes
Daan De Meyer [Thu, 1 Aug 2024 08:55:45 +0000 (10:55 +0200)] 
Merge pull request #2929 from DaanDeMeyer/fixes

Two fixes

12 months agoDon't try to chmod /tmp if it's being bind mounted in 2929/head
Daan De Meyer [Thu, 1 Aug 2024 07:45:01 +0000 (09:45 +0200)] 
Don't try to chmod /tmp if it's being bind mounted in

12 months agoHandle SIGHUP as well
Daan De Meyer [Thu, 1 Aug 2024 07:44:29 +0000 (09:44 +0200)] 
Handle SIGHUP as well

Let's do a graceful shutdown on SIGHUP as well.

12 months agoStop always setting autologin credentials
Daan De Meyer [Wed, 31 Jul 2024 14:53:13 +0000 (16:53 +0200)] 
Stop always setting autologin credentials

Let's require users to set these automatically if they want to
have autologin without enabling the Autologin= setting. This gives
more flexibility after https://github.com/systemd/systemd/pull/33873
is merged in systemd as users can choose to enable the settings
globally or per tty depending on what they need.

12 months agoMerge pull request #2924 from DaanDeMeyer/kernel-install
Daan De Meyer [Tue, 30 Jul 2024 06:11:31 +0000 (08:11 +0200)] 
Merge pull request #2924 from DaanDeMeyer/kernel-install

Set up proper environment variables for kernel-install

12 months agoBump version to 25~devel
Daan De Meyer [Mon, 29 Jul 2024 19:14:20 +0000 (21:14 +0200)] 
Bump version to 25~devel

12 months agoRelease 24.3 v24.3
Daan De Meyer [Mon, 29 Jul 2024 19:14:20 +0000 (21:14 +0200)] 
Release 24.3