]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
3 months agoImprove Ssh= documentation 3661/head
Nils K [Tue, 15 Apr 2025 16:47:25 +0000 (18:47 +0200)] 
Improve Ssh= documentation

Let's make the phrasing a bit clearer and easier to digest

Co-authored-by: Jörg Behrmann <behrmann@physik.fu-berlin.de>
3 months agoAdd new Ssh=auto and Ssh=runtime options
Septatrix [Mon, 7 Apr 2025 15:33:54 +0000 (17:33 +0200)] 
Add new Ssh=auto and Ssh=runtime options

Fixes #3654

4 months agoFix ToolsTreeRepositories= scope
Daan De Meyer [Mon, 7 Apr 2025 08:00:25 +0000 (10:00 +0200)] 
Fix ToolsTreeRepositories= scope

4 months agoAllow --rerun-build-scripts in combination with none output
Daan De Meyer [Sun, 6 Apr 2025 16:40:30 +0000 (18:40 +0200)] 
Allow --rerun-build-scripts in combination with none output

To make the logic work without being able to check if the output
exists or not, we simply never write the history if --rerun-build-scripts
if specified with the none output format.

4 months agoobs: fix sign-efi-sig-list parameter format
Luca Boccassi [Fri, 4 Apr 2025 23:51:22 +0000 (00:51 +0100)] 
obs: fix sign-efi-sig-list parameter format

It wants a date in the format Y-m-d H:M:S rather than unix seconds.
Also if SOURCE_DATE_EPOCH is not defined, use actual epoch, as the
timestamps must match when creating the signature and when attaching
it

4 months agoDrop ToolsTreeSyncScripts= and ToolsTreePrepareScripts=
Daan De Meyer [Fri, 4 Apr 2025 07:47:59 +0000 (09:47 +0200)] 
Drop ToolsTreeSyncScripts= and ToolsTreePrepareScripts=

These are not in an official release yet, and can be configured via
mkosi.tools.conf now with their regular setting alternatives, so let's
drop these.

4 months agoMerge pull request #3592 from septatrix/persisten-drives
Daan De Meyer [Fri, 4 Apr 2025 07:46:34 +0000 (09:46 +0200)] 
Merge pull request #3592 from septatrix/persisten-drives

4 months agoSet MKOSI_DEBUG instead of DEBUG
Daan De Meyer [Thu, 3 Apr 2025 15:14:37 +0000 (17:14 +0200)] 
Set MKOSI_DEBUG instead of DEBUG

DEBUG is very generic and can picked up by anything, but sometimes
with drastically different meanings to what is supposed to be in the
environment variable value.

For example the xfstests configure script expects DEBUG to contain
compiler options, which makes it break in extremely hard to debug
ways if we set DEBUG ourselves to a boolean value.

Let's namespace this to avoid conflicts.

4 months agoMark scratch disk as nocow 3592/head
Septatrix [Thu, 3 Apr 2025 15:02:19 +0000 (17:02 +0200)] 
Mark scratch disk as nocow

4 months agoInclude machine_or_name in drive filename
Septatrix [Thu, 3 Apr 2025 14:53:01 +0000 (16:53 +0200)] 
Include machine_or_name in drive filename

4 months agoRevert "qemu: Remove unused argument from finalize_drive()"
Septatrix [Tue, 18 Mar 2025 16:59:48 +0000 (17:59 +0100)] 
Revert "qemu: Remove unused argument from finalize_drive()"

This reverts commit 3e850db2bb5b4ad93742b844bb3f74f2c61f8b62.

4 months agoMake Drive= flags more general
Septatrix [Fri, 14 Mar 2025 11:36:43 +0000 (12:36 +0100)] 
Make Drive= flags more general

4 months agoMerge pull request #3646 from aafeijoo-suse/initrd-vconsole-ubuntu
Daan De Meyer [Thu, 3 Apr 2025 07:46:37 +0000 (09:46 +0200)] 
Merge pull request #3646 from aafeijoo-suse/initrd-vconsole-ubuntu

4 months agomkosi-initrd: refactor add_raid_config -> raid_config 3646/head
Antonio Alvarez Feijoo [Thu, 3 Apr 2025 05:55:46 +0000 (07:55 +0200)] 
mkosi-initrd: refactor add_raid_config -> raid_config

4 months agomkosi-initrd: fix vconsole configuration for Ubuntu
Antonio Alvarez Feijoo [Thu, 3 Apr 2025 05:52:34 +0000 (07:52 +0200)] 
mkosi-initrd: fix vconsole configuration for Ubuntu

