]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
5 weeks agoDo not try to install packages that are listed in RemovePackages= 3797/head
DaanDeMeyer [Sat, 5 Jul 2025 14:09:38 +0000 (16:09 +0200)] 
Do not try to install packages that are listed in RemovePackages=

This allows using RemovePackages= in mkosi.local.conf to prevent
certain packages listed in the regular configuration from being
installed in the first place.

We also add RemovePackages= to the cache manifest because it now
affects the cached images.

5 weeks agopacman: Don't fail if packages to remove aren't installed
DaanDeMeyer [Sat, 5 Jul 2025 19:08:32 +0000 (21:08 +0200)] 
pacman: Don't fail if packages to remove aren't installed

We already do this for other package managers, let's do it for pacman
as well.

5 weeks agoMerge pull request #3793 from bluca/ppc_s390_build
Luca Boccassi [Sat, 5 Jul 2025 13:36:40 +0000 (14:36 +0100)] 
Merge pull request #3793 from bluca/ppc_s390_build

Make ppc64le/s390x buildable

5 weeks agoopensuse: pull in grep/gzip/xz explicitly to avoid busybox in main image 3793/head
Luca Boccassi [Fri, 4 Jul 2025 13:36:12 +0000 (14:36 +0100)] 
opensuse: pull in grep/gzip/xz explicitly to avoid busybox in main image

Problem: 1: the installed busybox-xz-1.37.0-34.1.noarch conflicts with 'xz' provided by the to be installed xz-5.8.1-1.1.aarch64
 Solution 1: deinstallation of busybox-xz-1.37.0-34.1.noarch
 Solution 2: do not install xz-5.8.1-1.1.aarch64

5 weeks agogha: do not fail if kvm/vhost are not available
Luca Boccassi [Wed, 2 Jul 2025 18:14:48 +0000 (19:14 +0100)] 
gha: do not fail if kvm/vhost are not available

On ppc64le/s390x runners there's no kvm/vhost

5 weeks agoMove efi-specific packages to efi-specific config files
Luca Boccassi [Wed, 2 Jul 2025 20:23:49 +0000 (21:23 +0100)] 
Move efi-specific packages to efi-specific config files

5 weeks agoopensuse: add ppc64le/s390x definitions
Luca Boccassi [Wed, 2 Jul 2025 21:45:28 +0000 (22:45 +0100)] 
opensuse: add ppc64le/s390x definitions

The repository URLs are a bit weird and do not match 1:1 with architecture
names

5 weeks agoSupport matching against architectures with uefi support
DaanDeMeyer [Sat, 5 Jul 2025 07:49:18 +0000 (09:49 +0200)] 
Support matching against architectures with uefi support

5 weeks agoRename sandbox verb to box
DaanDeMeyer [Fri, 4 Jul 2025 18:38:35 +0000 (20:38 +0200)] 
Rename sandbox verb to box

It's both shorter, and doesn't give the wrong impression that this
is about security sandboxing, so let's rename the sandbox name to
just box. Keep the old name as well of course for compat.

5 weeks agoFix /var/tmp directory cleanup
DaanDeMeyer [Thu, 3 Jul 2025 11:45:22 +0000 (13:45 +0200)] 
Fix /var/tmp directory cleanup

Currently, if /work does not exist, we go into the exception handler which
doesn't do anything if the errno is ENOENT, even though we still need to
remove the parent directory.

5 weeks agobuild(deps): bump github/codeql-action from 3.28.18 to 3.29.2
dependabot[bot] [Tue, 1 Jul 2025 22:38:22 +0000 (22:38 +0000)] 
build(deps): bump github/codeql-action from 3.28.18 to 3.29.2

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.18 to 3.29.2.
- [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/ff0a06e83cb2de871e5a09832bc6a81e7276941f...181d5eefc20863364f96762470ba6f862bdef56b)

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

Signed-off-by: dependabot[bot] <support@github.com>
5 weeks agoMerge pull request #3788 from DaanDeMeyer/opensc
Daan De Meyer [Wed, 2 Jul 2025 05:55:37 +0000 (07:55 +0200)] 
Merge pull request #3788 from DaanDeMeyer/opensc

5 weeks agotests: Skip test_tools() when in sandbox 3788/head
DaanDeMeyer [Tue, 1 Jul 2025 20:44:46 +0000 (22:44 +0200)] 
tests: Skip test_tools() when in sandbox

If we're running inside mkosi sandbox, we don't parse the default
tools tree configuration, which this test depends on, so skip it
when running in the sandbox.

5 weeks agoRevert "Make user provided command line take preference over roothash="
DaanDeMeyer [Tue, 1 Jul 2025 07:22:11 +0000 (09:22 +0200)] 
Revert "Make user provided command line take preference over roothash="

This reverts commit 5a15c7d31d097a11f83cfae664b0b7bb40100fc3.

5 weeks agomkosi-tools: Make sure opensc module is registered with p11-kit
DaanDeMeyer [Mon, 30 Jun 2025 21:38:01 +0000 (23:38 +0200)] 
mkosi-tools: Make sure opensc module is registered with p11-kit

