]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
2 years agoMerge pull request #2023 from keszybz/mkosi-chroot-no-args
Daan De Meyer [Thu, 2 Nov 2023 10:37:54 +0000 (11:37 +0100)] 
Merge pull request #2023 from keszybz/mkosi-chroot-no-args

mkosi-chroot: just run shell if no arguments are specified

2 years agoAllow overriding dnf selection with $MKOSI_DNF
Zbigniew Jędrzejewski-Szmek [Fri, 27 Oct 2023 12:09:45 +0000 (14:09 +0200)] 
Allow overriding dnf selection with $MKOSI_DNF

dnf5 is nice, but it has some issues, for example installation of rhel9
currently fails with some error about signature. Using dnf instead works around
the problem. Allow the user to override the selection using an environment
variable (or Environment=).

(We have the tools directory, but it doesn't help here because we want to use
'dnf' instead of 'dnf5' and not a different version of 'dnf5'.)

2 years agospawn: inherit parent $PATH by default
Malte Poll [Mon, 30 Oct 2023 14:24:54 +0000 (15:24 +0100)] 
spawn: inherit parent $PATH by default

Spawn should be able to find binaries in $PATH by default.

Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2 years agoFix incremental caching
Daan De Meyer [Wed, 1 Nov 2023 11:49:52 +0000 (12:49 +0100)] 
Fix incremental caching

- Make sure the distribution, release and architecture are also part
of the cache manifest
- Remove the output name from the cache key and use the distribution,
release, architecture and optionally image name instead.
- Use MkosiEncoder to serialize the cache manifest.

2 years agoqemu: allow checking device availability with actually used flags
Joerg Behrmann [Wed, 1 Nov 2023 14:16:14 +0000 (15:16 +0100)] 
qemu: allow checking device availability with actually used flags

Also use an actual os.open instead of os.access, because os.access might fail
with certain flags in cases where os.open will not.

This works around the case where kernel modules after an upgrade cannot be
loaded anymore because it is no longer available for the running kernel.

2 years agoAdd mkosi-as-caller helper 2023/head
Zbigniew Jędrzejewski-Szmek [Sun, 29 Oct 2023 17:22:45 +0000 (18:22 +0100)] 
Add mkosi-as-caller helper

This helper can be used to replace the following pattern which is similar to
something used in the systemd codebase:

SU="setpriv --reuid=${MKOSI_UID:-0} --regid=${MKOSI_GID:-0} --clear-groups"
$SU meson setup "$BUILDDIR/build" "$SRCDIR"
$SU meson compile -C "$BUILDDIR/build"
meson install -C "$BUILDDIR/build" --no-rebuild

With the helper this becomes:

mkosi-as-caller meson setup "$BUILDDIR/build" "$SRCDIR"
mkosi-as-caller meson compile -C "$BUILDDIR/build"
meson install -C "$BUILDDIR/build" --no-rebuild

2 years agoFix venv name in ci.yml
Sam Leonard [Tue, 31 Oct 2023 10:15:23 +0000 (10:15 +0000)] 
Fix venv name in ci.yml

2 years agossh: add RuntimeDirectory=sshd
Luca Boccassi [Mon, 30 Oct 2023 11:49:20 +0000 (11:49 +0000)] 
ssh: add RuntimeDirectory=sshd

[  209.582912] sshd[888]: fatal: Missing privilege separation directory: /run/sshd

2 years agofedora: allow cross builds with dnf5
Paul Meyer [Fri, 27 Oct 2023 12:36:48 +0000 (14:36 +0200)] 
fedora: allow cross builds with dnf5

The `--forcearch` flag is global an can be used in dnf5 from v5.1.6 up.

Co-authored-by: Malte Poll <mp@edgeless.systems>
2 years agoman: drop suggestion to use mkosi-chroot for the whole script
Zbigniew Jędrzejewski-Szmek [Sun, 29 Oct 2023 17:25:44 +0000 (18:25 +0100)] 
man: drop suggestion to use mkosi-chroot for the whole script

2 years agoPut uid before gid
Zbigniew Jędrzejewski-Szmek [Sun, 29 Oct 2023 16:14:28 +0000 (17:14 +0100)] 
Put uid before gid