Ubuntu (and Debian?) installs `/etc/vconsole.conf` as a dangling symlink to
`/etc/default/keyboard`, and that causes the `mkosi-initrd` build to fail.

```
\u2023  Copying in extra file trees\u2026
cp: not writing through dangling symlink '/work/var/tmp/mkosi-workspace-us4prlhz/root/etc/vconsole.conf'
\u2023 "cp --recursive --no-dereference --preserve=mode,links --reflink=auto --copy-contents /work/etc/default/keyboard /work/var/tmp/mkosi-workspace-us4prlhz/root/etc/vconsole.conf" returned non-zero exit code 1.
bash-5.2# ls -l /work/var/tmp/mkosi-workspace-us4prlhz/root/etc/vconsole.conf
lrwxrwxrwx 1 0 0 16 Apr  2 14:49 /work/var/tmp/mkosi-workspace-us4prlhz/root/etc/vconsole.conf -> default/keyboard
bash-5.2# ls -l /work/var/tmp/mkosi-workspace-us4prlhz/root/etc/default/keyboard
ls: cannot access '/work/var/tmp/mkosi-workspace-us4prlhz/root/etc/default/keyboard': No such file or directory
```

4 months agoDon't chdir() to mkosi/ subdirectory
Daan De Meyer [Wed, 2 Apr 2025 12:01:06 +0000 (14:01 +0200)] 
Don't chdir() to mkosi/ subdirectory

Changing the working directory to mkosi/ is not intuitive. We want
to parse configuration from there, but the working directory should
not change (e.g. you don't want mkosi sandbox to execute inside the
mkosi/ subdirectory when invoked in the top level directory).

4 months agomkosi-initrd: copy local vconsole configuration
Antonio Alvarez Feijoo [Wed, 2 Apr 2025 10:02:39 +0000 (12:02 +0200)] 
mkosi-initrd: copy local vconsole configuration

Otherwise it can be very hard to enter a password set on the host using a
keyboard with some specific language layout.

4 months agoMerge pull request #3643 from DaanDeMeyer/subdir
Jörg Behrmann [Wed, 2 Apr 2025 11:12:26 +0000 (13:12 +0200)] 
Merge pull request #3643 from DaanDeMeyer/subdir

Use mkosi/ subdirectory if no configuration exists in cwd

4 months agoUse mkosi/ subdirectory if no configuration exists in cwd 3643/head
Daan De Meyer [Wed, 2 Apr 2025 08:39:27 +0000 (10:39 +0200)] 
Use mkosi/ subdirectory if no configuration exists in cwd

In systemd we've ended up with a large amount of mkosi specific
files and directories in the top level of the repository. Let's allow
moving these to a mkosi/ directory by transparently picking this up.

4 months agobuild(deps): bump github/codeql-action from 3.28.10 to 3.28.13
dependabot[bot] [Tue, 1 Apr 2025 22:17:19 +0000 (22:17 +0000)] 
build(deps): bump github/codeql-action from 3.28.10 to 3.28.13

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.10 to 3.28.13.
- [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/b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d...1b549b9259bda1cb5ddde3b41741a82a2d15a841)

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

Signed-off-by: dependabot[bot] <support@github.com>
4 months agoMerge pull request #3641 from DaanDeMeyer/fix
Daan De Meyer [Tue, 1 Apr 2025 19:36:45 +0000 (21:36 +0200)] 
Merge pull request #3641 from DaanDeMeyer/fix

4 months agoDon't allow configuring distribution, release and mirror in tools tree config 3641/head
Daan De Meyer [Tue, 1 Apr 2025 18:37:52 +0000 (20:37 +0200)] 
Don't allow configuring distribution, release and mirror in tools tree config

config_default_repository_key_check() depends on ToolsTreeDistribution=
to select the right default. If the tools tree distribution is configured
in mkosi.tools.conf, we're unable to select the right default for
RepositoryKeyCheck= for the main image. Until we figure out a decent solution
for this, let's insist that the tools tree distribution is configured via
ToolsTreeDistribution=.

Similarly, selecting the default tools tree mirror depends on the selected
target distribution and mirror, so we insist on configuring the tools tree
mirror and release via ToolsTreeMirror= and ToolsTreeRelease= for now.

