]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
22 months agoAdd RuntimeSize= setting 1944/head
Daan De Meyer [Sun, 1 Oct 2023 18:20:12 +0000 (20:20 +0200)] 
Add RuntimeSize= setting

Currently we unconditionally grow disk images to 8G before booting
them in systemd-nspawn or qemu. Let's do better here by making the
size configurable and not growing the disk images by default.

We also move format_bytes() to config.py as most other formatting
functions are located there.

22 months agoAdd back parse_bytes() function as config_parse_bytes()
Daan De Meyer [Sun, 1 Oct 2023 18:04:33 +0000 (20:04 +0200)] 
Add back parse_bytes() function as config_parse_bytes()

22 months agoMerge pull request #1941 from DaanDeMeyer/include
Jörg Behrmann [Mon, 2 Oct 2023 07:44:15 +0000 (09:44 +0200)] 
Merge pull request #1941 from DaanDeMeyer/include

Add Include= setting

22 months agoAdd Include= setting 1941/head
Daan De Meyer [Sat, 30 Sep 2023 14:43:05 +0000 (16:43 +0200)] 
Add Include= setting

This setting allows including extra configuration from user specified
directories or files. The extra configuration is parsed immediately.

22 months agoFix formatting nit
Daan De Meyer [Sat, 30 Sep 2023 15:58:47 +0000 (17:58 +0200)] 
Fix formatting nit

22 months agoStop hardcoding setting names we pass to parse_ini()
Daan De Meyer [Sat, 30 Sep 2023 15:54:58 +0000 (17:54 +0200)] 
Stop hardcoding setting names we pass to parse_ini()

Instead, derive them from the settings list.

22 months agoMerge pull request #1942 from DaanDeMeyer/initrd-packages
Daan De Meyer [Sun, 1 Oct 2023 16:57:20 +0000 (18:57 +0200)] 
Merge pull request #1942 from DaanDeMeyer/initrd-packages

Add InitrdPackages=

22 months agoAdd InitrdPackages= 1942/head
Daan De Meyer [Sat, 30 Sep 2023 18:16:24 +0000 (20:16 +0200)] 
Add InitrdPackages=

We have ToolsTreePackages= already, so let's add a similar setting
for the default initrd to allow the default initrd to be used in
more scenarios.

22 months agoImprove formatting a bit in finalize_tools()
Daan De Meyer [Sat, 30 Sep 2023 18:08:50 +0000 (20:08 +0200)] 
Improve formatting a bit in finalize_tools()

22 months agoDon't show default tools trees in the summary
Daan De Meyer [Sat, 30 Sep 2023 18:06:03 +0000 (20:06 +0200)] 
Don't show default tools trees in the summary

Instead, let's show individual tools tree packages in the summary.
This makes things a bit more consistent as we don't show default
initrd presets in the summary either (and making that happen is no
trivial task so we opt to do the reverse and not show default tools
trees either).

We also add a table to the documentation showing which packages are
in the default tools tree for which distributions.

22 months agoAdd apt and debian-keyring to CentOS tools tree packages
Daan De Meyer [Sun, 1 Oct 2023 16:35:46 +0000 (18:35 +0200)] 
Add apt and debian-keyring to CentOS tools tree packages

This requires epel so we introduce some machinery to specify tools
tree repositories for distributions and use it for CentOS

22 months agoMake --tools-tree-packages singular
Daan De Meyer [Sat, 30 Sep 2023 17:34:20 +0000 (19:34 +0200)] 
Make --tools-tree-packages singular

Let's mimick --package and make the long form CLI option singular.

22 months agoUpdate help for --tools-tree-packages a bit
Daan De Meyer [Sat, 30 Sep 2023 17:32:59 +0000 (19:32 +0200)] 
Update help for --tools-tree-packages a bit

22 months agoDon't reuse unprivileged cache when building as root
Daan De Meyer [Sun, 1 Oct 2023 08:26:12 +0000 (10:26 +0200)] 
Don't reuse unprivileged cache when building as root

When using --incremental and first building an image unprivileged,
followed by building it as root, we can't reuse the cache as the
ownership will be wrong. So let's make sure we don't reuse the
cache when that's the case.

22 months agobuild/cache dir name: append architecture
Luca Boccassi [Sat, 30 Sep 2023 13:13:18 +0000 (14:13 +0100)] 
build/cache dir name: append architecture