Otherwise openssl will fail to load keys off a yubikey when using
pkcs11-provider. For more discussion and why this isn't the default
everywhere, see https://gitlab.archlinux.org/archlinux/packaging/packages/opensc/-/issues/2.

5 weeks agoresources: Make sure scripts are made executable in as_file()
DaanDeMeyer [Tue, 1 Jul 2025 20:03:00 +0000 (22:03 +0200)] 
resources: Make sure scripts are made executable in as_file()

We don't have access to permissions from the Traversables so we check
for a shebang in each file instead.

5 weeks agoas_file() backport improvements
DaanDeMeyer [Tue, 1 Jul 2025 19:42:12 +0000 (21:42 +0200)] 
as_file() backport improvements

- Simplify
- Fully type
- Move to mkosi.resources

We're going to extend it in the next commit, so no point in keeping
it the same as upstream anymore.

6 weeks agoMerge pull request #3783 from DaanDeMeyer/syntax-warning
Jörg Behrmann [Wed, 25 Jun 2025 13:39:07 +0000 (15:39 +0200)] 
Merge pull request #3783 from DaanDeMeyer/syntax-warning

Three fixes

6 weeks agoMake /etc/machine-id from host available in relaxed sandbox as well 3783/head
Daan De Meyer [Wed, 25 Jun 2025 12:04:58 +0000 (14:04 +0200)] 
Make /etc/machine-id from host available in relaxed sandbox as well

6 weeks agoMake sure various host files are added to every relaxed sandbox
Daan De Meyer [Wed, 25 Jun 2025 12:04:14 +0000 (14:04 +0200)] 
Make sure various host files are added to every relaxed sandbox

Let's not just make these available to mkosi sandbox, but to every
other relaxed sandbox we set up as well.

6 weeks agosandbox: Work around extra file descriptor opened by importing ctypes since python...
Daan De Meyer [Wed, 25 Jun 2025 10:47:56 +0000 (12:47 +0200)] 
sandbox: Work around extra file descriptor opened by importing ctypes since python 3.14

Since python 3.14, importing ctypes opens an extra file descriptor which is used to allocate libffi
closures which are in turn used by ctypes to pass python functions as C callback function pointers. We
don't use this functionality, yet the file descriptor is still opened and messes with the file descriptor
packing logic since the file descriptor to libffi will be passed as a packed file descriptor to the
executable we're invoking. To avoid that from happening, we close libffi's file descriptor after importing
ctypes.

See https://github.com/python/cpython/issues/135893.

6 weeks agosandbox: Fix typo
Daan De Meyer [Fri, 20 Jun 2025 15:25:37 +0000 (17:25 +0200)] 
sandbox: Fix typo

7 weeks agoMerge pull request #3780 from bluca/defer_compress
Luca Boccassi [Sun, 22 Jun 2025 09:45:34 +0000 (10:45 +0100)] 
Merge pull request #3780 from bluca/defer_compress

Fix combining compression and skipping partitions (for signing)

7 weeks agomkosi-obs: support splitting out and compressing partitions 3780/head
Luca Boccassi [Sat, 21 Jun 2025 16:54:48 +0000 (17:54 +0100)] 
mkosi-obs: support splitting out and compressing partitions

Need to recompress the verity-sig partition after creating it,
and deleting the non-compressed split out partitions that are
already present as compressed but that sd-repart re-creates
when doing the signature attach operation.

7 weeks agocompress: do not attempt to compress skipped partitions
Luca Boccassi [Sat, 21 Jun 2025 16:53:39 +0000 (17:53 +0100)] 
compress: do not attempt to compress skipped partitions

When doing offline verity signing, split partitions and compression are
enabled, we attempt to compress a non-existing partition (verity-sig)
which will be created only later.
Do not attempt to compress partitions that are marked to be skipped by
repart.

7 weeks agoDo not use return in finally
Daan De Meyer [Fri, 20 Jun 2025 13:54:34 +0000 (15:54 +0200)] 
Do not use return in finally

This triggers a syntax warning on recent versions of python.

7 weeks agoEnsure directories exist before running sync scripts
Daan De Meyer [Fri, 20 Jun 2025 08:46:12 +0000 (10:46 +0200)] 
Ensure directories exist before running sync scripts

run_sync_scripts() assumes the workspace directory exists but we only
create it later on at the moment. Let's create directories before running
sync scripts to fix this issue.

Replaces #3776

8 weeks agoMerge pull request #3749 from DaanDeMeyer/tools-etc
Daan De Meyer [Mon, 16 Jun 2025 15:44:32 +0000 (16:44 +0100)] 
Merge pull request #3749 from DaanDeMeyer/tools-etc

Bind mount /etc from tools tree into relaxed sandbox

8 weeks agomkosi-obs: also allow enrolling additional certs in KEK
Luca Boccassi [Sun, 15 Jun 2025 22:52:01 +0000 (23:52 +0100)] 
mkosi-obs: also allow enrolling additional certs in KEK

Same as db, useful to be able to get DBX updates

8 weeks agoinitrd: Copy /etc/pki/rpm-gpg into sandbox tree
Daan De Meyer [Sun, 15 Jun 2025 19:50:39 +0000 (20:50 +0100)] 
initrd: Copy /etc/pki/rpm-gpg into sandbox tree