4 months agoFixes for config_default_repository_key_check()
Daan De Meyer [Tue, 1 Apr 2025 18:25:47 +0000 (20:25 +0200)] 
Fixes for config_default_repository_key_check()

Currently we assume fetching is not required if the host distribution
is not ubuntu, but this is wrong. If the host distribution is not ubuntu
but a ubuntu tools tree is used to build rpm based or Arch images, then
we still need key fetching.

Additionally, make RepositoryKeyFetch= a universal setting so that the
tools tree can have it enabled without enabling it for the main and subimages.
We then also drop the condition from config_default_repository_key_fetch()
that checks whether we need key fetching to build the tools tree distribution
because this will be determined automatically now when parsing the tools tree
config.

4 months agoFix typo
Daan De Meyer [Tue, 1 Apr 2025 13:33:58 +0000 (15:33 +0200)] 
Fix typo

We should append here since we modified it earlier, not override it.

4 months agoAllow configuring environment variables in tools tree config
Daan De Meyer [Tue, 1 Apr 2025 13:00:56 +0000 (15:00 +0200)] 
Allow configuring environment variables in tools tree config

4 months agoMerge pull request #3638 from DaanDeMeyer/fixes
Daan De Meyer [Tue, 1 Apr 2025 11:12:45 +0000 (13:12 +0200)] 
Merge pull request #3638 from DaanDeMeyer/fixes

Make sure /etc/ and /var/ always exist in sandbox

4 months agomkosi-obs: Only disable History= for main image 3638/head
Daan De Meyer [Tue, 1 Apr 2025 10:32:43 +0000 (12:32 +0200)] 
mkosi-obs: Only disable History= for main image

History= cannot be set anymore for subimages, so only disable it for
the main image.

4 months agoMake sure we chdir() to builtin config path before parsing
Daan De Meyer [Tue, 1 Apr 2025 10:30:19 +0000 (12:30 +0200)] 
Make sure we chdir() to builtin config path before parsing

4 months agoinitrd: Copy Arch Linux keyring from host when running as root
Daan De Meyer [Tue, 1 Apr 2025 08:49:44 +0000 (10:49 +0200)] 
initrd: Copy Arch Linux keyring from host when running as root

When running as root, we run with --cache-only=metadata, which means
we won't try to sync the keyring, so let's reuse the one from the host
to make sure that a keyring is available.

Fixes #3635

4 months agopacman: Don't mount keyring dir if it's empty
Daan De Meyer [Tue, 1 Apr 2025 08:49:04 +0000 (10:49 +0200)] 
pacman: Don't mount keyring dir if it's empty

This allows providing the keyring via sandbox trees which we'll make
use of in mkosi-initrd.

4 months agoFix test_tools on unknown distributions
Daan De Meyer [Tue, 1 Apr 2025 08:17:37 +0000 (10:17 +0200)] 
Fix test_tools on unknown distributions

4 months agoMake sure /etc/ and /var/ always exist in sandbox
Daan De Meyer [Tue, 1 Apr 2025 07:59:22 +0000 (09:59 +0200)] 
Make sure /etc/ and /var/ always exist in sandbox

Fixes #3637

4 months agoMerge pull request #3636 from DaanDeMeyer/tools
Daan De Meyer [Tue, 1 Apr 2025 07:57:16 +0000 (09:57 +0200)] 
Merge pull request #3636 from DaanDeMeyer/tools

Move default tools tree configuration to config.py

4 months agoAllow adding extra tools tree configuration via mkosi.tools.conf 3636/head
Daan De Meyer [Mon, 31 Mar 2025 12:37:27 +0000 (14:37 +0200)] 
Allow adding extra tools tree configuration via mkosi.tools.conf

Instead of adding ever more ToolsTreeXXX= settings, let's allow
adding extra tools tree configuration via mkosi.tools.conf which can
be either a file or a directory containing extra configuration for the
default tools tree.

4 months agoSwitch tools tree parsing to ParseContext
Daan De Meyer [Mon, 31 Mar 2025 08:46:41 +0000 (10:46 +0200)] 
Switch tools tree parsing to ParseContext

Default tools tree configuration currently depends on manually plumbing
through settings from the main configuration to the tools tree configuration.
This has already bitten us a few times where we forgot to add the necessary
plumbing when adding a new setting.

Instead, let's improve by encoding in the settings themselves whether they
apply to the tools tree or not. We call settings that apply to the tools tree
and all subimages "multiversal" settings (one step bigger than "universal"
settings).