2 years agoRework the interface of finalize_host_scripts() to take a dictionary
Zbigniew Jędrzejewski-Szmek [Sun, 29 Oct 2023 15:49:05 +0000 (16:49 +0100)] 
Rework the interface of finalize_host_scripts() to take a dictionary

We would create <chroot> in the calling function, then pass it to
finalize_host_scripts(), which would rename it during installation to "mkosi-chroot".
This is too much magic: when looking for 'mkosi-chroot' in the code, the name appears
in one place, and the definition in a completely different place. It's also hard to
extend with other commands in the future. Let's use the proper name from the
beginning and switch to a dictionary, so we can add other helpers in the future.

2 years agoReformat with statements to not use backslashes
Zbigniew Jędrzejewski-Szmek [Sun, 29 Oct 2023 15:27:52 +0000 (16:27 +0100)] 
Reformat with statements to not use backslashes

Backslashes were required in old python versions, but thankfully they are not
anymore. Even though we used the continuation backslashes, we already had
parenthesis everywhere, so let's just drop the backslashes, and also use a
trailing comma per the usual style.

(https://github.com/python/cpython/issues/56991 says that this happened in
Python 3.10, but it also works with Python 3.9.18 here. I guess the CI will
provide the definite confirmation.)

2 years agomkosi-chroot: just run shell if no arguments are specified
Zbigniew Jędrzejewski-Szmek [Sun, 29 Oct 2023 13:26:45 +0000 (14:26 +0100)] 
mkosi-chroot: just run shell if no arguments are specified

chroot(1) is documented to run "$SHELL -i" as the default command. Let's do
something similar and call "sh -i". When a user is using '--debug-shell' and one
of the scripts fails, the mkosi-chroot can be used to chroot into the image.
I think this is what users expect, based on the 'chroot' in the name.

(I don't think using $SHELL makes sense. It could either be set to 'sh', or to
something from the outside, which might not even be installed in the chroot. We
call 'sh' ourselves, so we know it must be there, so let's just call that
uncoditionally.)

2 years agoDon't mount our own passwd when building images
Daan De Meyer [Sat, 28 Oct 2023 19:38:37 +0000 (21:38 +0200)] 
Don't mount our own passwd when building images

It's much more important that we use the image's /etc/passwd instead
of our own. Both inside and outside the image so that UIDs/GIDs get
resolved correctly.

2 years agoExtend README instructions
Daan De Meyer [Sat, 28 Oct 2023 15:49:14 +0000 (17:49 +0200)] 
Extend README instructions

Let's make sure we have complete copy-paste shell commands for
all the different installation methods. Let's also avoid confusion
and always use python3 in the example commands.

2 years agoFix table in mkosi.md
Christian Berendt [Sat, 28 Oct 2023 16:06:55 +0000 (18:06 +0200)] 
Fix table in mkosi.md

2 years agoMerge pull request #2018 from DaanDeMeyer/match-build-sources
Jörg Behrmann [Sat, 28 Oct 2023 12:26:35 +0000 (14:26 +0200)] 
Merge pull request #2018 from DaanDeMeyer/match-build-sources

Add BuildSources= match

2 years agoAdd BuildSources= match 2018/head
Daan De Meyer [Sat, 28 Oct 2023 10:42:58 +0000 (12:42 +0200)] 
Add BuildSources= match

One pattern I've started using a lot when I have to build multiple
projects from source in a build script is to check if a source tree
has been mounted at some location using BuildSources= and to only
build the project if that's the case.

The problem with this is that this only allows me to skip the build,
it doesn't allow me to skip installing the necessary build and runtime
packages for that particular project.

Let's add a BuildSources= match so that everything related to the
project can be skipped if the project is not configured to be mounted
at some location using BuildSources=.

2 years agoMake sure the chroot scripts dir variable is not overwritten
Daan De Meyer [Sat, 28 Oct 2023 11:33:40 +0000 (13:33 +0200)] 
Make sure the chroot scripts dir variable is not overwritten

We used `d` for both the chroot scripts dir and the host scripts dir,
which means the host scripts dir overwrites the chroot scripts dir
variable. This isn't a problem when there's only one script, but
becomes an issue when there's multiple scripts of the same type.