The builds and caches are architecture specific, so name them accordingly

22 months agoMerge pull request #1911 from keszybz/rhel-ubi
Daan De Meyer [Sat, 30 Sep 2023 12:57:18 +0000 (14:57 +0200)] 
Merge pull request #1911 from keszybz/rhel-ubi

Add support for RHEL UBI

22 months agoci: add nspawn boot of rhel-ubi 1911/head
Zbigniew Jędrzejewski-Szmek [Thu, 28 Sep 2023 14:42:48 +0000 (16:42 +0200)] 
ci: add nspawn boot of rhel-ubi

22 months agoAdd support for RHEL UBI
Zbigniew Jędrzejewski-Szmek [Wed, 20 Sep 2023 14:08:27 +0000 (16:08 +0200)] 
Add support for RHEL UBI

The repository naming matches what is visible in the standard ubi container
image (registry.access.redhat.com/ubi8/ubi).

This is the first time that I'm doing anything more complicated wit UBIs, but I
hope this is a sensible beginning.

22 months agodistributions: add .pretty_name
Zbigniew Jędrzejewski-Szmek [Fri, 29 Sep 2023 15:38:33 +0000 (17:38 +0200)] 
distributions: add .pretty_name

This makes it easier to print a message from the installer referring
to the distro by the proper name.

I looked at the home pages of the distros and took the spelling used
there. In particular Fedora is making a concious effort to use "Fedora"
for the whole project, and "Fedora Linux" for the distro. OTOH, Ubuntu
is known for not using "linux" anywhere where users could see it.

22 months agoDo not explicitly instantiate exceptions
Zbigniew Jędrzejewski-Szmek [Fri, 29 Sep 2023 15:36:27 +0000 (17:36 +0200)] 
Do not explicitly instantiate exceptions

This will happen automatically. If no arguments are needed, it's
more pythonic to just specify the class and let the interpreter
create the instance.

22 months agodistributions: use a generator to reduce list boilerplate
Zbigniew Jędrzejewski-Szmek [Thu, 28 Sep 2023 13:00:45 +0000 (15:00 +0200)] 
distributions: use a generator to reduce list boilerplate

When the list of repos to return is conditionalized, we can use yield instead
of concatenating lists. Iterable[Repo] can be satisfied by both the functions
which are generators and the functions which just return a list as before.

22 months agoCheck early whether 'ukify' is available
Zbigniew Jędrzejewski-Szmek [Thu, 28 Sep 2023 11:50:57 +0000 (13:50 +0200)] 
Check early whether 'ukify' is available

