]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
3 years agoReduce duplication in centos variant repo setup 1036/head
Daan De Meyer [Thu, 7 Jul 2022 23:22:09 +0000 (01:22 +0200)] 
Reduce duplication in centos variant repo setup

3 years agoDrop HighAvailability repo for almalinux
Daan De Meyer [Thu, 7 Jul 2022 22:41:51 +0000 (00:41 +0200)] 
Drop HighAvailability repo for almalinux

Very niche repo for a very specific use case. Let's not enable it
by default for Alma Linux images. It can always be added back via
--repository-directory if needed.

3 years agoDrop centosplus repos and variants
Daan De Meyer [Thu, 7 Jul 2022 22:37:04 +0000 (00:37 +0200)] 
Drop centosplus repos and variants

These are primarily for the plus kernel, which isn't really maintained
so let's drop them from the centos variants repos list.

3 years agoDrop repo name field
Daan De Meyer [Thu, 7 Jul 2022 22:20:51 +0000 (00:20 +0200)] 
Drop repo name field

The configured repos don't end up in the actual image, so we don't
need to bother with a fancy name for the repos, let's just use the
repo ID instead and get rid of a bunch of cruft.

3 years agoUse the same install function for all centos variants
Daan De Meyer [Thu, 7 Jul 2022 22:12:12 +0000 (00:12 +0200)] 
Use the same install function for all centos variants

All the centos variants have different repos but install the
same packages, so let's have them all use the same install
function.

3 years agoIntroduce is_centos_variant() helper
Daan De Meyer [Thu, 7 Jul 2022 21:52:19 +0000 (23:52 +0200)] 
Introduce is_centos_variant() helper

3 years agoStop installing -release packages explicitly
Daan De Meyer [Thu, 7 Jul 2022 12:30:37 +0000 (14:30 +0200)] 
Stop installing -release packages explicitly

These get pulled in as dependencies by default so no need to install
them explicitly.

3 years agoUse distro~release subdirectories under mkosi.output/mkosi.builddir
Daan De Meyer [Tue, 19 Jul 2022 12:11:06 +0000 (14:11 +0200)] 
Use distro~release subdirectories under mkosi.output/mkosi.builddir

Currently, when using incremental mode, building for a different
release or distribution means throwing away the cached images for
the previous distribution or release used unless each distro/release
combo is configured with an explicit output directory. Let's try to
be smarter here, by using the same logic as used for the cache path.
We create distro~release subdirectory under mkosi.output/ and use that
as the output directory. This makes sure cached images stay intact
even if we build for a different distribution. The same reasoning
applies to mkosi.builddir/.

This will end up using slightly more disk space when building for many
different distros when using mkosi.output/, but this should be a good
tradeoff to make regardless. If looking to regain disk space, a user
simply has to remove the output or build subdirectory for the distros
they're not interested in keeping.

3 years agoarch: Move bios kernel-install workaround to install function
Daan De Meyer [Fri, 15 Jul 2022 21:01:46 +0000 (23:01 +0200)] 
arch: Move bios kernel-install workaround to install function

We can already create the symlinks early in the install function.
This removes one more distribution specific check.

3 years agoMake grub/grub2 check distribution independent
Daan De Meyer [Fri, 15 Jul 2022 20:34:06 +0000 (22:34 +0200)] 
Make grub/grub2 check distribution independent

Check if grub-install exists instead of hardcoding distributions

3 years agoMove machine ID directory in /boot workaround to install function
Daan De Meyer [Fri, 15 Jul 2022 20:16:25 +0000 (22:16 +0200)] 
Move machine ID directory in /boot workaround to install function

We can create the directory in the ubuntu/debian install function
and get rid of one more distribution check.

3 years agoMove configure_dracut() call outside of install functions
Daan De Meyer [Fri, 15 Jul 2022 20:12:26 +0000 (22:12 +0200)] 
Move configure_dracut() call outside of install functions

Every distro uses dracut now so let's call configure_dracut()
outside of the install functions.

3 years agoRemove dracut uefi_stub configuration
Daan De Meyer [Fri, 15 Jul 2022 20:03:07 +0000 (22:03 +0200)] 
Remove dracut uefi_stub configuration

We don't use dracut's --uefi option anymore so we don't need this
config anymore either.

3 years agoDrop Photon support
Daan De Meyer [Sun, 10 Jul 2022 19:03:55 +0000 (21:03 +0200)] 
Drop Photon support

Booting a systemd-nspawn container with a Photon image produced by
mkosi without --netdev waits for 2 minutes until "wait for network
to come online" times out. After logging in there's 3 failed services
in systemctl status. This is without trying to use any of mkosi's
more advanced features.