2 years agoStop using subdirectories of cache and build dirs automatically
Daan De Meyer [Fri, 20 Oct 2023 19:21:18 +0000 (21:21 +0200)] 
Stop using subdirectories of cache and build dirs automatically

In some cases, for example mkosi-initrd running as a kernel-install
script, we want to reuse the system package cache. Currently this is
impossible as we unconditionally create a subdirectory beneath the
provided cache directory. Let's stop doing that, as users can now
explicitly configure this behavior themselves by specifying the
cache directory or build directory as follows:

```
CacheDirectory=mkosi.cache/%d~%r~%a
BuildDirectory=mkosi.builddir/%d~%r~%a
```

Additionally, make sure the default tools tree only reuses the same
cache as the preset it's used for when the distribution, release and
architecture are the same as the preset's.

2 years agoParse mkosi.local.conf before parsing any other files
Daan De Meyer [Fri, 27 Oct 2023 19:17:27 +0000 (21:17 +0200)] 
Parse mkosi.local.conf before parsing any other files

Currently extra local configuration is a bit implicit, users have
to add a drop-in in mkosi.conf.d/ named 00-local.conf or so and add
that to the gitignore. This file will then unconditionally override
settings from mkosi.conf even if that's not intended.

Let's make local configuration a bit more explicit by parsing
mkosi.local.conf in a directory first before parsing anything else.
This makes local configuration easy to detect and grep for, and
makes sure that local configuration is by default overridden by
non-local configuration.

2 years agoMake mkosi.repart/ append to the default value for RepartDirectories=
Daan De Meyer [Fri, 27 Oct 2023 12:22:09 +0000 (14:22 +0200)] 
Make mkosi.repart/ append to the default value for RepartDirectories=

While for other list based settings that have a canonical path, we
generally want to append them all to the user provided values, for
RepartDirectories=, it probably makes more sense that if the user
specifies it explicitly, it overrides all the directories defined by
the project in mkosi.repart/ directories. Let's accomodate this by
having mkosi.repart/ modify the default value for RepartDirectories=
which is only used if the setting is not set explicitly.

2 years agoFail when CLI configuration is not applied to any image
Daan De Meyer [Fri, 27 Oct 2023 13:41:41 +0000 (15:41 +0200)] 
Fail when CLI configuration is not applied to any image

Currently we silently ignore settings configured via the CLI that
are overridden by image configuration files. Let's instead fail with
a descriptive error message when this happens, indicating users that
they should use '@' in their configuration files to set the default
value for the setting if they want to allow overriding it from the
command line.

2 years agoDon't use configured default value when empty string is assigned
Daan De Meyer [Fri, 27 Oct 2023 09:19:27 +0000 (11:19 +0200)] 
Don't use configured default value when empty string is assigned

Currently, if a setting is assigned the empty string on the CLI, any
default value configured in the config file is still used. Let's change
this and not use any configured default value when the empty string is
assigned so that default values configured in config files can be
overridden from the CLI.

2 years agoMerge pull request #2012 from DaanDeMeyer/pkgmngr
Daan De Meyer [Fri, 27 Oct 2023 09:18:09 +0000 (11:18 +0200)] 
Merge pull request #2012 from DaanDeMeyer/pkgmngr

Move PackageManagerTrees= to the Distribution section

2 years agoaction: Make logic for unprivileged KVM access more robust 2012/head
Daan De Meyer [Thu, 26 Oct 2023 14:04:36 +0000 (16:04 +0200)] 
action: Make logic for unprivileged KVM access more robust

- Copy static-nodes-permissions.conf to /etc before modifying so our
modifications don't get overwritten if systemd is updated.
- Add udev rules to set the permissions correctly as well

2 years agoMove PackageManagerTrees= to the Distribution section
Daan De Meyer [Thu, 26 Oct 2023 11:39:24 +0000 (13:39 +0200)] 
Move PackageManagerTrees= to the Distribution section

This makes more sense than the Content section, since these trees
don't actually end up in the image.

2 years agoMerge pull request #2011 from DaanDeMeyer/fixes
Jörg Behrmann [Wed, 25 Oct 2023 16:41:02 +0000 (18:41 +0200)] 
Merge pull request #2011 from DaanDeMeyer/fixes