For the tools tree specific settings (e.g. ToolsTreeDistribution= and friends),
we simply copy the fields from the main image configuration namespace to the tools
tree configuration namespace.

Additionally, we restrict which settings can be applied to the tools tree by
a new "tools" field for each setting which has to be set to True to make a setting
configurable in the default tools tree configuration.

Finally, we stop storing the tools tree specific settings in the main image config,
and instead store the tools tree configuration separately in the history JSON and
summary. This will allow us to add more ways to configure the default tools tree in
the future as well.

4 months agoci: Show summary
Daan De Meyer [Mon, 31 Mar 2025 12:49:23 +0000 (14:49 +0200)] 
ci: Show summary

4 months agoDisable orphan_file automatically if not supported
Daan De Meyer [Mon, 31 Mar 2025 10:43:50 +0000 (12:43 +0200)] 
Disable orphan_file automatically if not supported

Let's automatically detect if the orphan_file ext4 feature needs to
be disabled if it's not supported by the target distribution official
kernel.

4 months agoconfig: Use dicts everywhere in favor of argparse.Namespace()
Daan De Meyer [Sun, 30 Mar 2025 19:42:03 +0000 (21:42 +0200)] 
config: Use dicts everywhere in favor of argparse.Namespace()

These behave the same, except that argparse.Namespace() allows dot
based accessed to its keys and dict does not. Dot based access suggests
to the reader that a typed property is being accessed that definitely
exists, whereas that's anything but guaranteed when using argparse.Namespace().

Let's switch to using dicts everywhere so that whenever we access a
property, we do so in a way that suggests to the reader that we're doing
an untyped access into a dictionary.

4 months agoFix default values for key/certificate source parsers
Daan De Meyer [Sun, 30 Mar 2025 18:35:28 +0000 (20:35 +0200)] 
Fix default values for key/certificate source parsers

4 months agoDo not make directory, none and oci images bootable by default
Daan De Meyer [Sun, 30 Mar 2025 15:15:32 +0000 (17:15 +0200)] 
Do not make directory, none and oci images bootable by default

It's more likely to not want these bootable, so let's default to that
and drop the explicit disablement from mkosi-tools at the same time.

4 months agoDisable selinux relabeling by default for directory images
Daan De Meyer [Sun, 30 Mar 2025 15:10:00 +0000 (17:10 +0200)] 
Disable selinux relabeling by default for directory images

For directory images it's more likely to not want these selinux
relabeled, so let's default to that. Also drop the explicitly selinux
relabeling disablement from mkosi-tools.

4 months agomkosi-tools: Stop disabling ManifestFormat=
Daan De Meyer [Sun, 30 Mar 2025 15:03:07 +0000 (17:03 +0200)] 
mkosi-tools: Stop disabling ManifestFormat=

We don't produce a manifest by default these days so no need to
explicitly disable it.

4 months agomkosi-tools: Stop removing BuildSources=
Daan De Meyer [Sun, 30 Mar 2025 15:02:00 +0000 (17:02 +0200)] 
mkosi-tools: Stop removing BuildSources=

Tools tree prepare scripts are now a thing so it's possible to require
build sources for the default tools tree so let's stop removing them
unconditionally.

4 months agoresources: Fix up resources without parse_config()
Daan De Meyer [Sun, 30 Mar 2025 10:58:12 +0000 (12:58 +0200)] 
resources: Fix up resources without parse_config()

4 months agoconfig: Various cleanups for the directory attribute
Daan De Meyer [Sun, 30 Mar 2025 17:16:26 +0000 (19:16 +0200)] 
config: Various cleanups for the directory attribute

- Make sure it is always set and looked up on the config ns
- Make sure we set it before parsing includes from the command line

4 months agoconfig: Introduce ParseContext.finalize()
Daan De Meyer [Sun, 30 Mar 2025 10:57:53 +0000 (12:57 +0200)] 
config: Introduce ParseContext.finalize()

4 months agoMake CompressLevel= an inherited setting
Daan De Meyer [Sat, 29 Mar 2025 12:20:53 +0000 (13:20 +0100)] 
Make CompressLevel= an inherited setting

4 months agoIntroduce 'main' setting scope
Daan De Meyer [Sat, 29 Mar 2025 12:06:29 +0000 (13:06 +0100)] 
Introduce 'main' setting scope

There's a bunch of settings that aren't universal but also don't make
sense to be configured in subimages, so let's add a new 'main' setting
scope that disallows configuring these settings in subimages without
passing them to subimages.