Repos from /etc/yum.repos.d might be signed by keys from /etc/pki/rpm-gpg
so make sure we copy those into the sandbox tree as well.

Fixes #3767

8 weeks agoBind mount /etc from tools tree into relaxed sandbox 3749/head
Daan De Meyer [Thu, 29 May 2025 14:20:54 +0000 (16:20 +0200)] 
Bind mount /etc from tools tree into relaxed sandbox

Config from /etc often references stuff in /usr. Two examples I've
encountered are shell config from /etc/profile and dnf5 blowing up
when there's plugin configuration in /etc without the corresponding
plugin being installed.

To work around such issues, let's use /etc from the tools tree in the
relaxed sandbox instead of /etc from the host. This also saves the user
from having to create directories in their host's /etc to be able to use
mkosi sandbox.

2 months agoPartially revert "resources: add systemd-boot-efi"
Luca Boccassi [Sun, 8 Jun 2025 13:18:53 +0000 (14:18 +0100)] 
Partially revert "resources: add systemd-boot-efi"

systemd-boot-efi is only available for EFI architectures, but
we use mkosi to do the integration tests on all architectures,
so this commit breaks them:

5044s E: Package 'systemd-boot-efi' has no installation candidate

https://autopkgtest.ubuntu.com/results/autopkgtest-noble-upstream-systemd-ci-systemd-ci/noble/s390x/s/systemd-upstream/20250608_124726_4f883@/log.gz

This package should not be included in the initrd anyway, it's
only needed at build time, not inside the initrd

This reverts commit 9a0d8a8906695a35011ecfd81b36fe82c1577488.

2 months agotest: Make sure lvm doesn't try to modify /etc
Daan De Meyer [Thu, 5 Jun 2025 13:02:57 +0000 (15:02 +0200)] 
test: Make sure lvm doesn't try to modify /etc

2 months agoCheck that keys are both in context.cli and history
Daan De Meyer [Wed, 4 Jun 2025 14:18:37 +0000 (16:18 +0200)] 
Check that keys are both in context.cli and history

Otherwise we'll get a KeyError trying to access a key in the history
dict that isn't there.

Fixes #3747.

2 months agofix: Remove `erofs-utils` from initrd
Xavier Moffett [Fri, 30 May 2025 00:34:06 +0000 (20:34 -0400)] 
fix: Remove `erofs-utils` from initrd

No longer necessary, since fsck is no longer invoked by systemd for
read-only filesystems. This fixes a bug causing the initrd stage
of Ubuntu images to fail.

2 months agoMerge pull request #3759 from behrmann/cidebug
Daan De Meyer [Wed, 4 Jun 2025 14:45:16 +0000 (16:45 +0200)] 
Merge pull request #3759 from behrmann/cidebug

2 months agomkosi-initrd: Add atkbd and i8042 modules to the default initrd modules
Daan De Meyer [Sun, 1 Jun 2025 20:03:49 +0000 (22:03 +0200)] 
mkosi-initrd: Add atkbd and i8042 modules to the default initrd modules

Required to get my laptop keyboard working in an initrd with just
the default modules.

2 months agoGenerate initrds outside of umask context manager
Septatrix [Wed, 28 May 2025 17:08:31 +0000 (19:08 +0200)] 
Generate initrds outside of umask context manager

2 months agoci: Drop differential shellcheck
Daan De Meyer [Wed, 4 Jun 2025 14:04:33 +0000 (16:04 +0200)] 
ci: Drop differential shellcheck

We already run shellcheck on all scripts as part of the main CI job,
so we don't really get any benefit of a differential shellcheck as all
our code is already checked by shellcheck so let's just drop it.

2 months agobuild(deps): bump github/codeql-action from 3.28.16 to 3.28.18
dependabot[bot] [Sun, 1 Jun 2025 23:02:37 +0000 (23:02 +0000)] 
build(deps): bump github/codeql-action from 3.28.16 to 3.28.18

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.16 to 3.28.18.
- [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/28deaeda66b76a05916b6923827895f2b14ab387...ff0a06e83cb2de871e5a09832bc6a81e7276941f)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 months agoRevert to btrfs for fedora and openuse 3759/head
Jörg Behrmann [Wed, 4 Jun 2025 14:00:20 +0000 (16:00 +0200)] 
Revert to btrfs for fedora and openuse

This was accidentaly committed.

2 months agoresources: add systemd-boot-efi
Jörg Behrmann [Wed, 4 Jun 2025 09:04:26 +0000 (11:04 +0200)] 
resources: add systemd-boot-efi

Since
https://salsa.debian.org/systemd-team/systemd/-/commit/a4bdf87f03e06fe687f0bf7596af31d0f2ac80b1
systemd-boot is not pulled in automatically by systemd-boot anymore

2 months agoMerge pull request #3750 from DaanDeMeyer/tools-tree-profiles
Daan De Meyer [Wed, 4 Jun 2025 13:55:54 +0000 (15:55 +0200)] 
Merge pull request #3750 from DaanDeMeyer/tools-tree-profiles

mkosi-tools: Introduce debug and gui profiles to reduce the number of packages installed by default