Fixes

2 years agoSet default for Bootable= 2011/head
Daan De Meyer [Wed, 25 Oct 2023 14:36:37 +0000 (16:36 +0200)] 
Set default for Bootable=

Let's not override the setting but just change the default so it
can still be changed from the CLI.

2 years agoAdd common config file for centos (and friends) and fedora
Daan De Meyer [Wed, 25 Oct 2023 14:27:39 +0000 (16:27 +0200)] 
Add common config file for centos (and friends) and fedora

2 years agofedora: Drop selinux packages
Daan De Meyer [Wed, 25 Oct 2023 14:20:33 +0000 (16:20 +0200)] 
fedora: Drop selinux packages

This greatly increase image build time so let's not add them by
default.

2 years agoOnly add UEFI tools tree packages on architectures that support UEFI
Daan De Meyer [Wed, 25 Oct 2023 14:16:33 +0000 (16:16 +0200)] 
Only add UEFI tools tree packages on architectures that support UEFI

These are not built for other architectures on Fedora/CentOS so let's
not try to add them there.

2 years agoPass ExtraSearchPaths= to default tools tree preset
Daan De Meyer [Wed, 25 Oct 2023 14:16:09 +0000 (16:16 +0200)] 
Pass ExtraSearchPaths= to default tools tree preset

Otherwise these won't be used.

2 years agoSkip missing kernel images in gen_kernel_images()
Daan De Meyer [Tue, 24 Oct 2023 12:47:07 +0000 (14:47 +0200)] 
Skip missing kernel images in gen_kernel_images()

And copy out the vmlinuz unconditionally again in copy_vmlinuz().

2 years agoFix missing build overlay
Daan De Meyer [Mon, 23 Oct 2023 20:33:32 +0000 (22:33 +0200)] 
Fix missing build overlay

We also need a build overlay if there are prepare scripts but no
build packages, so let's replace need_build_packages() with a new
function need_build_overlay() that also checks for that.

2 years agoUpdate NEWS
Daan De Meyer [Mon, 23 Oct 2023 12:34:18 +0000 (14:34 +0200)] 
Update NEWS

2 years agoMerge pull request #2007 from DaanDeMeyer/profile
Daan De Meyer [Mon, 23 Oct 2023 10:19:58 +0000 (12:19 +0200)] 
Merge pull request #2007 from DaanDeMeyer/profile

Add support for profiles

2 years agoRename Presets to Images 2007/head
Daan De Meyer [Sun, 22 Oct 2023 18:26:12 +0000 (20:26 +0200)] 
Rename Presets to Images

Presets doesn't really have any meaning without searching up its
definition. By just using mkosi.images/, it's much clearer that the
directory contains image definitions compared to mkosi.presets/.

The old names are kept intact for backwards compatibility.

2 years agoAdd support for profiles
Daan De Meyer [Sun, 22 Oct 2023 13:53:22 +0000 (15:53 +0200)] 
Add support for profiles

A profile is a set of configuration options that represents a known
variant of the given image. Its primary purpose is to allow grouping
known useful derivatives of the current image under a recognizable
identifier.

The difference with presets is that presets represent the individual
images that might need to be built to complete the final image, whereas
profiles change how the individual presets are built. Specifically, only
ever one profile can be selected, while it's perfectly valid to build
many presets.

We parse the specified profile after mkosi.conf but before
mkosi.conf.d to allow configuring the profile to build in mkosi.conf.

2 years agoUse shorthand tmp_path everywhere in test_config
Daan De Meyer [Mon, 23 Oct 2023 08:16:32 +0000 (10:16 +0200)] 
Use shorthand tmp_path everywhere in test_config

2 years agoFix config name when parsing new includes
Daan De Meyer [Sun, 22 Oct 2023 13:46:21 +0000 (15:46 +0200)] 
Fix config name when parsing new includes

2 years agoMake sure Presets= becomes immutable after we use it
Daan De Meyer [Sun, 22 Oct 2023 13:35:16 +0000 (15:35 +0200)] 
Make sure Presets= becomes immutable after we use it

Presets= should not be modified anymore after we start parsing
presets. Let's make sure we enforce that.