4 months agoStore tools and initrd profiles as a list of strings
Daan De Meyer [Sat, 29 Mar 2025 11:38:14 +0000 (12:38 +0100)] 
Store tools and initrd profiles as a list of strings

There's no benefit to storing these as a list of enums, so let's
get rid of that and store these as a list of strings like we store
regular profiles.

4 months agoRename paths, recursive_paths to path_suffixes, recursive_path_suffixes
Daan De Meyer [Sat, 29 Mar 2025 09:01:49 +0000 (10:01 +0100)] 
Rename paths, recursive_paths to path_suffixes, recursive_path_suffixes

This reduces duplication and allows us to make the prefix configurable
in a later commit.

4 months agoMake passed environment variables an inherited setting
Daan De Meyer [Fri, 28 Mar 2025 20:43:53 +0000 (21:43 +0100)] 
Make passed environment variables an inherited setting

4 months agoRemove unneeded default factory depends from ToolsTreeDistribution
Daan De Meyer [Fri, 28 Mar 2025 19:50:17 +0000 (20:50 +0100)] 
Remove unneeded default factory depends from ToolsTreeDistribution

The default tools tree distribution does not depend on the selected
target distribution anymore.

4 months agoDo not pass --incremental=no explicitly to default tools tree
Daan De Meyer [Fri, 28 Mar 2025 19:26:33 +0000 (20:26 +0100)] 
Do not pass --incremental=no explicitly to default tools tree

It's the default value for --incremental=.

4 months agoMove default tools tree parsing to parse_config()
Daan De Meyer [Fri, 28 Mar 2025 19:22:54 +0000 (20:22 +0100)] 
Move default tools tree parsing to parse_config()

4 months agoMerge pull request #3634 from aafeijoo-suse/env-debug
Daan De Meyer [Fri, 28 Mar 2025 19:06:55 +0000 (20:06 +0100)] 
Merge pull request #3634 from aafeijoo-suse/env-debug

4 months agomkosi: pass DEBUG enviroment variable to scripts 3634/head
Antonio Alvarez Feijoo [Fri, 28 Mar 2025 14:53:10 +0000 (15:53 +0100)] 
mkosi: pass DEBUG enviroment variable to scripts

So scripts can run debugging code if mkosi is running with `--debug`.

4 months agoman: sort table with environment variables received by scripts
Antonio Alvarez Feijoo [Fri, 28 Mar 2025 14:49:22 +0000 (15:49 +0100)] 
man: sort table with environment variables received by scripts

4 months agoAllow combining --force and --rerun-build-scripts
Daan De Meyer [Fri, 28 Mar 2025 09:19:29 +0000 (10:19 +0100)] 
Allow combining --force and --rerun-build-scripts

Until now we didn't allow this, but it turns out there's actually
a use case for this, build the image if it doesn't exist yet, reuse
the existing image otherwise.

4 months agomkosi-initrd: fix misleading "mkosi not found" error message
Antonio Alvarez Feijoo [Fri, 28 Mar 2025 09:19:48 +0000 (10:19 +0100)] 
mkosi-initrd: fix misleading "mkosi not found" error message

There is a special handling when a script under /work fails with 127, which is
also reached when mkosi is called within mkosi-initrd.

```
‣ Running finalize script /etc/mkosi-initrd/mkosi.finalize…
/work/finalize: line 5: strip: command not found
‣ /work/finalize failed with non-zero exit code 127
‣ (Maybe a program was not found or the script interpreter (e.g. bash) is not installed?)
‣ mkosi not found.
```

4 months agoMerge pull request #3631 from DaanDeMeyer/local
Daan De Meyer [Thu, 27 Mar 2025 17:33:35 +0000 (18:33 +0100)] 
Merge pull request #3631 from DaanDeMeyer/local

4 months agopacman: Always bind mount /var/lib/pacman/local from sandbox 3631/head
Daan De Meyer [Thu, 27 Mar 2025 16:27:02 +0000 (17:27 +0100)] 
pacman: Always bind mount /var/lib/pacman/local from sandbox

We want any writes to /var/lib/pacman/local to go to any configured
overlayfs on /buildroot, instead of going directly to the
/var/lib/pacman/local directory which might be a lowerdir in the
overlayfs if one is used. Let's implement this by simply specifying
a path relative to the sandbox instead of specifying the path on the
host.

Fixes #3625