Bootable images are not supported at all on Photon. Given this and
the broken container support, it's clear that Photon support isn't
really usable at the moment and probably hasn't been for quite a
while (see #664).

Given that Photon has been broken for multiple releases and that
aside form #664, no one has bothered to report concrete issues or
make an attempt to fix the issues aside from a mirror update, this
gives us a pretty clear indication that no one is using or trying
to use mkosi to build Photon images.

Given that none of the existing maintainers are familiar with Photon
(and are likely not interested in doing the effort needed to support
it), let's drop the Photon support from mkosi.

3 years agoForce initializing the partition table every time create_image is called
Michael A Cassaniti [Thu, 21 Jul 2022 08:11:28 +0000 (18:11 +1000)] 
Force initializing the partition table every time create_image is called

When creating the build and final images `args.partition_table` is not
re-initialized which results in a mismatch between the on disk partition
layout and the records in memory.

Also added is some testing for UsrOnly.

3 years agoaction: Install dependencies in action repo checkout
Daan De Meyer [Tue, 26 Jul 2022 20:36:00 +0000 (22:36 +0200)] 
action: Install dependencies in action repo checkout

Since we symlink systemd-nspawn from the build directory to /usr/bin,
if the directory that nspawn was built in is cleaned up (e.g. via
git clean), systemd-nspawn is gone as well. To make it harder to
accidentally delete systemd-nspawn, let's clone and build all the
dependencies we compile from source in the repo checkout of the
action instead of in the repo of the project that's using the mkosi
action.

3 years agoci: Disable gentoo until upstream issue is fixed
Daan De Meyer [Tue, 26 Jul 2022 11:57:41 +0000 (13:57 +0200)] 
ci: Disable gentoo until upstream issue is fixed

3 years agoaction: bump archlinux-keyring to 20220713
Frantisek Sumsal [Tue, 26 Jul 2022 17:36:01 +0000 (19:36 +0200)] 
action: bump archlinux-keyring to 20220713

3 years agoFix debian releases w/o updates and security fixes
Rémi Palancher [Mon, 25 Jul 2022 13:00:55 +0000 (15:00 +0200)] 
Fix debian releases w/o updates and security fixes

Actually Debian testing release has security updates available, metadata
are available at these URL:

http://ftp.debian.org/debian/dists/testing-updates/
http://security.debian.org/debian-security/dists/testing-security/

However, sid (the other name of unstable) does not have additional
security updates repositories, as fixes land in sid main repository
directly.

3 years agoActually apply --source-file-transfer=mount when booting with nspawn
Daan De Meyer [Thu, 21 Jul 2022 10:51:08 +0000 (12:51 +0200)] 
Actually apply --source-file-transfer=mount when booting with nspawn

3 years agoAllow --source-file-transfer-final=mount when booting in nspawn
Daan De Meyer [Fri, 15 Jul 2022 00:36:00 +0000 (02:36 +0200)] 
Allow --source-file-transfer-final=mount when booting in nspawn

3 years agoFixed regression when using UsrOnly during initial install
Michael A Cassaniti [Thu, 21 Jul 2022 01:39:44 +0000 (11:39 +1000)] 
Fixed regression when using UsrOnly during initial install

Several distributions call `run_workspace_command()` during installation and
this now requires the root directory that gets bind mounted in to exist. The
created directory will be removed anyway since it exists under a temporary
workspace.

As an example, the documentation removal when installing a Debian derivative
will fail without this change.

3 years agoMerge pull request #1071 from behrmann/always-arch
Jörg Behrmann [Tue, 19 Jul 2022 14:31:46 +0000 (16:31 +0200)] 
Merge pull request #1071 from behrmann/always-arch

Always define args.architecture and add args.architecture_is_native

3 years agoAlways define args.architecture and add args.architecture_is_native() 1071/head
Joerg Behrmann [Tue, 19 Jul 2022 11:43:31 +0000 (13:43 +0200)] 
Always define args.architecture and add args.architecture_is_native()

3 years agoRemove mkosi.files/ directory
Daan De Meyer [Mon, 18 Jul 2022 16:59:00 +0000 (18:59 +0200)] 
Remove mkosi.files/ directory

These configs are just bitrotting and we don't use them for anything.
Let's drop the directory.

3 years agoFixed running prepare and post-install scripts when UsrOnly is in use
Michael A Cassaniti [Mon, 18 Jul 2022 01:26:28 +0000 (11:26 +1000)] 
Fixed running prepare and post-install scripts when UsrOnly is in use

Includes moving root_home() to backend

3 years agoExplicitly adding partition after creating
Michael A Cassaniti [Mon, 18 Jul 2022 03:55:12 +0000 (13:55 +1000)] 
Explicitly adding partition after creating

This resolves an exception when the partition is explicitly removed later

3 years agoCopy systemd manager conf to initrd if set
Daan De Meyer [Sat, 16 Jul 2022 09:23:59 +0000 (11:23 +0200)] 
Copy systemd manager conf to initrd if set

3 years agoMerge pull request #1063 from DaanDeMeyer/copy-git-dir
Daan De Meyer [Mon, 18 Jul 2022 08:50:50 +0000 (10:50 +0200)] 
Merge pull request #1063 from DaanDeMeyer/copy-git-dir

Handle directories when copying untracked git files

3 years agoPass environment when running kernel-install as well
Daan De Meyer [Sat, 16 Jul 2022 09:26:03 +0000 (11:26 +0200)] 
Pass environment when running kernel-install as well

3 years agoHandle directories when copying untracked git files 1063/head
Daan De Meyer [Sun, 17 Jul 2022 20:13:19 +0000 (22:13 +0200)] 
Handle directories when copying untracked git files

3 years agoUse Path() a bit more in copy_git_files
Daan De Meyer [Sun, 17 Jul 2022 20:07:46 +0000 (22:07 +0200)] 
Use Path() a bit more in copy_git_files

3 years agoDrop bundle package type
Daan De Meyer [Wed, 13 Jul 2022 09:03:33 +0000 (11:03 +0200)] 
Drop bundle package type

Unused now that Clear Linux isn't supported anymore

3 years agoci: pin pyright version
Joerg Behrmann [Wed, 13 Jul 2022 09:02:46 +0000 (11:02 +0200)] 
ci: pin pyright version

3 years agoMerge pull request #1038 from DaanDeMeyer/drop-arch-hooks
Jörg Behrmann [Wed, 13 Jul 2022 09:12:27 +0000 (11:12 +0200)] 
Merge pull request #1038 from DaanDeMeyer/drop-arch-hooks

arch: Drop pacman kernel install hooks

3 years agoMerge pull request #1043 from DaanDeMeyer/fedora-fixes
Jörg Behrmann [Wed, 13 Jul 2022 08:05:01 +0000 (10:05 +0200)] 
Merge pull request #1043 from DaanDeMeyer/fedora-fixes

Fedora fixes

3 years agoarch: Add symlinks to /boot for kernel and initrd when using bios 1038/head
Daan De Meyer [Thu, 7 Jul 2022 18:12:47 +0000 (20:12 +0200)] 
arch: Add symlinks to /boot for kernel and initrd when using bios

Grub doesn't support the boot loader spec on Arch so we have to
symlink vmlinuz and the initrd to some place where grub can find
them.

3 years agoIntroduce boot_directory() function
Daan De Meyer [Thu, 7 Jul 2022 18:12:24 +0000 (20:12 +0200)] 
Introduce boot_directory() function

Deduplicates some repeated logic

3 years agoExplicitly configure kernel-install layout as "bls"
Daan De Meyer [Thu, 7 Jul 2022 18:11:14 +0000 (20:11 +0200)] 
Explicitly configure kernel-install layout as "bls"

3 years agoarch: Drop pacman kernel install hooks
Daan De Meyer [Thu, 7 Jul 2022 13:34:53 +0000 (15:34 +0200)] 
arch: Drop pacman kernel install hooks

We shouldn't special case updates Arch if we don't do so on other
distros either. We don't guarantee availability of a package
manager in generated images, and the only reason Arch images ship
with pacman is because it's part of the base group. This might
change in the future and as such, there's no guarantee that Arch
images will always have pacman. Hence, let's remove the pacman hooks
we install for Arch to bring it more in line with the other distros.

3 years agofedora: Don't modify args.release in install_fedora() 1043/head
Daan De Meyer [Sat, 9 Jul 2022 16:14:28 +0000 (18:14 +0200)] 
fedora: Don't modify args.release in install_fedora()

Causes failures when building incremental images because we change
rawhide-f37 to rawhide which means f36 is picked when building the
final images.

3 years agoAdd Fedora 37 GPG key
Daan De Meyer [Sat, 9 Jul 2022 15:48:05 +0000 (17:48 +0200)] 
Add Fedora 37 GPG key

3 years agoMerge pull request #1046 from DaanDeMeyer/clear-linux-docs
Jörg Behrmann [Tue, 12 Jul 2022 12:55:44 +0000 (14:55 +0200)] 
Merge pull request #1046 from DaanDeMeyer/clear-linux-docs

Add NEWS entry for Clear Linux removal

3 years agoAdd NEWS entry for Clear Linux removal 1046/head
Daan De Meyer [Tue, 12 Jul 2022 12:53:13 +0000 (14:53 +0200)] 
Add NEWS entry for Clear Linux removal

3 years agoMerge pull request #1037 from DaanDeMeyer/drop-clear
Jörg Behrmann [Tue, 12 Jul 2022 12:45:18 +0000 (14:45 +0200)] 
Merge pull request #1037 from DaanDeMeyer/drop-clear

Drop Clear Linux support

3 years agoopensuse: do not attempt to overwrite pam.d/common-auth
Luca Boccassi [Sun, 10 Jul 2022 23:06:50 +0000 (00:06 +0100)] 
opensuse: do not attempt to overwrite pam.d/common-auth

Tumbleweed builds started to fail:

  File /usr/local/lib/python3.10/dist-packages/mkosi/__init__.py, line 3225, in install_opensuse
    shutil.copy2(root / usr/etc/pam.d/common-auth, root / etc/pam.d/common-auth)
  File /usr/lib/python3.10/shutil.py, line 434, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File /usr/lib/python3.10/shutil.py, line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/var/tmp/mkosi-vb08b_gb/root/usr/etc/pam.d/common-auth'

/etc/pam.d/common-auth is already installed now. Do not attempt to
overwrite it if it already exists.

3 years agoMerge pull request #1039 from DaanDeMeyer/fix-docs
Jörg Behrmann [Fri, 8 Jul 2022 09:17:13 +0000 (11:17 +0200)] 
Merge pull request #1039 from DaanDeMeyer/fix-docs

Fix --release docs

3 years agoFix --release docs 1039/head
Daan De Meyer [Thu, 7 Jul 2022 13:40:36 +0000 (15:40 +0200)] 
Fix --release docs

3 years agoDrop Clear Linux support 1037/head
Daan De Meyer [Thu, 7 Jul 2022 12:49:04 +0000 (14:49 +0200)] 
Drop Clear Linux support

Due to lack of a maintainer, and deviating from established practices
almost universally (custom bootloader, custom package manager, ...),
it's not productive to keep support for Clear Linux in mkosi. We have
no idea if it works at all, no idea if something we do is going to
break it, and haven't received any feedback from Clear Linux users
for multiple years. Hence let's drop support for Clear Linux from
mkosi to reduce maintenance costs.

3 years agoaction: Update systemd-container workaround point release
Daan De Meyer [Wed, 6 Jul 2022 10:33:48 +0000 (12:33 +0200)] 
action: Update systemd-container workaround point release

The previous one isn't available anymore but the issue isn't fixed
yet so let's update the pinned version to fix the issue for now.

3 years agoAdd --cache-initrd option
Daan De Meyer [Tue, 5 Jul 2022 13:44:01 +0000 (15:44 +0200)] 
Add --cache-initrd option

Building initrds is slow, let's add an option that allows building
the initrd as part of a cached image so that's it's only built once
and reused in any final images.

3 years agoMake sure we extend the parent env instead of overriding it in run()
Daan De Meyer [Tue, 5 Jul 2022 09:48:39 +0000 (11:48 +0200)] 
Make sure we extend the parent env instead of overriding it in run()

This makes sure any environment variables set in the parent env
don't suddenly stop working when we set our own (e.g. proxy env
variables).