It is an optional component. The user would be unhappy when we fail at the end
of a lengthy installation process. So let's check early if we would need it and
refuse to continue.
(When config.bootable == ConfigFeature.auto, we cannot to do the check before
the installation is performed, so let's opt to be strict and do the check.)

Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=2240598.

22 months agoMerge pull request #1939 from behrmann/scriptenv
Daan De Meyer [Fri, 29 Sep 2023 09:14:22 +0000 (11:14 +0200)] 
Merge pull request #1939 from behrmann/scriptenv

Add more variables to the prepare script environment

22 months agoman: add a table which script receives what environment variable 1939/head
Joerg Behrmann [Thu, 28 Sep 2023 14:23:33 +0000 (16:23 +0200)] 
man: add a table which script receives what environment variable

22 months agotooltrees: add curl to default packages
Joerg Behrmann [Thu, 28 Sep 2023 13:46:04 +0000 (15:46 +0200)] 
tooltrees: add curl to default packages

This makes it easy to download a file from a prepare script when using a
default tool tree.

22 months agodistributions: rename all installers to "Installer"
Zbigniew Jędrzejewski-Szmek [Thu, 28 Sep 2023 12:39:57 +0000 (14:39 +0200)] 
distributions: rename all installers to "Installer"

We were doing "double namespacing": "centos.CentosInstaller",
"ubuntu.UbuntuInstaller", etc. Let's simplify things by dropping the second
name. This avoids the awkward issue how capitalize the names of distributions
that already have capitals in their name, e.g. CentoOS, or dashes in the name,
e.g. RHEL-UBI. The one call site where we import the right installer becomes
simpler.

In Distribution.installer(), try..except is replaced by assert. If the
installer class for a distro is missing, then it's a programming error and not
not something we should suppress.

22 months agoscripts: also pass WITH_ to prepare script
Joerg Behrmann [Thu, 28 Sep 2023 14:05:15 +0000 (16:05 +0200)] 
scripts: also pass WITH_ to prepare script

22 months agoscripts: sort environment variables we pass to scripts
Joerg Behrmann [Thu, 28 Sep 2023 14:04:45 +0000 (16:04 +0200)] 
scripts: sort environment variables we pass to scripts

22 months agoman: add missing spaces
Joerg Behrmann [Thu, 28 Sep 2023 12:14:32 +0000 (14:14 +0200)] 
man: add missing spaces

22 months agoUse user provided initrds for grub
Daan De Meyer [Thu, 28 Sep 2023 10:36:22 +0000 (12:36 +0200)] 
Use user provided initrds for grub

Let's only build a default initrd for grub if the user didn't
provide any initrds themselves.

22 months agoWrite IMAGE_ID and IMAGE_VERSION to /usr/lib/os-release
Joerg Behrmann [Tue, 26 Sep 2023 14:58:38 +0000 (16:58 +0200)] 
Write IMAGE_ID and IMAGE_VERSION to /usr/lib/os-release

22 months agoAdd Architecture match
Daan De Meyer [Thu, 28 Sep 2023 10:45:56 +0000 (12:45 +0200)] 
Add Architecture match

22 months agoAdd default implementations for a bunch of DistributionInstaller methods
Daan De Meyer [Thu, 28 Sep 2023 10:14:41 +0000 (12:14 +0200)] 
Add default implementations for a bunch of DistributionInstaller methods

Make it easier to add distributions by adding default implementations
for optional methods.

22 months agoFix setpgid logic
Daan De Meyer [Thu, 28 Sep 2023 07:18:55 +0000 (09:18 +0200)] 
Fix setpgid logic

Make sure we append the setpgid command after all the options. Let's
also use -- to avoid any potential confusion about whether the following
arguments are options or not.

22 months agoMerge pull request #1903 from gdiscry/scripts
Jörg Behrmann [Wed, 27 Sep 2023 15:06:40 +0000 (17:06 +0200)] 
Merge pull request #1903 from gdiscry/scripts

Convert script settings to lists

22 months agoConvert script settings to lists 1903/head
Georges Discry [Fri, 15 Sep 2023 20:19:41 +0000 (22:19 +0200)] 
Convert script settings to lists

With `mkosi.conf.d`, `mkosi.presets` and/or `[Match]`, it's become
really easy to split the configuration of an image in logical parts. It
might be done to isolate some settings that go together or to share the
same configuration across several images.

However, for each `mkosi.prepare`, `mkosi.build`, `mkosi.postinst` and
`mkosi.finalize` step, only one script could be executed as the one with
highest priority overrides the others.

Each script is now managed as a list of executables so that it's also
possible to split them if desired.

Backward compatibility is kind of maintained by keeping the same options
on the command line and by introducing aliases for the renamed INI
settings (with a deprecation warning). These aliases also parse the
settings as a list, so compatibility is still broken when a script was
expected to override a previously defined one, as they are now both
executed.

22 months agoBackward-compatibility for renamed INI settings
Georges Discry [Tue, 19 Sep 2023 11:44:18 +0000 (13:44 +0200)] 
Backward-compatibility for renamed INI settings

A setting can now declare aliases used when parsing INI files. These
aliases are useful when a setting is renamed as they maintain
backward-compatibility while emitting a deprecation warning.

22 months agoAlways copy kernel to split output
Daan De Meyer [Tue, 26 Sep 2023 10:35:33 +0000 (12:35 +0200)] 
Always copy kernel to split output

Even if we don't have a bootloader or aren't configured to be
bootable, make sure we copy a kernel out of the image so we can
linux direct boot images in qemu.

22 months agoMerge pull request #1926 from DaanDeMeyer/build-args
Daan De Meyer [Tue, 26 Sep 2023 09:37:10 +0000 (11:37 +0200)] 
Merge pull request #1926 from DaanDeMeyer/build-args

Pass command line arguments to build script again

22 months agoPass command line arguments to build script again 1926/head
Daan De Meyer [Tue, 26 Sep 2023 08:55:48 +0000 (10:55 +0200)] 
Pass command line arguments to build script again

It turns out this can be useful after all, for example to specify
whether to build in debug mode or release mode, or which config to
use when building kernels, so let's pass arguments to the build
script again.

22 months agoAdd util-linux to tools tree packages
Daan De Meyer [Tue, 26 Sep 2023 09:10:10 +0000 (11:10 +0200)] 
Add util-linux to tools tree packages

We need mount and various other tools from util-linux so let's make
sure it's installed as part of the default tools tree.

22 months agoRevert "CI: pin CentOS 9 kernel to workaround panic on shutdown"
Daan De Meyer [Tue, 26 Sep 2023 09:26:03 +0000 (11:26 +0200)] 
Revert "CI: pin CentOS 9 kernel to workaround panic on shutdown"

This reverts commit f9cd279e21cce2393bb0493c577f5c74a21e6914.

This issue was fixed upstream so let's revert the commit.

22 months agoMerge pull request #1923 from DaanDeMeyer/name
Daan De Meyer [Mon, 25 Sep 2023 12:56:07 +0000 (14:56 +0200)] 
Merge pull request #1923 from DaanDeMeyer/name

Mount over /etc/passwd when building an image and running build script

22 months agoMount over /etc/passwd when building an image and running build script 1923/head
Daan De Meyer [Mon, 25 Sep 2023 11:57:29 +0000 (13:57 +0200)] 
Mount over /etc/passwd when building an image and running build script

Various tools parse /etc/passwd, so let's make sure it contains the
expected lines when building an image. Also, when running the build
script, mount over /etc/passwd in the image as various build tools
will also query the current user in /etc/passwd (e.g. the kernel's
build script runs "whoami"). Also add a root entry to the /etc/passwd
we generate so both the user running mkosi and root are covered.

22 months agoMake sure we always clean up /work
Daan De Meyer [Mon, 25 Sep 2023 11:54:46 +0000 (13:54 +0200)] 
Make sure we always clean up /work

Currently we only clean up /work if the build script succeeds.
However, we have to always clean up /work since we don't make a
copy of the build overlay so let's make sure we do that by using
a trap instead of only cleaning up if a script succeeds.

Let's also make sure that we don't fail if /work already exists and
make sure that if gets the right permissions, even if it already
exists.

22 months agoMerge pull request #1922 from DaanDeMeyer/setpgid
Daan De Meyer [Mon, 25 Sep 2023 12:36:45 +0000 (14:36 +0200)] 
Merge pull request #1922 from DaanDeMeyer/setpgid

Use setpgid if available

22 months agoAlways set distribution in tests
Paul Meyer [Mon, 25 Sep 2023 11:58:19 +0000 (13:58 +0200)] 
Always set distribution in tests

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
22 months agoUse setpgid if available 1922/head
Daan De Meyer [Mon, 25 Sep 2023 11:00:52 +0000 (13:00 +0200)] 
Use setpgid if available

The next release of util-linux will include setpgid which has a
--foreground option that does exactly the same as our foreground()
function. This new utility allows us to make the processes executed
by bubblewrap the foreground process, which makes sure that SIGINT
isn't intercepted by bwrap.

22 months agoIntroduce find_binary()
Daan De Meyer [Mon, 25 Sep 2023 11:00:07 +0000 (13:00 +0200)] 
Introduce find_binary()

Let's introduce a more generic version of find_grub_binary() and
implement find_grub_binary() using it.

22 months agoDirectly ignore deprecated command-line options
Georges Discry [Fri, 22 Sep 2023 13:35:09 +0000 (15:35 +0200)] 
Directly ignore deprecated command-line options

A new argparse action is used for the deprecated command-line options.
There is no more need to post-process the parsed arguments as the action
directly takes care of displaying a deprecation warning while leaving
the namespace untouched.

A deprecated option is now obvious at its declaration (at the
`parser.add_argument()` call) and it can be dropped by simply deleting
that declaration.

22 months agoImmediately change directory on -C/--directory
Georges Discry [Fri, 22 Sep 2023 13:10:58 +0000 (15:10 +0200)] 
Immediately change directory on -C/--directory

Common utilities (e.g., make and tar) that have a `-C`/`--directory`
option immediately change the working directory when that option is
parsed, with the following properties:

- the option is order sensitive and only applies to the following
  options
- the option can be used multiple times and each is interpreted relative
  to the previous one

In addition, mkosi uses an empty path for `-C`/`--directory` to indicate
that the configuration files in the current directory should be ignored.

At first, mkosi would call `os.chdir()` after parsing the command-line
arguments, so the following options with relative paths would resolve
relative to the initial working directory and not the new one. This
issue was reported in #1879.

The fix in #1880 reversed that approach. A first (and lighter) pass on
the command-line arguments would get the last `-C`/`--directory` and
call `os.chdir()`. Afterwards, all the command-line arguments were fully
parsed so that the relative paths would resolve to that directory.

Neither approach implements the properties above. Only the last value is
used and applies to none/all of the command-line arguments.

By calling `os.chdir()` as the options are parsed, both properties are
respected and the arguments can be parsed in a single-pass. The
resulting directory is still tracked in `args.directory` but as a `Path`
object defaulting to `Path.cwd()`, with `None` indicating that the
configuration files should be ignored.

Furthermore, it's now possible to call `mkosi -C <dir> -C ''` to work in
a given directory (for the output and workspace) while also ignoring the
configuration files present in that directory.

22 months agoMerge pull request #1919 from DaanDeMeyer/uid
Daan De Meyer [Mon, 25 Sep 2023 09:21:21 +0000 (11:21 +0200)] 
Merge pull request #1919 from DaanDeMeyer/uid

Set MKOSI_UID and MKOSI_GID when running scripts

22 months agoSet MKOSI_UID and MKOSI_GID when running scripts 1919/head
Daan De Meyer [Mon, 25 Sep 2023 08:40:46 +0000 (10:40 +0200)] 
Set MKOSI_UID and MKOSI_GID when running scripts

These point to the UID/GID of the user running mkosi and can be used
to run commands as that user in scripts by using setpriv.

22 months agoCreate /work with relaxed permissions
Daan De Meyer [Mon, 25 Sep 2023 08:39:42 +0000 (10:39 +0200)] 
Create /work with relaxed permissions

We want to allow all users to access /work, so let's create it with
relaxed permissions. Let's also make sure we clean up the /work
directory after bwrap exits, so that whatever we do in bwrap doesn't
affect the cleanup of /work.

22 months agoRemove unused read_only argument from mount_overlay()
Daan De Meyer [Mon, 25 Sep 2023 08:25:46 +0000 (10:25 +0200)] 
Remove unused read_only argument from mount_overlay()

22 months agoRename $SCRIPT to $CHROOT_SCRIPT
Daan De Meyer [Mon, 25 Sep 2023 07:48:09 +0000 (09:48 +0200)] 
Rename $SCRIPT to $CHROOT_SCRIPT

This refers to a path in the chroot so let's make sure the naming
is consistent. We keep the old name as well for now to keep backwards
compat.

23 months agoMerge pull request #1917 from DaanDeMeyer/virtiofs
Daan De Meyer [Fri, 22 Sep 2023 15:13:26 +0000 (17:13 +0200)] 
Merge pull request #1917 from DaanDeMeyer/virtiofs

Two virtiofs improvements

23 months agoSkip UKI generation if the sd-stub is not installed 1917/head
Daan De Meyer [Fri, 22 Sep 2023 11:03:29 +0000 (13:03 +0200)] 
Skip UKI generation if the sd-stub is not installed

We don't fail if the stub is not installed and a bootable image is
explicitly requested as this is handled later on already in build_uki().

23 months agoDon't skip UKI generation when building a directory image
Daan De Meyer [Fri, 22 Sep 2023 11:01:51 +0000 (13:01 +0200)] 
Don't skip UKI generation when building a directory image

When building a cpio/UKI image, it doesn't generally make sense to
generate a UKI to put inside the cpio/UKI. This isn't entirely true
for directory images though, it could be that the directory image
is intended to be packed up as some kind of disk image later, so
let's not skip UKI generation automatically when building a directory
image.

23 months agoMake sure we put two slashes in autologin dropins
Daan De Meyer [Thu, 21 Sep 2023 14:49:48 +0000 (16:49 +0200)] 
Make sure we put two slashes in autologin dropins

By moving these into the python file we accidentally got rid of one
slash, let's add it back.

23 months agoRevert "ci: enable jammy-proposed-updates to test new libzypp"
Luca Boccassi [Thu, 21 Sep 2023 12:32:20 +0000 (13:32 +0100)] 
Revert "ci: enable jammy-proposed-updates to test new libzypp"

libzypp is now released in the updates repo, so no need to use
proposed-updates anymore

This reverts commit b6167c2047facda41aa73bd37907ba012e5c5e8a.

23 months agoMerge pull request #1913 from DaanDeMeyer/virtiofs-root
Daan De Meyer [Thu, 21 Sep 2023 11:36:39 +0000 (13:36 +0200)] 
Merge pull request #1913 from DaanDeMeyer/virtiofs-root

Support booting directory images in qemu

23 months agoPass split initrd as -initrd if it exists with directory image 1913/head
Daan De Meyer [Thu, 21 Sep 2023 09:25:56 +0000 (11:25 +0200)] 
Pass split initrd as -initrd if it exists with directory image

When we're booting a directory image, direct boot only works if the
kernel has the virtiofs driver builtin. Since this is not the case
for distribution kernels, let's make sure we pass the initrd to qemu
as well if one exists so that booting straight into a virtiofs can
also work with distro kernels provided an initrd is available.

23 months agoInsist on UKI when booting in UEFI firmware mode
Daan De Meyer [Thu, 21 Sep 2023 09:25:12 +0000 (11:25 +0200)] 
Insist on UKI when booting in UEFI firmware mode

When UEFI is requested, let's insist on booting a UKI instead of a
regular kernel image.

23 months agoUse root as tag name for virtiofs root
Daan De Meyer [Thu, 21 Sep 2023 09:23:26 +0000 (11:23 +0200)] 
Use root as tag name for virtiofs root

/dev/root makes systemd generate a device unit that will never appear
when using an initrd. Using root avoids that from happening.

23 months agoSupport booting directory images in qemu
Daan De Meyer [Wed, 20 Sep 2023 21:33:21 +0000 (23:33 +0200)] 
Support booting directory images in qemu

Using virtiofsd, we can boot straight into a virtiofs instance of
a directory image. This does require the virtiofsd instance to run
as (fake) root so we can't switch to the user running mkosi anymore
when running unprivileged but that shouldn't be a problem.

This also only works with kernels that have the virtiofs driver
builtin which I don't think is the case in any major distros yet.

23 months agoqemu: Make sure virtiofsd sock name is unique
Daan De Meyer [Wed, 20 Sep 2023 21:30:11 +0000 (23:30 +0200)] 
qemu: Make sure virtiofsd sock name is unique

We use the socket name as the tag for the virtiofs so it has to be
unique. We keep it within 36 bytes though as that's the max tag size.

23 months agoqemu: Make sure the memfd size matches the machine memory size
Daan De Meyer [Wed, 20 Sep 2023 21:29:18 +0000 (23:29 +0200)] 
qemu: Make sure the memfd size matches the machine memory size

This is required by qemu so let's make sure it's always satisfied.

23 months agoNetworking improvements
Daan De Meyer [Wed, 20 Sep 2023 21:03:56 +0000 (23:03 +0200)] 
Networking improvements

- ip= is also parsed by the kernel and can cause significant boot
  delays. We can avoid these delays by passing ip=none as the final
  value which doesn't affect network-generator but does disable the
  kernel auto-probing.
- Pull in network.target instead of network-online.target. This
  makes sure that systemd-networkd is started without introducing
  boot delays because we're waiting for an IP address to appear.

23 months agoAdd virtiofsd to default tools tree packages
Daan De Meyer [Wed, 20 Sep 2023 17:46:14 +0000 (19:46 +0200)] 
Add virtiofsd to default tools tree packages

23 months agoMerge pull request #1910 from DaanDeMeyer/virtiofs
Jörg Behrmann [Wed, 20 Sep 2023 15:23:01 +0000 (17:23 +0200)] 
Merge pull request #1910 from DaanDeMeyer/virtiofs

Add support for runtime trees

23 months agoAdd support for runtime trees 1910/head
Daan De Meyer [Wed, 20 Sep 2023 09:39:09 +0000 (11:39 +0200)] 
Add support for runtime trees

Let's allow mounting various directories into containers/VMs that
we run using a new RuntimeTrees= option. For containers, we use
nspawn's --bind option. For VMs, we use virtiofs along with the
virtiofsd project.

23 months agoFix typing errors
Daan De Meyer [Wed, 20 Sep 2023 13:55:16 +0000 (15:55 +0200)] 
Fix typing errors

23 months agoMerge pull request #1896 from behrmann/ruff
Daan De Meyer [Wed, 20 Sep 2023 08:01:26 +0000 (10:01 +0200)] 
Merge pull request #1896 from behrmann/ruff

Add ruff config to `pyprojects.toml` and address its warnings

23 months agoCheck if /init and /etc/initrd-release are symlinks
Malte Poll [Tue, 19 Sep 2023 13:14:35 +0000 (15:14 +0200)] 
Check if /init and /etc/initrd-release are symlinks

If /init in the image is a symlink to a file that doesn't exist on the host,
.exists() will return False.

Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
23 months agoRelease 17.1 v17.1
Luca Boccassi [Tue, 19 Sep 2023 12:27:11 +0000 (13:27 +0100)] 
Release 17.1

23 months agoInline autologin resources
Daan De Meyer [Tue, 19 Sep 2023 11:59:14 +0000 (13:59 +0200)] 
Inline autologin resources

When using a packaged mkosi with its resources in /usr, using a
tools tree breaks setting up autologin as the resources can't be loaded
anymore after mounting the tools tree. Let's fix the problem by inlining
the resources so they're immediately loaded. This isn't a problem
for the mkosi.md resource as it is never loaded after mounting a
tools tree.

23 months agoRelease 17 v17
Luca Boccassi [Tue, 19 Sep 2023 10:28:23 +0000 (11:28 +0100)] 
Release 17

23 months agoMerge pull request #1900 from keszybz/help-and-readme
Daan De Meyer [Tue, 19 Sep 2023 10:23:59 +0000 (12:23 +0200)] 
Merge pull request #1900 from keszybz/help-and-readme

Help and readme tweaks

23 months agoMerge pull request #1907 from DaanDeMeyer/news
Daan De Meyer [Tue, 19 Sep 2023 10:22:52 +0000 (12:22 +0200)] 
Merge pull request #1907 from DaanDeMeyer/news

Update NEWS

23 months agotreewide: address ruff warnings 1896/head
Joerg Behrmann [Tue, 19 Sep 2023 08:42:02 +0000 (10:42 +0200)] 
treewide: address ruff warnings

23 months agobuild: add section to configure ruff
Joerg Behrmann [Tue, 19 Sep 2023 08:39:29 +0000 (10:39 +0200)] 
build: add section to configure ruff

ruff [1] is a new very fast linter that combines rules from many commonly used
linters like pyflakes, isort or pyupgrade.

This commit uses the rules from pycodestyle (enabeled by default), pyflakes,
isort and pyupgrade and reintroduces the 119 character line length limit that
was used in the past with black and flake8, but was lost when black was disabled.

[1] https://github.com/astral-sh/ruff

23 months agoUpdate NEWS 1907/head
Daan De Meyer [Tue, 19 Sep 2023 08:32:12 +0000 (10:32 +0200)] 
Update NEWS

23 months agodebian: Add back dnf to default tools tree packages
Daan De Meyer [Tue, 19 Sep 2023 09:49:38 +0000 (11:49 +0200)] 
debian: Add back dnf to default tools tree packages

dnf was fixed so it'll be added back to testing soon so let's add
it back to the default tools tree packages for debian.

23 months agoWarn when a setting is in the wrong section
Georges Discry [Fri, 15 Sep 2023 20:01:26 +0000 (22:01 +0200)] 
Warn when a setting is in the wrong section

Except for the `[Match]` section, a setting can be set in any of the
valid sections because the actual section is ignored. This fuzziness
works because each setting is used in only one section so there is not
conflict.

Instead of silently parsing such a file, a warning is now displayed with
a hint on how to fix it. In the future, this could become an error.

23 months agoMake sure the root directory is a regular directory if Overlay= is enabled
Daan De Meyer [Mon, 18 Sep 2023 12:08:07 +0000 (14:08 +0200)] 
Make sure the root directory is a regular directory if Overlay= is enabled

overlayfs combined with a btrfs subvolume as the upperdir results in
EXDEV when trying to access files from a lowerdir, so let's make sure
we use a regular directory when Overlay= is enabled.

Fixes #1904

23 months agoReuse host /tmp in bwrap()
Daan De Meyer [Mon, 18 Sep 2023 11:50:47 +0000 (13:50 +0200)] 
Reuse host /tmp in bwrap()

If we replace /tmp, we'll also make any directories located in /tmp
inaccessible, e.g. the workspace directory. Work around the problem
by reusing the host's /tmp.

Fixes #1894

23 months agoAlways set distribution in tests
Paul Meyer [Mon, 11 Sep 2023 15:59:29 +0000 (17:59 +0200)] 
Always set distribution in tests

This enables executing the tests on distributions that aren't
targeted by mkosi. Before, the tests would fail as the detected
distribution was None.

Co-authored-by: Malte Poll <mp@edgeless.systems>
23 months agoDon't imply multiple architectures can be specified
Daan De Meyer [Mon, 11 Sep 2023 18:52:18 +0000 (20:52 +0200)] 
Don't imply multiple architectures can be specified

Only one can be specified at a time, not multiple.

Fixes #1891

23 months agoPrecompute long options
Georges Discry [Fri, 15 Sep 2023 19:18:51 +0000 (21:18 +0200)] 
Precompute long options

Like the `name` attribute used for the INI files, precompute the `long`
attribute used by argparse when it is derived from a setting's `dest`.

23 months agoREADME: also link to the repart talk 1900/head
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2023 15:26:03 +0000 (17:26 +0200)] 
README: also link to the repart talk