4 months agosandbox: Allow taking bind source paths relative to the sandbox root
Daan De Meyer [Thu, 27 Mar 2025 16:26:42 +0000 (17:26 +0100)] 
sandbox: Allow taking bind source paths relative to the sandbox root

4 months agomkosi-initrd: Add amd_atl to default modules
Daan De Meyer [Thu, 27 Mar 2025 14:16:31 +0000 (15:16 +0100)] 
mkosi-initrd: Add amd_atl to default modules

Another harmless CPU module without any dependencies that gets loaded
by default.

4 months agoconfig: explicitly type make_simple_config_parser to work with dataclasses
Jörg Behrmann [Thu, 27 Mar 2025 13:07:52 +0000 (14:07 +0100)] 
config: explicitly type make_simple_config_parser to work with dataclasses

4 months agoconfig: Cache lookups of fields
Daan De Meyer [Thu, 27 Mar 2025 10:43:23 +0000 (11:43 +0100)] 
config: Cache lookups of fields

We were calling inspect.signature() > 4000 times because it was evaluated
over and over again in the list comprehensions. Move the fields lookup into
a cached classmethod where possible to make sure we only do it once.

This reduces the time needed to parse the systemd config from history from
1.18s => 188ms on my machine.

4 months agomkosi-initrd: add key files for crypttab entries
Antonio Alvarez Feijoo [Thu, 27 Mar 2025 09:52:33 +0000 (10:52 +0100)] 
mkosi-initrd: add key files for crypttab entries

Handle at least absolute paths and the automatic
`/etc/cryptsetup-keys.d/<volume>.key` search path.

4 months agoMerge pull request #3626 from UweSauter/only-force-clean-tools
Daan De Meyer [Thu, 27 Mar 2025 08:34:04 +0000 (09:34 +0100)] 
Merge pull request #3626 from UweSauter/only-force-clean-tools

Only force clean tools tree

4 months agoFormatting correction. 3626/head
Uwe Sauter [Wed, 26 Mar 2025 20:51:55 +0000 (21:51 +0100)] 
Formatting correction.

4 months agomkosi clean will now require --force in order to remove the tools tree.
Uwe Sauter [Wed, 26 Mar 2025 20:49:34 +0000 (21:49 +0100)] 
mkosi clean will now require --force in order to remove the tools tree.

Single source code change. Related documentation updates.
Also unrelated typo fix for ToolsSyncScripts=, --tools-tree-sync-script=.

4 months agocentos: Add hyperscale-packages-kernel repository
Daan De Meyer [Wed, 26 Mar 2025 15:43:12 +0000 (16:43 +0100)] 
centos: Add hyperscale-packages-kernel repository

4 months agoMerge pull request #3622 from DaanDeMeyer/tools
Daan De Meyer [Wed, 26 Mar 2025 09:37:38 +0000 (10:37 +0100)] 
Merge pull request #3622 from DaanDeMeyer/tools

4 months agoqemu: Set device_id for scsi-hd and scsi-cd devices 3622/head
Daan De Meyer [Wed, 26 Mar 2025 09:25:35 +0000 (10:25 +0100)] 
qemu: Set device_id for scsi-hd and scsi-cd devices

When we used -drive this was done automatically but that's not the
case anymore with -blockdev, so do it explicitly ourselves.

4 months agoMake Profiles= an inherited setting
Daan De Meyer [Wed, 26 Mar 2025 08:59:18 +0000 (09:59 +0100)] 
Make Profiles= an inherited setting

4 months agoSkip a few steps when we're building a default tools tree
Daan De Meyer [Wed, 26 Mar 2025 08:27:04 +0000 (09:27 +0100)] 
Skip a few steps when we're building a default tools tree

None of these steps matter for tools trees so let's skip them when
we know we're building a default tools tree.

4 months agoDon't cache the package manager used in the tools tree cache manifest
Daan De Meyer [Tue, 25 Mar 2025 21:13:42 +0000 (22:13 +0100)] 
Don't cache the package manager used in the tools tree cache manifest

Doing this causes issues when using mkosi sandbox as have_cache(tools)
will be different inside and outside of the sandbox when building Fedora
and only dnf is available outside the sandbox but dnf5 is available inside
the sandbox. Since we don't need to cache the package manager used anyway
when building the default tools tree because we don't cache the package
manager metadata either, don't cache it to avoid this problem.

4 months agoImplement ToolsTreeSyncScripts=
Daan De Meyer [Tue, 25 Mar 2025 19:28:51 +0000 (20:28 +0100)] 
Implement ToolsTreeSyncScripts=