3 years agoMerge pull request #1027 from DaanDeMeyer/enotty
Jörg Behrmann [Mon, 27 Jun 2022 12:47:47 +0000 (14:47 +0200)] 
Merge pull request #1027 from DaanDeMeyer/enotty

Ignore ENOTTY in copy_file_object() and copy_fd()

3 years agoIgnore ENOTTY in copy_file_object() and copy_fd() 1027/head
Daan De Meyer [Mon, 27 Jun 2022 12:29:27 +0000 (14:29 +0200)] 
Ignore ENOTTY in copy_file_object() and copy_fd()

This is another possible error that can be returned when FICLONE is
not supported.

3 years agoaction: Pin systemd-container version
Daan De Meyer [Fri, 24 Jun 2022 10:04:35 +0000 (12:04 +0200)] 
action: Pin systemd-container version

A faulty metadata update in Github Actions azure mirror for Ubuntu
is causing issues with unmet systemd-container versions. Let's pin
the systemd-container version as a workaround until the issue is
fixed.

3 years agoVersion 13 v13
Zbigniew Jędrzejewski-Szmek [Tue, 21 Jun 2022 17:26:46 +0000 (19:26 +0200)] 
Version 13

3 years agoNEWS: reformat
Zbigniew Jędrzejewski-Szmek [Tue, 21 Jun 2022 17:25:12 +0000 (19:25 +0200)] 
NEWS: reformat