They mostly make sense together.

23 months agoFix synopsis in --help output
Zbigniew Jędrzejewski-Szmek [Mon, 11 Sep 2023 09:09:10 +0000 (11:09 +0200)] 
Fix synopsis in --help output

Indentation should be two spaces to match what argparse uses for all the help
options.

build does not take parameters anymore.

23 months agoBetter log message for --output
Zbigniew Jędrzejewski-Szmek [Mon, 11 Sep 2023 09:04:19 +0000 (11:04 +0200)] 
Better log message for --output

207af68047ce22777b06878b7efe77491a7c4108 broke backwards-compat. mkosi-initrd
used a call like this:
  mkosi --default /usr/lib/mkosi-initrd/fedora.mkosi --finalize-script=/usr/lib/mkosi-initrd/mkosi.finalize --image-version=6.5.0-0.rc7.20230821gitf7757129e3de.50.fc39.x86_64 --environment=KERNEL_VERSION=6.5.0-0.rc7.20230821gitf7757129e3de.50.fc39.x86_64 -o /tmp/kernel-install.staging.JEzApD/initrd
which is now refused with:
  /tmp/initrd is not a valid filename
which is not very clear, because "/tmp/initrd" is an OK filename.

Let's make the error message very clear about what is wrong.

23 months agoREADME: date references and add the newest talk
Joerg Behrmann [Fri, 15 Sep 2023 07:14:47 +0000 (09:14 +0200)] 
README: date references and add the newest talk