In systemd, we have prepare scripts for the build image to install
all the build dependencies of the corresponding distribution's systemd
packaging spec. The distribution packaging spec is checked out by a sync
script.

We also need the systemd build dependencies installed in the default tools
tree in systemd, so that we can build all the systemd tools required to build
the image in the tools tree as well to later be used to build the image. Currently
we list the the required dependencies manually as packages since we can't reuse
the prepare script from the build image as the sync scripts run after the default
tools tree has been built which means we can't depend on the packaging specs
being available when building the default tools tree.

Let's fix the issue by introducing ToolsTreeSyncScripts= to define sync scripts
to run before building the default tools tree.

4 months agoMerge pull request #3618 from DaanDeMeyer/tmpfiles
Daan De Meyer [Tue, 25 Mar 2025 19:16:57 +0000 (20:16 +0100)] 
Merge pull request #3618 from DaanDeMeyer/tmpfiles

4 months agoAdd mkosi init to install a tmpfiles dropin for the cache dir 3618/head
Daan De Meyer [Tue, 25 Mar 2025 15:17:39 +0000 (16:17 +0100)] 
Add mkosi init to install a tmpfiles dropin for the cache dir

Let's clean up packages after they haven't been touched for 90
days.

Note that this has to be explicitly enabled by users by running mkosi
init for now. In the future we can look into automatically enabling
this.

4 months agoman/mkosi-initrd: document "pkcs11" profile
Antonio Alvarez Feijoo [Tue, 25 Mar 2025 15:07:27 +0000 (16:07 +0100)] 
man/mkosi-initrd: document "pkcs11" profile

Follow-up for a63dd993db1dd7e58ff86ac75780fb4ad39a923c

4 months agoDrop logic for using /root/.cache
Daan De Meyer [Tue, 25 Mar 2025 15:42:38 +0000 (16:42 +0100)] 
Drop logic for using /root/.cache

Let's just have root use the cache in /var/cache/mkosi to avoid accidentally
leaking files into /root/.cache accidentally where it's much less likely that
they'll ever get cleaned up.

4 months agoMerge pull request #3616 from DaanDeMeyer/sandbox
Daan De Meyer [Tue, 25 Mar 2025 15:01:11 +0000 (16:01 +0100)] 
Merge pull request #3616 from DaanDeMeyer/sandbox

Make sure tools tree recorded in history doesn't change when in sandbox

4 months agoMake sure tools tree recorded in history doesn't change when in sandbox 3616/head
Daan De Meyer [Tue, 25 Mar 2025 13:41:26 +0000 (14:41 +0100)] 
Make sure tools tree recorded in history doesn't change when in sandbox

Currently, when in the sandbox, the tools tree will always be recorded
as "null" in the history. This causes problems if an image build is done
inside of mkosi sandbox and mkosi is later invoked outside of the sandbox
as the history will say no tools tree was used and so the tools tree won't
be used, even if we're running outside of the sandbox.

To fix the issue, let's make sure we always record the proper tools tree,
but let's not make use of it in the sandbox by moving the sandbox check to
the Config object's tools() method.

We also simplify all the tools tree related checks in run_verb() and add a
check to make sure we don't try to rebuild the default tools tree when in
"mkosi sandbox" as that can't ever work.

4 months agoStore default tools tree outside of output directory
Daan De Meyer [Tue, 25 Mar 2025 14:20:12 +0000 (15:20 +0100)] 
Store default tools tree outside of output directory

A common workflow is to build the same image multiple times with
slightly different settings, using a different output directory for
each build. By storing the default tools tree inside the configured
output directory, we end up rebuilding the tools tree for every single
one of these builds, even though in almost all cases the tools tree for
each image will be identical.

Let's address this issue by not storing the default tools tree in the
configured output directory but instead storing it in the current working
directory.

4 months agoinitrd: Move p11-kit to pksc11 profile
Daan De Meyer [Tue, 25 Mar 2025 12:54:39 +0000 (13:54 +0100)] 
initrd: Move p11-kit to pksc11 profile

This stuff is rather niche, so let's move it to a profile similar to
lvm and raid.

4 months agoMerge pull request #3613 from DaanDeMeyer/build
Daan De Meyer [Mon, 24 Mar 2025 11:15:35 +0000 (12:15 +0100)] 
Merge pull request #3613 from DaanDeMeyer/build