3 years agoUpdate NEWS
Daan De Meyer [Tue, 21 Jun 2022 13:34:21 +0000 (15:34 +0200)] 
Update NEWS

3 years agoaction: Add stanzas to copy sources to action mkosi config
Daan De Meyer [Mon, 20 Jun 2022 19:21:20 +0000 (21:21 +0200)] 
action: Add stanzas to copy sources to action mkosi config

To be able to run the development version of mkosi in a ubuntu VM,
let's copy the sources into the mkosi config we use to test the
action setup logic.

3 years agoAdd support for qemu's direct Linux boot
Daan De Meyer [Mon, 7 Mar 2022 16:10:41 +0000 (16:10 +0000)] 
Add support for qemu's direct Linux boot

We add a "linux" boot protocol that, when enabled, instructs mkosi
to extract the kernel image, initrd and kernel cmdline out of the
image when building it.

On top, we add a --qemu-boot option that takes one of the possible
values from --boot-protocols and instructs qemu to use that boot
protocol. In case of the new "linux" boot protocol, we use qemu's
-kernel, -initrd and -append options to do a direct Linux kernel
boot.

Being able to do direct Linux boots with qemu is a prerequisite for
booting images of architectures that don't support UEFI in qemu. It's
also faster than booting in UEFI mode which is useful when iterating
and not working on the bootloader.

