Daan De Meyer [Thu, 13 Mar 2025 14:35:49 +0000 (15:35 +0100)]
fedora: Change default release to rawhide
Fedora releases new versions quite regularly, sometimes more regularly
than we do mkosi releases. This means that users on the latest official
mkosi release can end up building EOL fedora releases because the default
release will be the latest fedora release at the time of the mkosi release
which might be EOL already. Let's switch to rawhide as the default release
so users are guaranteed to get something recent regardless of how old their
mkosi version is.
This matches what we already do for debian, opensuse, arch and other distros.
Both styles were used by the existing code: ['--foo=bar'] and ['--foo', 'bar'].
Switch to the former exclusively. A single arg like '--foo=bar' is easier to
read and/or select&paste in the log output. Also, we avoid explicit str()
wrappers in a bunch of places.
Daan De Meyer [Tue, 11 Mar 2025 20:12:11 +0000 (21:12 +0100)]
Try to find volatile overlay upperdir directory that's not on overlayfs
Making a directory on overlayfs the upperdir of another overlayfs is
rejected by the kernel. Let's try to find a directory that's not on
overlayfs. The /dev/shm fallback is because on a default podman container
even /tmp is on overlayfs.
Daan De Meyer [Thu, 6 Mar 2025 22:47:33 +0000 (23:47 +0100)]
Rework --run-build-scripts
Instead of (optionally) building the image when this option is enabled,
let's insist that the image has already been built and cached. This allows
us to reuse the history of the previous build if History= is enabled. At
the same time, rename the option to --rerun-build-scripts to indicate more
clearly that the image needs to have been built once already.
This allows the option to be used in systemd's mkosi.clangd script to replace
"-t none" and "--incremental=strict" there.
Daan De Meyer [Wed, 5 Mar 2025 19:32:58 +0000 (20:32 +0100)]
Move package installation and removal to PackageManager interface
There's no need for these to be implemented by the Distribution
interface as they don't need distribution specific knowledge so let's
move them to the PackageManager interface instead.
Daan De Meyer [Wed, 5 Mar 2025 18:59:26 +0000 (19:59 +0100)]
debian: Install policy-rcd-declarative by default
Debian switched to systemd ages ago, but as we know legacy stuff
tends to linger in Debian for quite a while. Let's standardize on
using systemd presets to enable daemons by installing packages for
a deny-all policy for sysv-init style packages instead of messing
with the script ourselves.
Daan De Meyer [Tue, 4 Mar 2025 08:21:25 +0000 (09:21 +0100)]
centos: Handle major/minor releases in derivatives properly
While centos doesn't have major/minor releases, rocky, alma and rhel
do, so let's make sure we handle those cases properly.
Additionally, we also fix EPEL to use the proper major/minor release
when we're doing EPEL 10, as since EPEL 10 there's major/minor releases
for EPEL as well.
Septatrix [Sun, 2 Mar 2025 20:53:09 +0000 (21:53 +0100)]
Parse both mkosi.local.conf and mkosi.local/
This aligns more with what the users expects
and allows working around some limitations of the config system
(esp. regarding the interplay of `Include=` and `Profiles=`).
Enable only the initrd profiles specified with this option, rather than all by
default. This saves space and allows the user to choose only what is needed on
each system.
Daan De Meyer [Wed, 26 Feb 2025 13:42:12 +0000 (14:42 +0100)]
Implement build overlay mounting with mkosi-sandbox
Now that we have Context.rootoptions(), we can switch out how we set
up the root mount without having to modify code all over the place.
Let's use this to get rid of mount_build_overlay() and instead replace
it with setup_build_overlay(), which simply configures a bunch of
fields on Context that make rootoptions() set up the root mount as an
overlay instead of a bind mount.
Daan De Meyer [Wed, 26 Feb 2025 11:14:38 +0000 (12:14 +0100)]
Introduce --run-build-scripts (-R) to always run build scripts
Currently we run "mkosi -t none" in systemd and mkosi-kernel to run
the build script(s) without rebuilding the entire image. Using the
"none" output format for this purpose is a hack. It also breaks when
using History=yes as running mkosi -t none will change the output
format in the history after which running mkosi qemu will fail saying
it can't boot the "none" output format.
Let's introduce a --run-build-scripts argument which will make us always
run the build scripts regardless of whether the image has already been
built or not. At the same time, remove various behaviors from the "none"
format that were solely added to enable the hack of using it to run build
scripts without rebuilding the image:
- Clean up outputs from the previous build when the "none" output format
is used
Luca Boccassi [Tue, 25 Feb 2025 14:05:33 +0000 (14:05 +0000)]
mkosi-obs: support multiple mkosi.postoutput invocations
When multiple images are built mkosi.postoutput runs once
per image, so add access to output directory and ensure
the hashes.cpio.rsasign archive accumulates the hashes for
all images before proceeding to the next stage
Luca Boccassi [Tue, 25 Feb 2025 11:40:02 +0000 (11:40 +0000)]
mkosi-obs: fix compression detection
The recompress variable is not reset in the loop, so if
there is a compressed ddi and an uncompressed one, the
variable will be true for the second one. Reset it.
Daan De Meyer [Tue, 25 Feb 2025 17:46:16 +0000 (18:46 +0100)]
Enable Hyperscale rpm COW plugin
The CentOS Hyperscale SIG provides rpm/dnf plugins to enable rpm
COW which drastically speeds up image builds so let's ship the
necessary logic to make use of it when building images with the
Hyperscale experimental repositories.
Luca Boccassi [Tue, 25 Feb 2025 00:11:46 +0000 (00:11 +0000)]
mkosi-obs: sign bootloaders in ESPs
If there are bootloaders in the ESP(s), sign them too. Useful to
ensure everything is signed also with the certificate in the project
where the image is built.
Daan De Meyer [Sun, 23 Feb 2025 15:20:53 +0000 (16:20 +0100)]
Specify --suppress-sync when running package managers
Package managers tend to make sure of sync() and friends to ensure
that any files they write are actually written to disk. This is
important when a package manager is used to do system package upgrades,
but is unnecessary when using package managers to build OS images. So
let's make sync() and friends a noop when we invoke package managers
Daan De Meyer [Fri, 21 Feb 2025 09:57:39 +0000 (10:57 +0100)]
Reduce the number of filesystems we remount noexec/nosuid/nodev when root
For mkosi-initrd, /etc might very well contain executable scripts which
we should allow to run, so let's only mount /boot and /efi nodev/nosuid/noexec.
Philip Molloy [Thu, 20 Feb 2025 13:49:26 +0000 (14:49 +0100)]
README: Reference EXAMPLES and mkosi documentation
Generally, examples are a great way to get started with a new tool.
Additionally, there does not appear to be formal getting started
documentation for mkosi.
Daan De Meyer [Wed, 19 Feb 2025 14:21:18 +0000 (15:21 +0100)]
Clean up default tools tree package lists
- util-linux is not needed anymore since we do mounts ourselves now
- dpkg is pulled in by apt on arch and we don't list it explicitly elsewhere
- glibc-gconv-modules-extra should be pulled in by something else on opensuse by now
- python3-cryptography is only required on ubuntu, rest already has a dependency on
it in systemd-ukify or is already on systemd v257 which doesn't need it anymore
- libarchive-tools seems like a leftover that isn't installed anywhere else
Daan De Meyer [Wed, 19 Feb 2025 11:39:06 +0000 (12:39 +0100)]
mkosi-tools: Split off misc, package-manager and runtime profiles
Let's make the dependencies verb a little more flexible by splitting
off various profiles in mkosi-tools, the misc, package-manager and
runtime profiles. The misc profile contains all the useful tools we
install to make sure they're available in scripts. The package manager
contains non-native package managers and related tools. The runtime
profile contains all the tools required to boot images. The regular
configuration now only includes the tools required to build native images
with mkosi.
The default tools tree still includes both the misc, package-manager and
runtime profiles by default but the list of profiles can be changed with
the new ToolsTreeProfiles= setting. The dependencies verb includes neither
profile, but we now allow passing arbitrary settings to the dependency verb
as arguments so that packages from additional profiles can be requested if
needed.