2 months agomkosi-tools: Install udev in opensuse tools trees 3750/head
Daan De Meyer [Wed, 4 Jun 2025 13:03:47 +0000 (15:03 +0200)] 
mkosi-tools: Install udev in opensuse tools trees

Ships bootctl these days.

2 months agomkosi-tools: Switch to dnf5 on Arch Linux
Daan De Meyer [Thu, 29 May 2025 08:43:56 +0000 (10:43 +0200)] 
mkosi-tools: Switch to dnf5 on Arch Linux

2 months agomkosi-tools: Remove unnecessary directory
Daan De Meyer [Thu, 29 May 2025 08:42:16 +0000 (10:42 +0200)] 
mkosi-tools: Remove unnecessary directory

2 months agomkosi-tools: Introduce debug profile and move perf to it
Daan De Meyer [Thu, 29 May 2025 08:36:29 +0000 (10:36 +0200)] 
mkosi-tools: Introduce debug profile and move perf to it

perf pulls in a ton of dependencies (> 100 extra packages on Fedora).
Let's introduce a separate debug profile and move perf to it to avoid
everyone having to pull in all these packages for a tool they most likely
won't use.

Add gdb as well while we're at it.

2 months agomkosi-tools: Add new gui profile
Daan De Meyer [Thu, 29 May 2025 08:29:56 +0000 (10:29 +0200)] 
mkosi-tools: Add new gui profile

Let's not install all the tools required to run with a gui by default
into the tools tree, as this is more of a niche use case.

2 months agoci: Use ext4 temporarily
Daan De Meyer [Thu, 29 May 2025 18:01:16 +0000 (20:01 +0200)] 
ci: Use ext4 temporarily

The commit causing https://lore.kernel.org/linux-fsdevel/20250115185608.GA2223535@zen.localdomain/T/#u
got backported to the ubuntu stable kernel. While it has been reverted
upstream, the revert still hasn't reached the ubuntu stable kernel,
so let's use ext4 temporarily until that's the case.

2 months agoconfig: Remove redundant cast
Daan De Meyer [Thu, 29 May 2025 14:35:08 +0000 (16:35 +0200)] 
config: Remove redundant cast

2 months agoMerge pull request #3743 from behrmann/doctoolsformat
Daan De Meyer [Thu, 29 May 2025 13:43:50 +0000 (15:43 +0200)] 
Merge pull request #3743 from behrmann/doctoolsformat

2 months agoman: write command line more consistently 3743/head
Jörg Behrmann [Wed, 28 May 2025 08:05:54 +0000 (10:05 +0200)] 
man: write command line more consistently

2 months agoman: remove spuriours colon
Jörg Behrmann [Tue, 27 May 2025 15:33:00 +0000 (17:33 +0200)] 
man: remove spuriours colon

2 months agoman: add a section on tools trees
Jörg Behrmann [Tue, 27 May 2025 09:57:52 +0000 (11:57 +0200)] 
man: add a section on tools trees

2 months agoCheck that commit exists in config_parse_minimum_version()
Daan De Meyer [Wed, 28 May 2025 11:27:10 +0000 (13:27 +0200)] 
Check that commit exists in config_parse_minimum_version()

merge-base will blow up when given a commit that does not exist in
the checked out repository, so let's check that first before checking
whether the currently checked out commit has the minimum version one as
its ancestor.

2 months agokmod: factor out comparison and also count empty directories as invalid
Jörg Behrmann [Thu, 15 May 2025 15:23:42 +0000 (17:23 +0200)] 
kmod: factor out comparison and also count empty directories as invalid

2 months agoapt: support including additional configuration for reprepro
Jörg Behrmann [Tue, 27 May 2025 09:41:50 +0000 (11:41 +0200)] 
apt: support including additional configuration for reprepro

2 months agoman: capitalise top sections consistently
Jörg Behrmann [Tue, 27 May 2025 15:07:53 +0000 (17:07 +0200)] 
man: capitalise top sections consistently

2 months agomkosi-initrd: Optionally match t64 suffix for tss2 libraries
Daan De Meyer [Tue, 27 May 2025 12:11:13 +0000 (14:11 +0200)] 
mkosi-initrd: Optionally match t64 suffix for tss2 libraries

On debian, these libraries have a t64 suffix on arm for "reasons".
Let's take that into account by optionally matching a t64 suffix for
these libraries.

Fixes #3733.

2 months agoMerge pull request #3742 from DaanDeMeyer/man
Daan De Meyer [Tue, 27 May 2025 10:50:06 +0000 (12:50 +0200)] 
Merge pull request #3742 from DaanDeMeyer/man

2 months agosandbox: Support using mkosi-sandbox as a library
Daan De Meyer [Mon, 26 May 2025 21:02:10 +0000 (23:02 +0200)] 
sandbox: Support using mkosi-sandbox as a library

Let's allow using mkosi-sandbox to create an in process sandbox by
not taking a command line to execute if mkosi-sandbox was itself
imported and not executed.

If we were imported, also don't do any print()'s to behave like a
proper library.