2 years agoSet the preset field before we parse the preset's config
Daan De Meyer [Sun, 22 Oct 2023 13:24:38 +0000 (15:24 +0200)] 
Set the preset field before we parse the preset's config

In case we ever want to add a match setting for the current preset.

2 years agoMake sure we finalize the default value for Presets= early
Daan De Meyer [Sun, 22 Oct 2023 13:23:25 +0000 (15:23 +0200)] 
Make sure we finalize the default value for Presets= early

We need to finalize the default value for Presets= early as we use
its value earlier than the other config options.

2 years agoIntroduce is_valid_filename()
Daan De Meyer [Sun, 22 Oct 2023 13:22:48 +0000 (15:22 +0200)] 
Introduce is_valid_filename()

2 years agoEnable WithDocs= by default
Daan De Meyer [Sun, 22 Oct 2023 09:51:50 +0000 (11:51 +0200)] 
Enable WithDocs= by default

Let's include documentation by default so as to not confuse users.

2 years agoMerge pull request #2001 from DaanDeMeyer/json
Daan De Meyer [Fri, 20 Oct 2023 15:12:50 +0000 (17:12 +0200)] 
Merge pull request #2001 from DaanDeMeyer/json

Add --json option

2 years agoAdd --json option 2001/head
Daan De Meyer [Fri, 20 Oct 2023 13:52:00 +0000 (15:52 +0200)] 
Add --json option

Let's allow using --json with summary to get a JSON dump of the
configuration.

2 years agoSort args in test_json
Daan De Meyer [Fri, 20 Oct 2023 13:53:28 +0000 (15:53 +0200)] 
Sort args in test_json

2 years agoDrop verb and cmdline from summary
Daan De Meyer [Fri, 20 Oct 2023 13:41:52 +0000 (15:41 +0200)] 
Drop verb and cmdline from summary

The summary is only printed when we use the summary verb which doesn't
take command line arguments, so both of these are self evident and will
always have the same value.

2 years agoMerge pull request #2002 from behrmann/jsondict
Daan De Meyer [Fri, 20 Oct 2023 14:38:20 +0000 (16:38 +0200)] 
Merge pull request #2002 from behrmann/jsondict

Allow to jsonify MkosiArgs and MkosiConfig in composite objects

2 years agoFix ruff warnings 2002/head
Joerg Behrmann [Fri, 20 Oct 2023 14:32:44 +0000 (16:32 +0200)] 
Fix ruff warnings

2 years agojson: make MkosiConfig and MkosiArgs dumpable in composite structures
Joerg Behrmann [Fri, 20 Oct 2023 14:29:43 +0000 (16:29 +0200)] 
json: make MkosiConfig and MkosiArgs dumpable in composite structures

2 years agoqemu: Be smarter when a kernel is passed in by the user
Daan De Meyer [Fri, 20 Oct 2023 09:03:02 +0000 (11:03 +0200)] 
qemu: Be smarter when a kernel is passed in by the user

Depending on whether the user passes us a kernel that's a UKI, PE
binary or raw Linux image, we have to change our behavior. We now
do the following based on the kernel type we're about to boot:

- If we get passed in a UKI or PE kernel, we use UEFI firmware,
  otherwise we use qemu direct kernel boot
- If the kernel is a UKI and SMBIOS is available, we don't use
  -append, otherwise we do
- If we do direct kernel boot, we always synthesize a root= argument
  if needed.

2 years agoMerge pull request #1998 from DaanDeMeyer/modernize
Daan De Meyer [Fri, 20 Oct 2023 09:29:58 +0000 (11:29 +0200)] 
Merge pull request #1998 from DaanDeMeyer/modernize

Modernize Openmandriva and Mageia

2 years agoMake join_mirror() more robust and use it everywhere 1998/head
Daan De Meyer [Thu, 19 Oct 2023 18:06:06 +0000 (20:06 +0200)] 
Make join_mirror() more robust and use it everywhere

2 years agoModernize mageia and openmandriva a bit
Daan De Meyer [Thu, 19 Oct 2023 17:46:21 +0000 (19:46 +0200)] 
Modernize mageia and openmandriva a bit