3 years agoMerge pull request #1004 from keszybz/handle-rpmdb-move
Daan De Meyer [Mon, 20 Jun 2022 21:08:32 +0000 (23:08 +0200)] 
Merge pull request #1004 from keszybz/handle-rpmdb-move

Handle rpmdb move

3 years agomkosi/manifest: allow errors from rpm/dpkg 1004/head
Zbigniew Jędrzejewski-Szmek [Mon, 20 Jun 2022 19:10:13 +0000 (21:10 +0200)] 
mkosi/manifest: allow errors from rpm/dpkg

3 years agoMerge pull request #911 from DaanDeMeyer/stat-fixes
Jörg Behrmann [Mon, 20 Jun 2022 18:28:01 +0000 (20:28 +0200)] 
Merge pull request #911 from DaanDeMeyer/stat-fixes

Only copystat() on newly created directories in copy_path()

3 years agoMerge pull request #1018 from DaanDeMeyer/pytest-output
Jörg Behrmann [Mon, 20 Jun 2022 18:26:21 +0000 (20:26 +0200)] 
Merge pull request #1018 from DaanDeMeyer/pytest-output

ci: Show output by default

3 years agoDefine bogus variable to work around pyright stupidity
Zbigniew Jędrzejewski-Szmek [Mon, 20 Jun 2022 13:21:02 +0000 (15:21 +0200)] 
Define bogus variable to work around pyright stupidity

3 years agomkosi: link /var/lib/rpm to /usr/lib/sysimage/rpm for compat with old rpm
Zbigniew Jędrzejewski-Szmek [Fri, 10 Jun 2022 15:38:08 +0000 (17:38 +0200)] 
mkosi: link /var/lib/rpm to /usr/lib/sysimage/rpm for compat with old rpm

This (partially) fixes #993. There are two aspects of compatiblity: rpm changed
the db backend from bdb to sqlite, and the location was changed. This patch
resolves the second issue. It does using the same logic that e.g. Fedora uses
after the move. But it doesn't do anything for the first part. But luckily, rpm
in Rocky/Centos 8 is linked with support for sqlite, so things work.

We need to unlink /var/lib/rpm because something creates it during
installation. I wanted to just create the symlink if there's nothing there,
but that doesn't work.

3 years agomkosi: when cleaning rpm data, also nuke /usr/lib/sysimage/rpm
Zbigniew Jędrzejewski-Szmek [Fri, 10 Jun 2022 14:46:25 +0000 (16:46 +0200)] 
mkosi: when cleaning rpm data, also nuke /usr/lib/sysimage/rpm

F36 moved rpm db there. SUSE has been using this location for a while.
So our cleaning of rpm data wasn't effective.

3 years agomkosi: add helper to reduce duplicated code
Zbigniew Jędrzejewski-Szmek [Fri, 10 Jun 2022 14:42:47 +0000 (16:42 +0200)] 
mkosi: add helper to reduce duplicated code