2 months agomkosi-tools: Install man tool and pages as part of misc profile 3742/head
Daan De Meyer [Tue, 27 May 2025 08:43:30 +0000 (10:43 +0200)] 
mkosi-tools: Install man tool and pages as part of misc profile

Man pages are generally shipped together with tools, so we need a
man viewer inside the tools tree to be able to read those man pages.

While we're at it, make sure we also install the basic Linux man pages
since those are always useful to have around.

2 months agoEnforce C.UTF-8 locale for all commands we run
Daan De Meyer [Tue, 27 May 2025 09:00:07 +0000 (11:00 +0200)] 
Enforce C.UTF-8 locale for all commands we run

So this is a shitty situation either way. We generally have no idea
which locales will be available in the tools tree. Most likely, it'll
just be the C.UTF-8 one. In that case, using the locale environment
variables from the host is pointless and leads to annoying errors from
lots of tools.

We could make sure all locales are installed but glibc-all-langpacks is
> 200M installed size on Fedora which feels like too much. So let's
instead always use C.UTF-8, it's not like mkosi itself is locale aware
anyway.

2 months agoSerialize pid in state and check if still exists on load
Daan De Meyer [Mon, 26 May 2025 15:01:25 +0000 (17:01 +0200)] 
Serialize pid in state and check if still exists on load

It happens often enough that mkosi is SIGKILLed and doesn't get to
remove the state file, causing it to leak and cause issues. Let's
serialize the pid of the mkosi process to the state file and check
if it is still running on load.

Fixes #3726

2 months agoMerge pull request #3736 from DaanDeMeyer/rpm-gpgkey
Daan De Meyer [Tue, 27 May 2025 08:05:54 +0000 (10:05 +0200)] 
Merge pull request #3736 from DaanDeMeyer/rpm-gpgkey

2 months agoOnly pick up /etc/pki/tls and /etc/pki/ca-trust as certificate dirs 3736/head
Daan De Meyer [Mon, 26 May 2025 13:09:43 +0000 (15:09 +0200)] 
Only pick up /etc/pki/tls and /etc/pki/ca-trust as certificate dirs

Extra rpm GPG keys can be configured in /etc/pki/rpm-gpg. Let's not
assume /etc/pki consists solely of certificates but instead, let's pick
out the two directories out of there that do concern themselves with
certificates.

This allows copying extra rpm gpg keys to /etc/pki/rpm-gpg with
SandboxTrees= without these getting overridden by the /etc/pki bind
mount we used to have before.

Fixes #3687

2 months agoLook for rpm gpg keys from inside the sandbox
Daan De Meyer [Mon, 26 May 2025 13:06:19 +0000 (15:06 +0200)] 
Look for rpm gpg keys from inside the sandbox

The current approach does not take sandbox trees into account. Let's
switch things around and look for keys from inside the sandbox to make
sure we always take all sources of files that go into the sandbox into
account.

2 months agoFix version bump check if image version was passed on CLI
Daan De Meyer [Mon, 26 May 2025 13:44:42 +0000 (15:44 +0200)] 
Fix version bump check if image version was passed on CLI

We only want to generate a new version if no version was specified on
the CLI. To do that we need to check that the version on the CLI is None,
not the opposite.

Replaces #3721

2 months agoapt: Install apt sources if apt was installed via base tree
Daan De Meyer [Mon, 26 May 2025 13:31:49 +0000 (15:31 +0200)] 
apt: Install apt sources if apt was installed via base tree

Fixes #3715.

2 months agoMake sure git doesn't fail when running as root
Daan De Meyer [Thu, 22 May 2025 12:26:14 +0000 (14:26 +0200)] 
Make sure git doesn't fail when running as root

We have to mark the .git directory we're checking as safe otherwise
git operate on it.

2 months agorepart: use --append-fstab=auto if available
Alberto Planas [Thu, 24 Apr 2025 13:57:56 +0000 (15:57 +0200)] 
repart: use --append-fstab=auto if available

When generating images there is a chance that a pre-existent /etc/fstab
is present in the mkosi buildroot.  systemd-repart can merge the already
existing fstab with the one generated, separating the sections in a way
that the systemd-repart can be reused several times.

Signed-off-by: Alberto Planas <aplanas@suse.com>
2 months agosandbox: handle case where dev node for tty doesn't exist
Clayton Craft [Wed, 21 May 2025 22:59:36 +0000 (15:59 -0700)] 
sandbox: handle case where dev node for tty doesn't exist

This fixes this crash, which happens even when isatty(2) is True:

Traceback (most recent call last):
  File "/sandbox.py", line 1095, in <module>
    main()
  File "/sandbox.py", line 891, in main
    ttyname = os.ttyname(2) if os.isatty(2) else ""
              ^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory

IIUC this is because isatty(2) is a valid file descriptor (inherited
from the parent process?), but ttyname() is unable find a device node
for it because it's not mounted in the sandbox.

2 months agoinitrd: shadow-utils removal is only necessary on old Fedora
Zbigniew Jędrzejewski-Szmek [Tue, 20 May 2025 12:23:05 +0000 (14:23 +0200)] 
initrd: shadow-utils removal is only necessary on old Fedora

On rawhide, we get:
"No packages to remove for argument: shadow-utils"