2 years agoUse find_rpm_gpgkey() for Mageia and OpenMandriva
Daan De Meyer [Thu, 19 Oct 2023 16:54:02 +0000 (18:54 +0200)] 
Use find_rpm_gpgkey() for Mageia and OpenMandriva

2 years agoUpdate NEWS
Daan De Meyer [Thu, 19 Oct 2023 13:22:34 +0000 (15:22 +0200)] 
Update NEWS

2 years agoAdd git script to set safe.directory=* whenever git is executed
Daan De Meyer [Thu, 19 Oct 2023 11:57:11 +0000 (13:57 +0200)] 
Add git script to set safe.directory=* whenever git is executed

Instead of requiring every git command to be executed as the user
invoking mkosi, let's add a git script that appends
"-c safe.directory=*" to disable the git safe directory check. This
also reworks the script machinery to support scripts both inside and
outside of the chroot since the git script needs to be available in both.

2 years agoMerge pull request #1995 from DaanDeMeyer/initrd
Daan De Meyer [Thu, 19 Oct 2023 11:43:11 +0000 (13:43 +0200)] 
Merge pull request #1995 from DaanDeMeyer/initrd

Don't store default initrd artifacts in output directory

2 years agoDon't store default initrd artifacts in output directory 1995/head
Daan De Meyer [Thu, 19 Oct 2023 10:27:43 +0000 (12:27 +0200)] 
Don't store default initrd artifacts in output directory

We don't use these for anything and the initrd can already be
accessed using the split initrd, so let's not store the default
initrd artifacts in the output directory.

2 years agoPut KernelCommandLine= in the right section
Daan De Meyer [Thu, 19 Oct 2023 10:27:30 +0000 (12:27 +0200)] 
Put KernelCommandLine= in the right section

2 years agoDon't assume FileNotFoundError from run() is about the executable
Daan De Meyer [Thu, 19 Oct 2023 10:26:34 +0000 (12:26 +0200)] 
Don't assume FileNotFoundError from run() is about the executable

It could also be about e.g. the working directory, so let's make sure
we log about it correctly.

2 years agoopenmandriva: Copy kernel image to /usr
Daan De Meyer [Thu, 19 Oct 2023 09:41:40 +0000 (11:41 +0200)] 
openmandriva: Copy kernel image to /usr

Same as for Debian and Mageia, except we have to get rid of a symlink
as well.

2 years agoopenmandriva: Fix mirror
Daan De Meyer [Thu, 19 Oct 2023 09:39:56 +0000 (11:39 +0200)] 
openmandriva: Fix mirror

The mirrorlist is down it seems, let's use baseurl= as is done in
the mandriva repo files.

2 years agoMerge pull request #1991 from DaanDeMeyer/autologin
Jörg Behrmann [Thu, 19 Oct 2023 09:21:55 +0000 (11:21 +0200)] 
Merge pull request #1991 from DaanDeMeyer/autologin

Add shorthand for enabling --autologin

2 years agoFix missing apivfs in openmandriva 1991/head
Daan De Meyer [Wed, 18 Oct 2023 23:32:37 +0000 (01:32 +0200)] 
Fix missing apivfs in openmandriva

2 years agoFix mageia vmlinuz location
Daan De Meyer [Wed, 18 Oct 2023 23:07:17 +0000 (01:07 +0200)] 
Fix mageia vmlinuz location

Same problem as Debian, so let's apply the same fix.

2 years agoAdd ToolsTreeMirror= setting
Daan De Meyer [Wed, 18 Oct 2023 21:28:11 +0000 (23:28 +0200)] 
Add ToolsTreeMirror= setting

Complete the trio of ToolsTreeDistribution=, ToolsTreeRelease= with
ToolsTreeMirror=.

2 years agoCreate output symlink in staging directory
Daan De Meyer [Wed, 18 Oct 2023 21:18:02 +0000 (23:18 +0200)] 
Create output symlink in staging directory

No reason to do it directly in the output directory, let's also do
this in the staging directory.

2 years agoChange ownership of output files in staging directory
Daan De Meyer [Wed, 18 Oct 2023 21:13:59 +0000 (23:13 +0200)] 
Change ownership of output files in staging directory

There might be other files in the output directory. Make sure we
only chown the files we produced by iterating over the staging
directory.