The same logic was used for dnf/tdnf/rpm/dpkg/apt, so let's split
it out to a helper.

I opted to use full paths with "/". Such paths are easier to read
and we avoid the risk of removing something from the host if somebody
uses an absolute path by mistake.

3 years agoaction: Build only systemd-nspawn
Daan De Meyer [Mon, 20 Jun 2022 14:31:05 +0000 (16:31 +0200)] 
action: Build only systemd-nspawn

Speed things up by only building nspawn instead of the entirety of
systemd.

3 years agoDrop sfdisk grain support check
Daan De Meyer [Mon, 20 Jun 2022 11:21:08 +0000 (13:21 +0200)] 
Drop sfdisk grain support check

This check doesn't actually work on Fedora so let's drop it until
we can find a better check.

3 years agoMerge pull request #1017 from DaanDeMeyer/debian-systemd-boot
Daan De Meyer [Mon, 20 Jun 2022 14:37:29 +0000 (16:37 +0200)] 
Merge pull request #1017 from DaanDeMeyer/debian-systemd-boot

debian/ubuntu: Handle scenario where systemd-boot is a split package

3 years agoMerge pull request #974 from DaanDeMeyer/ci-jammy
Daan De Meyer [Mon, 20 Jun 2022 13:41:36 +0000 (15:41 +0200)] 
Merge pull request #974 from DaanDeMeyer/ci-jammy

ci: Update to Ubuntu 22.04 LTS

3 years agoci: Show output by default 1018/head
Daan De Meyer [Mon, 20 Jun 2022 12:51:10 +0000 (14:51 +0200)] 
ci: Show output by default

Let's have pytest show output even for successful tests. This helps
with debugging issues that aren't related to a failing test (e.g.
why is gentoo slow to build).

3 years agodebian/ubuntu: Handle scenario where systemd-boot is a split package 1017/head
Daan De Meyer [Mon, 20 Jun 2022 12:28:31 +0000 (14:28 +0200)] 
debian/ubuntu: Handle scenario where systemd-boot is a split package

Recent version of systemd in Debian/Ubuntu made systemd-boot a split
package. Let's make sure we handle this case correctly.

3 years agoRefactor run_workspace_command()
Daan De Meyer [Mon, 20 Jun 2022 12:24:21 +0000 (14:24 +0200)] 
Refactor run_workspace_command()

3 years agoci: Avoid permission error by testing system installation last 974/head
Daan De Meyer [Mon, 16 May 2022 15:06:10 +0000 (17:06 +0200)] 
ci: Avoid permission error by testing system installation last

3 years agoaction: Use /etc/os-release as cache key instead of runner.os
Daan De Meyer [Sun, 22 May 2022 08:50:12 +0000 (10:50 +0200)] 
action: Use /etc/os-release as cache key instead of runner.os

3 years agoDefault to -cpu max when running VMs using QEMU
Daan De Meyer [Wed, 16 Feb 2022 10:46:42 +0000 (10:46 +0000)] 
Default to -cpu max when running VMs using QEMU

Currently, we don't specify the -cpu option when running under the TCG
accelerator. This leads QEMU to choose a very conservative default that
doesn't emulate all the instructions that modern distros are compiled with.
To avoid such issues, let's default to having QEMU emulate as many CPU
instructions as possible to avoid illegal opcode errors when running
virtual machines.

3 years agoChange --qemu-smp default from 2 to 1
Daan De Meyer [Wed, 16 Feb 2022 10:44:41 +0000 (10:44 +0000)] 
Change --qemu-smp default from 2 to 1

When trying to a boot a centos epel VM using QEMU, it will hang during
boot if the qemu smp option is set to a number higher than 1. To avoid
this and similar issues, let's default to 1 core per VM. If users need
more they can always configure the option explicitly.

3 years agoaction: Compile systemd-nspawn v251 from source
Daan De Meyer [Wed, 18 May 2022 10:09:11 +0000 (12:09 +0200)] 
action: Compile systemd-nspawn v251 from source

3 years agoDon't override stat of destination root when using copy_path() 911/head
Daan De Meyer [Mon, 21 Feb 2022 14:54:31 +0000 (14:54 +0000)] 
Don't override stat of destination root when using copy_path()

Fixes unexpected scenarios where we modify the permissions of / when
using mkosi.extra/. See https://github.com/systemd/systemd/pull/22569#issuecomment-1045992142
for more information.

3 years agoci: Update to Ubuntu 22.04 LTS
Daan De Meyer [Mon, 16 May 2022 14:57:02 +0000 (16:57 +0200)] 
ci: Update to Ubuntu 22.04 LTS