2 months agoUse SPDX identifier instead of file path for license in pyproject.toml
Björn Wachtendorf [Wed, 21 May 2025 05:33:35 +0000 (07:33 +0200)] 
Use SPDX identifier instead of file path for license in pyproject.toml

2 months agoRevert license-files property
Björn Wachtendorf [Tue, 20 May 2025 16:46:09 +0000 (18:46 +0200)] 
Revert license-files property

2 months agoMerge pull request #3722 from behrmann/versiontweaks
Zbigniew Jędrzejewski-Szmek [Tue, 20 May 2025 13:47:46 +0000 (15:47 +0200)] 
Merge pull request #3722 from behrmann/versiontweaks

Minor version improvements

2 months agomake version test more readable 3722/head
Jörg Behrmann [Fri, 9 May 2025 16:47:49 +0000 (18:47 +0200)] 
make version test more readable

2 months agoversion: add __repr__ to GenericVersion
Jörg Behrmann [Fri, 16 May 2025 09:54:16 +0000 (11:54 +0200)] 
version: add __repr__ to GenericVersion

2 months agoFix licenses path in pyproject.toml
Björn Wachtendorf [Mon, 19 May 2025 13:08:27 +0000 (15:08 +0200)] 
Fix licenses path in pyproject.toml

2 months agoMerge pull request #3702 from aafeijoo-suse/initrd-kmp
Jörg Behrmann [Thu, 15 May 2025 15:16:33 +0000 (17:16 +0200)] 
Merge pull request #3702 from aafeijoo-suse/initrd-kmp

mkosi-initrd: handle KMPs and symlinks under weak-updates

2 months agobuild(deps): bump github/codeql-action from 3.28.13 to 3.28.16
dependabot[bot] [Thu, 1 May 2025 22:16:51 +0000 (22:16 +0000)] 
build(deps): bump github/codeql-action from 3.28.13 to 3.28.16

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

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

Signed-off-by: dependabot[bot] <support@github.com>
3 months agoSupress ssh unit generation if sshd is not present
Septatrix [Tue, 29 Apr 2025 14:57:20 +0000 (16:57 +0200)] 
Supress ssh unit generation if sshd is not present

3 months agoPartially revert 640000a861e9cd9a3807e4158e110a098c74d078
Daan De Meyer [Mon, 28 Apr 2025 10:11:46 +0000 (12:11 +0200)] 
Partially revert 640000a861e9cd9a3807e4158e110a098c74d078

This doesn't quite work as on the second run, mkosi.tools will be
picked up as the default value of ToolsTree= instead of "default"
so we lose cache invalidation.

Let's revert for now until we find a better solution.

3 months agoDon't use default value if optional settings are set to none
Daan De Meyer [Thu, 24 Apr 2025 12:31:32 +0000 (14:31 +0200)] 
Don't use default value if optional settings are set to none

Just like it's possible to disable usage of default values for collection
based settings, we should also support it for optional settings.
This can be used to disable usage of the tools tree even if mkosi.tools.conf
exists by setting ToolsTree= in mkosi.local.conf.

3 months agomkosi-initrd: handle symlinks under weak-updates 3702/head
Antonio Alvarez Feijoo [Wed, 23 Apr 2025 14:50:28 +0000 (16:50 +0200)] 
mkosi-initrd: handle symlinks under weak-updates

The weak-updates folder of the current kernel directory may contain symlinks to
an old kernel:

```
$ tree /usr/lib/modules/6.14.1-1-default/weak-updates/
/usr/lib/modules/6.14.1-1-default/weak-updates/
└── updates
    ├── hdaps.ko -> /usr/lib/modules/6.14.0-1-default/updates/hdaps.ko
    ├── nvidia-open-driver-G06-signed-570.133.07
    │   ├── nvidia-drm.ko.zst -> /usr/lib/modules/6.14.0-1-default/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia-drm.ko.zst
    │   ├── nvidia.ko.zst -> /usr/lib/modules/6.14.0-1-default/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia.ko.zst
    │   ├── nvidia-modeset.ko.zst -> /usr/lib/modules/6.14.0-1-default/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia-modeset.ko.zst
    │   └── nvidia-uvm.ko.zst -> /usr/lib/modules/6.14.0-1-default/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia-uvm.ko.zst
    ├── thinkpad_ec.ko -> /usr/lib/modules/6.14.0-1-default/updates/thinkpad_ec.ko
    └── tp_smapi.ko -> /usr/lib/modules/6.14.0-1-default/updates/tp_smapi.ko
```

These symlinks to a different kernel directory make mkosi to fail:

```
‣  Applying kernel module filters
‣   Running modinfo to fetch kernel module dependencies
modinfo: ERROR: could not get modinfo from 'nvidia': No such file or directory
libkmod: ERROR: kmod_module_parse_depline: ctx=0x55cda95602a0 path=/usr/lib/modules/6.14.1-1-default/weak-updates/updates/thinkpad_ec.ko error=No such file or directory
modinfo: ERROR: could not get modinfo from 'hdaps': No such file or directory
libkmod: ERROR: kmod_module_parse_depline: ctx=0x55cda95602a0 path=/usr/lib/modules/6.14.1-1-default/weak-updates/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia-modeset.ko.zst error=No such file or directory
modinfo: ERROR: could not get modinfo from 'nvidia_drm': No such file or directory
libkmod: ERROR: kmod_module_parse_depline: ctx=0x55cda95602a0 path=/usr/lib/modules/6.14.1-1-default/weak-updates/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia.ko.zst error=No such file or directory
modinfo: ERROR: could not get modinfo from 'nvidia_uvm': No such file or directory
modinfo: ERROR: could not get modinfo from 'thinkpad_ec': No such file or directory
libkmod: ERROR: kmod_module_parse_depline: ctx=0x55cda95602a0 path=/usr/lib/modules/6.14.1-1-default/weak-updates/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia.ko.zst error=No such file or directory
modinfo: ERROR: could not get modinfo from 'nvidia_modeset': No such file or directory
libkmod: ERROR: kmod_module_parse_depline: ctx=0x55cda95602a0 path=/usr/lib/modules/6.14.1-1-default/weak-updates/updates/thinkpad_ec.ko error=No such file or directory
modinfo: ERROR: could not get modinfo from 'tp_smapi': No such file or directory
```

Also, do not run `depmod` for this old kernel directory that contains only the
`update` directory.

3 months agomkosi-initrd: perform basic checks on the kernel dir before calling mkosi
Antonio Alvarez Feijoo [Wed, 23 Apr 2025 11:37:09 +0000 (13:37 +0200)] 
mkosi-initrd: perform basic checks on the kernel dir before calling mkosi

openSUSE ships Kernel Module Packages (KMPs), e.g.:

```
$ rpm -ql nvidia-open-driver-G06-signed-kmp-default
/usr/lib/modules/6.14.0-1-default
/usr/lib/modules/6.14.0-1-default/updates
/usr/lib/modules/6.14.0-1-default/updates/nvidia-open-driver-G06-signed-570.133.07
/usr/lib/modules/6.14.0-1-default/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia-drm.ko.zst
/usr/lib/modules/6.14.0-1-default/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia-modeset.ko.zst
/usr/lib/modules/6.14.0-1-default/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia-uvm.ko.zst
/usr/lib/modules/6.14.0-1-default/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia.ko.zst
```

These KMPs install their kernel modules under the updates folder of a certain
kernel directory, even with that kernel directory without any other content:

```
$ tree /usr/lib/modules/6.14.0-1-default
/usr/lib/modules/6.14.0-1-default
└── updates
    ├── hdaps.ko
    ├── nvidia-open-driver-G06-signed-570.133.07
    │   ├── nvidia-drm.ko.zst
    │   ├── nvidia.ko.zst
    │   ├── nvidia-modeset.ko.zst
    │   └── nvidia-uvm.ko.zst
    ├── thinkpad_ec.ko
    └── tp_smapi.ko
```

That of course will make mkosi fail:

```
$ mkosi-initrd -k 6.14.0-1-default
‣ Validating certificates and keys
‣ Copying repository metadata
‣ Building main image
‣  Copying in sandbox trees…
‣  Installing openSUSE
...
‣  Applying kernel module filters
‣   Running modinfo to fetch kernel module dependencies
modinfo: ERROR: Module nvidia not found.
modinfo: ERROR: Module thinkpad-ec not found.
modinfo: ERROR: Module nvidia-modeset not found.
modinfo: ERROR: Module tp-smapi not found.
modinfo: ERROR: Module hdaps not found.
modinfo: ERROR: Module nvidia-uvm not found.
modinfo: ERROR: Module nvidia-drm not found.
‣ "modinfo --set-version 6.14.0-1-default --null nvidia thinkpad-ec nvidia-modeset tp-smapi hdaps nvidia-uvm nvidia-drm" returned non-zero exit code 1.
```

But, there is no need fail so far (after calling the package manager within
mkosi), some basic checks can be performed before spawning other processes.

3 months agoUse a default tools tree by default if mkosi.tools.conf exists
Daan De Meyer [Sun, 20 Apr 2025 18:18:11 +0000 (20:18 +0200)] 
Use a default tools tree by default if mkosi.tools.conf exists

3 months agomkosi: Override misconfigured gitconfig HTTP/HTTPS proxy with ProxyUrl
Ryan Wilson [Mon, 21 Apr 2025 17:00:53 +0000 (10:00 -0700)] 
mkosi: Override misconfigured gitconfig HTTP/HTTPS proxy with ProxyUrl

When running mkosi on a server with an outgoing HTTP/HTTPS proxy,
Build.ProxyUrl must be set. However, some repositories (e.g. systemd)
call git in their mkosi scripts (e.g. cloning package repositories for
distros) and .gitconfig can also contain different http.proxy and https.proxy
settings. Thus, if .gitconfig is misconfigured with the wrong proxy,
the user will get confusing errors related to git fetching repositories.

To ensure we use a consistent proxy across git and mkosi, we override
git http proxy configuration via GIT_CONFIG_COUNT, GIT_CONFIG_KEY_{n},
GIT_CONFIG_VALUE{n} environment variables. Most of the code complexity
is dealing with the case when these variables are set by the user via
Environment / EnvironmentFiles.