2 years agoAdd shorthand for enabling --autologin
Daan De Meyer [Wed, 18 Oct 2023 21:08:02 +0000 (23:08 +0200)] 
Add shorthand for enabling --autologin

I use this one really often in mkosi one liners so let's add a shorthand
for it.

2 years agoBuild xfsprogs with all available threads
Daan De Meyer [Wed, 18 Oct 2023 20:38:21 +0000 (22:38 +0200)] 
Build xfsprogs with all available threads

2 years agoMerge pull request #1989 from DaanDeMeyer/top
Daan De Meyer [Wed, 18 Oct 2023 20:37:42 +0000 (22:37 +0200)] 
Merge pull request #1989 from DaanDeMeyer/top

Beef up bundled images

2 years agoBeef up bundled images 1989/head
Daan De Meyer [Wed, 18 Oct 2023 10:00:53 +0000 (12:00 +0200)] 
Beef up bundled images

Let's beef up the bundled images with all the packages from the tools
trees where applicable so that we can run easily run mkosi from these
images if needed for testing on different distributions.

2 years agoaction: Build newer xfsprogs
Daan De Meyer [Wed, 18 Oct 2023 13:17:56 +0000 (15:17 +0200)] 
action: Build newer xfsprogs

Support for handling filenames with spaces in mkfs.xfs was only
added in a recent version of xfsprogs so build it from source for
now.

2 years agoAdd yaml to editorconfig
Daan De Meyer [Wed, 18 Oct 2023 13:17:36 +0000 (15:17 +0200)] 
Add yaml to editorconfig

yaml is usually indented with 2 spaces.

2 years agoopensuse: Download packages in advance
Daan De Meyer [Wed, 18 Oct 2023 14:02:32 +0000 (16:02 +0200)] 
opensuse: Download packages in advance

This is how other distributions package managers do it as well, so
let's make opensuse consistent with those.

2 years agoopensuse: Switch to https mirror
Daan De Meyer [Wed, 18 Oct 2023 11:33:28 +0000 (13:33 +0200)] 
opensuse: Switch to https mirror

From the experiment, it seems like the https mirror is reliable now
so let's use it as the default.

2 years agoMove CI configuration to top level
Daan De Meyer [Wed, 18 Oct 2023 09:04:45 +0000 (11:04 +0200)] 
Move CI configuration to top level

Let's make it easier to run the CI stuff locally by moving it to the
top level directory.

2 years agoMerge pull request #1988 from DaanDeMeyer/fix
Jörg Behrmann [Wed, 18 Oct 2023 10:30:33 +0000 (12:30 +0200)] 
Merge pull request #1988 from DaanDeMeyer/fix

Use with in spawn()

2 years agoRemove unnecessary line continuations 1988/head
Daan De Meyer [Wed, 18 Oct 2023 10:03:39 +0000 (12:03 +0200)] 
Remove unnecessary line continuations

2 years agoUse with in spawn()
Daan De Meyer [Wed, 18 Oct 2023 10:01:26 +0000 (12:01 +0200)] 
Use with in spawn()

If we yield the Popen, we yield a context manager from a context
manager, which becomes hard to follow, since we'll only enter the
outer context manager, and not the inner Popen context manager. To
make things simpler, let's enter the Popen context manager in
spawn() itself.

2 years agoFix spawn()
Daan De Meyer [Wed, 18 Oct 2023 09:41:52 +0000 (11:41 +0200)] 
Fix spawn()

The finally statement needs to run after the process finishes, so
we need to make spawn a context manager.

At the same time, let's make it configurable whether the spawn()
subprocess runs in the foreground or not and let's not do it by
default.

2 years agoDrop leftover gentoo config file for CI
Daan De Meyer [Wed, 18 Oct 2023 08:58:05 +0000 (10:58 +0200)] 
Drop leftover gentoo config file for CI

We don't run gentoo in CI anymore, so drop the leftover config file
for it.

2 years agoReword readme
Daan De Meyer [Wed, 18 Oct 2023 07:30:11 +0000 (09:30 +0200)] 
Reword readme

Let's reduce the amount of detail we put in the readme and list the
installation methods in order of how easy-to-use they are. Let's also
only recommend using the distribution's package if it's sufficiently
recent.