tools: Add "devel" profile

4 months agotools: Add "devel" profile 3613/head
Daan De Meyer [Mon, 24 Mar 2025 10:52:39 +0000 (11:52 +0100)] 
tools: Add "devel" profile

This profile contains tools required to build C/C++ projects. This is
useful to use mkosi sandbox to quickly build one off projects without
having to list a bunch of basic packages over and over again.

4 months agotools: Add 3 more packages to misc profile
Daan De Meyer [Mon, 24 Mar 2025 10:46:22 +0000 (11:46 +0100)] 
tools: Add 3 more packages to misc profile

4 months agoMerge pull request #3612 from DaanDeMeyer/fixes
Daan De Meyer [Mon, 24 Mar 2025 10:32:12 +0000 (11:32 +0100)] 
Merge pull request #3612 from DaanDeMeyer/fixes

4 months agoAlways cache the default tools tree 3612/head
Daan De Meyer [Mon, 24 Mar 2025 09:31:43 +0000 (10:31 +0100)] 
Always cache the default tools tree

For the default tools tree, the cached image and the final image
are the same for all intents and purposes, so let's stop storing both
a cached image and a final image for the default tools tree and instead
only store the final image and use it as the cached image by always
writing a cache manifest next to it.

At the same time always use the name mkosi.tools to reduce the chance
of conflicts as "tools" is an incredibly common directory name.

4 months agouser: Replace INVOKING_USER.name() with getpass.getuser()
Daan De Meyer [Sun, 23 Mar 2025 14:25:25 +0000 (15:25 +0100)] 
user: Replace INVOKING_USER.name() with getpass.getuser()

4 months agorun: Bind mount entire /home into relaxed sandbox
Daan De Meyer [Sat, 22 Mar 2025 12:07:19 +0000 (13:07 +0100)] 
run: Bind mount entire /home into relaxed sandbox

Let's simplify things and make the entirety of /home available. The
relaxed sandbox is not about security, and permissions already make sure
only the user's own home can be accessed.

4 months agouser: Make INVOKING_USER.cache_dir() return the user cache directory
Daan De Meyer [Sat, 22 Mar 2025 11:51:12 +0000 (12:51 +0100)] 
user: Make INVOKING_USER.cache_dir() return the user cache directory

4 months agouser: Replace INVOKING_USER.home() with Path.home()
Daan De Meyer [Sat, 22 Mar 2025 11:49:24 +0000 (12:49 +0100)] 
user: Replace INVOKING_USER.home() with Path.home()

4 months agoMake sync script sandbox more relaxed
Daan De Meyer [Sat, 22 Mar 2025 11:23:37 +0000 (12:23 +0100)] 
Make sync script sandbox more relaxed

Let's simplify and mount in the entirety of /home, /run and the
invoking user's environment to make stuff just work more often than
not and avoid too many implementation details of specific tools leaking
into mkosi itself.

4 months agouser: Make INVOKING_USER.runtime_dir() return the user runtime dir
Daan De Meyer [Sat, 22 Mar 2025 10:51:36 +0000 (11:51 +0100)] 
user: Make INVOKING_USER.runtime_dir() return the user runtime dir

Let's not return the mkosi specific directory, but the wider runtime
directory.

4 months agoFix grub.cfg install path on almalinux
ppira [Fri, 21 Mar 2025 14:41:58 +0000 (15:41 +0100)] 
Fix grub.cfg install path on almalinux

4 months agodocs: Mention mkosi -t none in rpm doc
Daan De Meyer [Fri, 21 Mar 2025 14:19:48 +0000 (15:19 +0100)] 
docs: Mention mkosi -t none in rpm doc

4 months agoImplement linux-noinitrd firmware
Daan De Meyer [Thu, 20 Mar 2025 13:20:50 +0000 (14:20 +0100)] 
Implement linux-noinitrd firmware

Useful for direct kernel booting without an initrd even if one was
built.

4 months agokmod: Include all kernel modules if no include patterns were specified
Daan De Meyer [Thu, 20 Mar 2025 08:49:15 +0000 (09:49 +0100)] 
kmod: Include all kernel modules if no include patterns were specified

Fixes #3603

4 months agoMerge pull request #3601 from DaanDeMeyer/fix
Zbigniew Jędrzejewski-Szmek [Wed, 19 Mar 2025 16:23:40 +0000 (17:23 +0100)] 
Merge pull request #3601 from DaanDeMeyer/fix

Various kmod fixes