3 months agoMake sure we create the default workspace directory as well
Daan De Meyer [Fri, 18 Apr 2025 12:44:30 +0000 (14:44 +0200)] 
Make sure we create the default workspace directory as well

Fixes #3701

3 months agomkosi-initrd: --kernel-modules-include -> --kernel-modules
Antonio Alvarez Feijoo [Wed, 16 Apr 2025 09:55:55 +0000 (11:55 +0200)] 
mkosi-initrd: --kernel-modules-include -> --kernel-modules

Use the new option name.

3 months agomkosi: Use tools tree by default in repository config
Daan De Meyer [Thu, 17 Apr 2025 10:18:22 +0000 (12:18 +0200)] 
mkosi: Use tools tree by default in repository config

Might as well use a tools tree by default to minimize the number of
packages that have to be installed on the host to build the default
image.

3 months agodnf: Stop messing around with plugins
Daan De Meyer [Thu, 17 Apr 2025 09:52:42 +0000 (11:52 +0200)] 
dnf: Stop messing around with plugins

We disabled plugins by default a long time ago because the
versionlock plugin's configuration from the host was interfering
with image builds. Now that we have completely ownership over /etc,
there shouldn't be a need to disable plugins anymore if we assume
they won't do anything nasty by default without configuration.

3 months agoFix mkosi help
Daan De Meyer [Thu, 17 Apr 2025 09:05:39 +0000 (11:05 +0200)] 
Fix mkosi help

3 months agomkosi-obs: simplify generation of signed UEFI auth files
Dan Streetman [Tue, 15 Apr 2025 23:28:49 +0000 (19:28 -0400)] 
mkosi-obs: simplify generation of signed UEFI auth files

We can use systemd-keyutil to generate the PKCS#7 signature from the
OBS-provided PKCS#1 signature and OBS-provided x509 certificate, instead of the
'kernel-sign-file' script.

Also we can use the ESL files directly, instead of the perl statement that
removes the auth header, as mkosi.postoutput leaves them for us to use.

3 months agoMerge pull request #3661 from septatrix/ssh-runtime
Daan De Meyer [Wed, 16 Apr 2025 11:26:36 +0000 (13:26 +0200)] 
Merge pull request #3661 from septatrix/ssh-runtime

Add new Ssh=runtime option

3 months agoMerge pull request #3682 from DaanDeMeyer/history
Daan De Meyer [Wed, 16 Apr 2025 11:24:39 +0000 (13:24 +0200)] 
Merge pull request #3682 from DaanDeMeyer/history

installer: Make sure package manager state is preserved in the image

3 months agoMerge pull request #3696 from DaanDeMeyer/history-cli
Daan De Meyer [Wed, 16 Apr 2025 10:42:40 +0000 (12:42 +0200)] 
Merge pull request #3696 from DaanDeMeyer/history-cli

Only write CLI arguments to history instead of full config

3 months agoRework version bumping 3696/head
Daan De Meyer [Tue, 15 Apr 2025 18:28:25 +0000 (20:28 +0200)] 
Rework version bumping

Currently, --auto-bump= bumps the version after finishing a build.
Effectively this means the version in mkosi.version doesn't reflect
the actual version of the image which seems weird. Instead, let's
generate the new version upfront so that it's used by the build but
only write it to mkosi.version when we do a successful build.

Additionally, look for a mkosi.bump script and use it if it exists
to generate the new version so we can generate a timestamp as the
version in particleos.

3 months agoOnly write CLI arguments to history instead of full config
Daan De Meyer [Sun, 13 Apr 2025 20:42:55 +0000 (22:42 +0200)] 
Only write CLI arguments to history instead of full config

The huge downside of writing the full config to the history is that
any modifications to config files are ignored until the image is
rebuilt.

If we make the argument that changes to config files are usually
supposed to be permanent rather than ephemeral, it doesn't make sense
to not take them into account when reusing the history. Especially since
the primary purpose of the history is to avoid specifying the same CLI
arguments over and over again without encoding those CLI arguments into
a config file.

So instead of saving the full config to the history and not reparsing
the configuration when reusing the history, let's only save the CLI
arguments to the history and always reparse the configuration, even when
we end up reusing the history.

This keeps the crucial benefit of the history intact (not having to repeat
yourself endlessly) while still making sure any new settings added to the
configuration files are taken into account immediately.

It also simplifies the implementation quite a bit, as we can get away
again with maintaining a single history file instead of two.

Additionally, we opt to completely ignore the history when using the sandbox
verb. The idea here is that the history only applies to the final image (and
subimages). This was already the case as any --tools-tree-xxx CLI options aren't
saved in the history as they are not fields of the Config object.

3 months agoDisallow using --rerun-build-scripts with --force again
Daan De Meyer [Sun, 13 Apr 2025 20:40:16 +0000 (22:40 +0200)] 
Disallow using --rerun-build-scripts with --force again

In the next commit, we're going to move history handling purely into
parse_config(), which means we can't check anymore if we built the
image or not, so let's disallow using --force with --rerun-build-scripts
again as the only way that works is if we can check whether we built the
image or not before writing the history.