2 years agoRework qemu device support checks
Daan De Meyer [Tue, 17 Oct 2023 20:42:20 +0000 (22:42 +0200)] 
Rework qemu device support checks

Let's implement an available() method on the QemuDeviceNode enum
and move the checks from load_config() to run_qemu() so they don't
impede showing the summary or other verbs.

Let's also prefer using the file descriptor as a check whether the
feature is available in run_qemu() instead of calling the available()
method, as by the time we get to run_qemu() the available() method
might return a different result.

2 years agomake_tar: do not emit extended PAX headers for atime, ctime and mtime
Malte Poll [Tue, 17 Oct 2023 08:37:16 +0000 (10:37 +0200)] 
make_tar: do not emit extended PAX headers for atime, ctime and mtime

The use of the --xattrs flag implies PAX headers (--format=pax).
In this mode, the tar will record atime, ctime and mtime as PAX headers (in addition to the usual USTAR header).
Removing the headers makes the output reproducible.
See also: https://www.gnu.org/software/tar/manual/html_node/PAX-keywords.html

2 years agoAdd a FAQ entry about KVM on Debian/Ubuntu
Daan De Meyer [Fri, 13 Oct 2023 12:47:22 +0000 (14:47 +0200)] 
Add a FAQ entry about KVM on Debian/Ubuntu

2 years agoDo not try to copy vmlinuz for non-bootable images
Zbigniew Jędrzejewski-Szmek [Fri, 13 Oct 2023 15:12:25 +0000 (17:12 +0200)] 
Do not try to copy vmlinuz for non-bootable images

When building an initrd, copy_vmlinuz() would fail because there is
no vmlinuz file to copy.

2 years agoMake sure shadow-utils is installed in tools trees
Daan De Meyer [Fri, 13 Oct 2023 12:30:18 +0000 (14:30 +0200)] 
Make sure shadow-utils is installed in tools trees

This provides newuidmap/newgidmap which are used by virtiofsd, so
let's make sure these are available.

2 years agoMerge pull request #1978 from DaanDeMeyer/kvm
Zbigniew Jędrzejewski-Szmek [Fri, 13 Oct 2023 12:34:50 +0000 (14:34 +0200)] 
Merge pull request #1978 from DaanDeMeyer/kvm

Open qemu device nodes before unsharing user namespace

2 years agoRename InvokingUser to INVOKING_USER 1978/head
Daan De Meyer [Fri, 13 Oct 2023 11:28:25 +0000 (13:28 +0200)] 
Rename InvokingUser to INVOKING_USER

This is now a global constant so let's reflect that in the name.

2 years agoOpen qemu device nodes before unsharing user namespace
Daan De Meyer [Fri, 13 Oct 2023 11:24:44 +0000 (13:24 +0200)] 
Open qemu device nodes before unsharing user namespace

Where possible, we should open the qemu device nodes before we unshare
the user namespace as this might not be possible anymore after unsharing
the user namespace because we might lose access to the kvm group.

Currently this is only possible for /dev/vhost-vsock. I've opened
https://gitlab.com/qemu-project/qemu/-/issues/1936 to hopefully make
it work for /dev/kvm as well.

2 years agoUse os.access() in qemu support checks
Daan De Meyer [Fri, 13 Oct 2023 11:13:41 +0000 (13:13 +0200)] 
Use os.access() in qemu support checks

2 years agoExtend spawn() slightly
Daan De Meyer [Fri, 13 Oct 2023 11:13:07 +0000 (13:13 +0200)] 
Extend spawn() slightly

Let's support more of the options we also support in run() and clean
up the function a bit.

2 years agoEnable faulthandler module when in debug mode
Daan De Meyer [Fri, 13 Oct 2023 11:08:52 +0000 (13:08 +0200)] 
Enable faulthandler module when in debug mode

This will have python dump stacktraces on SIGABRT, which is useful
for debugging hangs.

2 years agoMerge pull request #1973 from DaanDeMeyer/user
Daan De Meyer [Fri, 13 Oct 2023 11:17:53 +0000 (13:17 +0200)] 
Merge pull request #1973 from DaanDeMeyer/user

Run qemu as the invoking user again