Note: The LTS image is still in beta (https://github.com/actions/virtual-environments/issues/5490).

In Jammy, we have recent versions of zypper and dnf packaged so we
don't have to build them from source anymore. Also, sq is packaged
so we don't have to build sq from source anymore either.

The setup-github-actions.sh script is renamed to setup-pacman.sh
and it's reduced to only install the dependencies necessary to
build pacman and archlinux-keyring.

All other dependencies are moved to action.yaml and the action
mkosi.default script.

3 years agoCommunicate the associated dir in the ESP via /etc/kernel/entry-token
Daan De Meyer [Thu, 16 Jun 2022 21:43:45 +0000 (17:43 -0400)] 
Communicate the associated dir in the ESP via /etc/kernel/entry-token

/etc/kernel/entry-token is the new way introduced in systemd v251 to
identify the directory that kernel-install and bootctl should install
their stuff to. If it exists, bootctl and kernel-install will read it
and use the directory inside to install things to.

Currently, in mkosi, we generate a random machine ID during the build
and use that as the directory under the ESP to install things to. Until
all distros we support get support for /etc/kernel/entry-token, we're
limited to using the machine ID as the directory to install stuff under
in the ESP.

Since the machine ID used during the build is scrubbed from the image,
users don't a way to figure out the directory in the ESP associated
with the rootfs after the build is finished. To fix this, let's write
the machine ID to /etc/kernel/entry-token before it is scrubbed so
that users can read the file to figure out which directory in the ESP
that they should look under to find stuff associated with the
corresponding rootfs.

Fixes #686

3 years agoMerge pull request #1007 from DaanDeMeyer/always-initrd
Zbigniew Jędrzejewski-Szmek [Mon, 20 Jun 2022 09:39:17 +0000 (11:39 +0200)] 
Merge pull request #1007 from DaanDeMeyer/always-initrd

Rework initramfs generation (again)

3 years agoMerge pull request #1015 from pyfisch/veritysetup
Jörg Behrmann [Mon, 20 Jun 2022 07:05:17 +0000 (09:05 +0200)] 
Merge pull request #1015 from pyfisch/veritysetup

Add veritysetup.target to initrd

3 years agoAdd veritysetup.target to initrd 1015/head
Pyfisch [Sun, 19 Jun 2022 15:04:26 +0000 (17:04 +0200)] 
Add veritysetup.target to initrd

The target is needed so that usr and root partitions
can be verified and mounted early during boot.

Closes #1014

3 years agoStop installing binutils 1007/head
Daan De Meyer [Mon, 13 Jun 2022 15:19:02 +0000 (11:19 -0400)] 
Stop installing binutils

Because we use objcopy from the host, there's no need to install
binutils in images anymore.

3 years agoRework initramfs generation (again)
Daan De Meyer [Mon, 13 Jun 2022 15:09:00 +0000 (11:09 -0400)] 
Rework initramfs generation (again)

Currently, when building without unified kernel images, the generated
initramfs is generated as part of running the package manager for the
first time. Because of this, none of the changes made to the rootfs
after running the package manager (build script, extra-trees, postinst
script, ...) are taken into account when generating the initramfs. Also,
when building with unified kernel images, the generated initramfs does
take all changes made to the image into account.

To solve this inconsistency, let's generate the initrd manually instead
of relying on the package manager to do it for us. With the addition
of KERNEL_INSTALL_BYPASS, we can skip initramfs generation when
kernel-install is called by a post-installation script to generate the
initramfs. Similarly, we can use the INITRD environment variable to
do the same on Debian/Ubuntu systems.

To generate the initramfs manually, we simply call kernel-install at
a later point in the image build process. Because kernel-install doesn't
actually regenerate the initramfs on Debian/Ubuntu, we call
"dpkg-reconfigure dracut" there to make sure the initramfs is regenerated
before calling kernel-install.

Finally, because we now make sure the initramfs always includes all changes
made to the image, we modify install_unified_kernel() to call objcopy
again instead of dracut as we used to do but had to revert because calling
objcopy meant the initramfs wasn't regenerated.

3 years agoRename run_pacman() to invoke_pacman()
Daan De Meyer [Mon, 13 Jun 2022 15:04:13 +0000 (11:04 -0400)] 
Rename run_pacman() to invoke_pacman()

We already have invoke_dnf() and invoke_apt() so let's have
invoke_pacman() for consistency.

3 years agoMerge pull request #1012 from DaanDeMeyer/fix-ssh
Daan De Meyer [Fri, 17 Jun 2022 18:37:37 +0000 (14:37 -0400)] 
Merge pull request #1012 from DaanDeMeyer/fix-ssh

machine: Add retries for ssh

3 years agoHave run_ssh_cmdline() return List instead of Sequence 1012/head
Daan De Meyer [Fri, 17 Jun 2022 18:35:16 +0000 (14:35 -0400)] 
Have run_ssh_cmdline() return List instead of Sequence

3 years agomachine: Add retries for ssh
Daan De Meyer [Fri, 17 Jun 2022 14:16:18 +0000 (10:16 -0400)] 
machine: Add retries for ssh

We've been seeing quite a bit of "connection refused" errors in CI.
These are likely happening because sshd hasn't finished starting
yet.

The proper fix for this is to add notify socket support for systemd
running qemu VMs via virtio sockets, but even if that's added, it
will be a very long time before we can rely on it.

For now, let's add a retry mechanism for SSH connections to make
our CI setup more reliable.

3 years agoRefactor command running in integration tests
Daan De Meyer [Fri, 17 Jun 2022 14:13:49 +0000 (10:13 -0400)] 
Refactor command running in integration tests

Let's move run_command_image() into Machine.run(), introduce
run_systemd_cmdline() to get the systemd-run command line, and
remove all arguments from run_ssh() that aren't required anymore
now.

3 years agoDrop choices param from --debug option spec
Daan De Meyer [Thu, 16 Jun 2022 21:05:36 +0000 (17:05 -0400)] 
Drop choices param from --debug option spec

Using choices prevents us from passing multiple options so let's drop
it for now.

Fixes #1006

3 years agomkosi: optimize/fix patching of root part-type uuid
Zbigniew Jędrzejewski-Szmek [Fri, 10 Jun 2022 13:54:00 +0000 (15:54 +0200)] 
mkosi: optimize/fix patching of root part-type uuid

The bug was that the part-type write we did would get overwritten when the
partition table was subsequently rewritten when we were adding the verity and
verity-sig paritions. We don't need to write out the part-type manually, it's
enough to store the right value in our partition list. This makes things a bit
faster too.

We know that if we calculated the verity info, we'll insert a partition soon
after and then it'll get written correctly.

‣  Generating verity hashes…
Root partition-type UUID: 25e87685-6aa9-86be-a9e3-71d020f407fe
‣  Inserting verity partition…

Fixes #997.

3 years agoMerge pull request #1009 from DaanDeMeyer/arch-pacman-gpgdir-host
Daan De Meyer [Thu, 16 Jun 2022 13:32:37 +0000 (09:32 -0400)] 
Merge pull request #1009 from DaanDeMeyer/arch-pacman-gpgdir-host

arch: Use gpgdir from host system

3 years agoarch: Use gpgdir from host system 1009/head
Daan De Meyer [Wed, 15 Jun 2022 20:24:41 +0000 (16:24 -0400)] 
arch: Use gpgdir from host system

Instead of setting up the keyring in the image, let's reuse the
keyring from the host. If users want to use pacman in the image,
they just have to run pacman-key themselves in a postinst script
or such.

This speeds up building of images and hopefully also gets rid of
our CI issues with Arch where there's something keeping files open
in the root mount (which I expect is gpg-agent).

3 years agoFix losetup race condition with initializing partition devices
Daan De Meyer [Fri, 20 May 2022 13:05:09 +0000 (15:05 +0200)] 
Fix losetup race condition with initializing partition devices

This fixes the same issue we've seen in the systemd repo where
using PARTSCAN introduces a race condition with trying to use
the partition device since the kernel initializes the partition
devices asynchronously. To avoid the issue, we initialize partition
devices manually using the BLKPG ioctl(). We also avoid the same
problem on detaching loop devices by removing partition devices
explicitly using the BLKPG ioctl().

See https://github.com/systemd/systemd/pull/22992,
https://github.com/systemd/systemd/pull/23427,
https://github.com/systemd/systemd/issues/23174 and
https://github.com/systemd/systemd/issues/17469 for more context.

3 years agoMerge pull request #958 from keszybz/help-formatting
Daan De Meyer [Fri, 10 Jun 2022 10:33:18 +0000 (11:33 +0100)] 
Merge pull request #958 from keszybz/help-formatting

Tweaks to argparse setup to make --help output nicer

3 years agomkosi: fix typo 958/head
Zbigniew Jędrzejewski-Szmek [Fri, 10 Jun 2022 08:36:11 +0000 (10:36 +0200)] 
mkosi: fix typo