23 months agoMerge pull request #1898 from behrmann/community
Daan De Meyer [Wed, 13 Sep 2023 21:21:41 +0000 (23:21 +0200)] 
Merge pull request #1898 from behrmann/community

README: add a place to chat

23 months agoREADME: add a place to chat 1898/head
Joerg Behrmann [Wed, 13 Sep 2023 21:19:53 +0000 (23:19 +0200)] 
README: add a place to chat

23 months agoMerge pull request #1893 from behrmann/misctools
Daan De Meyer [Mon, 11 Sep 2023 16:17:08 +0000 (18:17 +0200)] 
Merge pull request #1893 from behrmann/misctools

Fixes for tools trees

23 months agotools: add ToolsTreePackages= 1893/head
Joerg Behrmann [Mon, 11 Sep 2023 13:03:33 +0000 (15:03 +0200)] 
tools: add ToolsTreePackages=

Since we are defaulting to testing for Debian tools trees, we will always fight
testing being occasionally broken, e.g. when packages disappear because their
newer versions can't transition from unstable.

ToolsTreePackages= adds the ability to keep using a default tools tree, but add
custom packages on top.

23 months agotools: remove dnf from the Debian tools tree packages
Joerg Behrmann [Mon, 11 Sep 2023 12:06:33 +0000 (14:06 +0200)] 
tools: remove dnf from the Debian tools tree packages

The package is currently not available in testing.

23 months agotools: use the same mirror as for other presets
Joerg Behrmann [Mon, 11 Sep 2023 12:06:20 +0000 (14:06 +0200)] 
tools: use the same mirror as for other presets