]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
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 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

3 years agodocs: say 'git ls-files' instead of 'git-ls-files'
Zbigniew Jędrzejewski-Szmek [Tue, 26 Apr 2022 12:55:58 +0000 (14:55 +0200)] 
docs: say 'git ls-files' instead of 'git-ls-files'

The version with the hyphen hasn't been in $PATH for years, let's not
confuse our younger users.

3 years agodocs: regenerate the man page
Zbigniew Jędrzejewski-Szmek [Tue, 26 Apr 2022 12:56:19 +0000 (14:56 +0200)] 
docs: regenerate the man page

3 years agoImprove wrapping of long texts in --help
Zbigniew Jędrzejewski-Szmek [Tue, 26 Apr 2022 12:52:07 +0000 (14:52 +0200)] 
Improve wrapping of long texts in --help

The default formatter would wrap all text into a single paragraph,
which is rather hard to read in case when we have a list of options
and an explanation for each of the values. Let's add a custom formatter.

Also, never split option names or other words.

Part of output wrapped to the default 80 columns:
  --source-file-transfer-final METHOD
                        How to copy build sources to the final image:
                        'copy-all': normal file copy
                        'copy-git-cached': use git ls-files --cached, ignoring
                            any file that git itself ignores
                        'copy-git-others': use git ls-files --others, ignoring
                            any file that git itself ignores
                        'copy-git-more': use git ls-files --cached, ignoring
                            any file that git itself ignores, but include the
                            .git/ directory
                        (default: None)
  --source-resolve-symlinks [BOOL]
                        If true, symbolic links in the build sources are
                        followed and the file contents copied to the build
                        image. If false, they are left as symbolic links. Only
                        applies if --source-file-transfer-final is set to
                        'copy-all'.
                        (default: false)
  --source-resolve-symlinks-final [BOOL]
                        If true, symbolic links in the build sources are
                        followed and the file contents copied to the final
                        image. If false, they are left as symbolic links in
                        the final image. Only applies if
                        --source-file-transfer-final is set to 'copy-all'.
                        (default: false)
  --with-network [WITH_NETWORK]
                        Run build and postinst scripts with network access
                        (instead of private network)
  --settings PATH       Add in .nspawn settings file

3 years agoSplit out the helper to format a list of strings
Zbigniew Jędrzejewski-Szmek [Tue, 26 Apr 2022 11:13:04 +0000 (13:13 +0200)] 
Split out the helper to format a list of strings

This doesn't save much, but I think it's easier to read this way.

3 years agomkosi: add metavar=BOOL to boolean options
Zbigniew Jędrzejewski-Szmek [Fri, 10 Jun 2022 08:25:49 +0000 (10:25 +0200)] 
mkosi: add metavar=BOOL to boolean options

--help would print something like "--source-file-transfer-final SOURCE_FILE_TRANSFER_FINAL"
which takes a lot of space but is not very helpful. In particular it
might not be clear whether this expects some custom string or just a
yes/no boolean. Let's use "BOOL" instead to tell the user the type of
the argument, which immediately implies what values can be specified.

Similarly, say "--source-file-transfer METHOD", "--source-file-transfer-final METHOD".

Also drop metavar= when it matches the default value anyway.

3 years agomkosi: reformat option construction
Zbigniew Jędrzejewski-Szmek [Tue, 26 Apr 2022 08:44:21 +0000 (10:44 +0200)] 
mkosi: reformat option construction

Formatting is made more consistent:
- long entries are broken up
- trailing commas are used

3 years agoarch: Drop locale-gen logic
Daan De Meyer [Thu, 9 Jun 2022 15:05:14 +0000 (17:05 +0200)] 
arch: Drop locale-gen logic

C.UTF-8 is included by default in the latest glibc package update.

3 years agoMerge pull request #994 from gsalvatella/fix/bmap-before-compression
Jörg Behrmann [Fri, 3 Jun 2022 05:23:54 +0000 (07:23 +0200)] 
Merge pull request #994 from gsalvatella/fix/bmap-before-compression

mkosi: create bmap before compression

3 years agomkosi: create bmap before compression 994/head
Gerard Salvatella [Wed, 1 Jun 2022 15:44:45 +0000 (17:44 +0200)] 
mkosi: create bmap before compression

Creation of bmap files needs to take place before any compression
happens, since bmaptool has to know where the "holes" of the image lie.
Compression removes the holes, preventing bmap from recreating the
original raw image. Move the bmap calculation step before the
compression.

3 years agoMerge pull request #996 from behrmann/parsesshagentlogic
Jörg Behrmann [Thu, 2 Jun 2022 07:56:34 +0000 (09:56 +0200)] 
Merge pull request #996 from behrmann/parsesshagentlogic

ssh: make parse_ssh_agent only handle strings

3 years agossh: make parse_ssh_agent only handle strings 996/head
Joerg Behrmann [Wed, 1 Jun 2022 17:35:39 +0000 (19:35 +0200)] 
ssh: make parse_ssh_agent only handle strings

pyright complains (wrongly I think) about value being None when passed to Path
to create the socket variable. Let's work around this by eliminating Nones as
values.

3 years agoMerge pull request #985 from DaanDeMeyer/pytest-graceful-build
Jörg Behrmann [Mon, 30 May 2022 11:45:24 +0000 (13:45 +0200)] 
Merge pull request #985 from DaanDeMeyer/pytest-graceful-build

machine: Hide subprocess stacktrace when a command fails during build

3 years agoset SYSTEMD_LOG_LEVEL=debug in workspace cmd when debugging it
Joerg Behrmann [Tue, 24 May 2022 11:15:57 +0000 (13:15 +0200)] 
set SYSTEMD_LOG_LEVEL=debug in workspace cmd when debugging it

3 years agomachine: Hide subprocess stacktrace when a command fails during build 985/head
Daan De Meyer [Fri, 20 May 2022 11:32:20 +0000 (13:32 +0200)] 
machine: Hide subprocess stacktrace when a command fails during build

Similar to #983 but when building the image instead of booting it.

3 years agoMerge pull request #983 from DaanDeMeyer/pytest-graceful
Jörg Behrmann [Fri, 20 May 2022 09:25:46 +0000 (11:25 +0200)] 
Merge pull request #983 from DaanDeMeyer/pytest-graceful

machine: Hide pexpect stacktrace when machine fails to boot

3 years agomachine: Hide pexpect stacktrace when machine fails to boot 983/head
Daan De Meyer [Thu, 19 May 2022 12:25:33 +0000 (14:25 +0200)] 
machine: Hide pexpect stacktrace when machine fails to boot

Follow up for b799c6de4ec80a5519391a7c15ac52481b50d33f

3 years agoMerge pull request #982 from DaanDeMeyer/fixes
Daan De Meyer [Thu, 19 May 2022 10:56:25 +0000 (11:56 +0100)] 
Merge pull request #982 from DaanDeMeyer/fixes

Fixes

3 years agomachine: Fail test more gracefully if the image fails to boot 982/head
Daan De Meyer [Tue, 19 Apr 2022 19:15:41 +0000 (21:15 +0200)] 
machine: Fail test more gracefully if the image fails to boot

3 years agomachine: Pass a list of arguments to pexpect instead of a single string
Daan De Meyer [Tue, 19 Apr 2022 17:31:08 +0000 (19:31 +0200)] 
machine: Pass a list of arguments to pexpect instead of a single string

3 years agoMerge pull request #981 from DaanDeMeyer/fix-qemu-bios
Jörg Behrmann [Thu, 19 May 2022 08:31:29 +0000 (10:31 +0200)] 
Merge pull request #981 from DaanDeMeyer/fix-qemu-bios

qemu: Only enable uefi related options when we want to boot using uefi

3 years agoSelect qemu executable based on image architecture
Daan De Meyer [Tue, 4 Jan 2022 09:24:04 +0000 (09:24 +0000)] 
Select qemu executable based on image architecture

3 years agomkosi: add option for adding extra qemu args
Lennart Poettering [Fri, 8 Apr 2022 14:40:41 +0000 (16:40 +0200)] 
mkosi: add option for adding extra qemu args

Let's add an option for adding extra options to pass to all our qemu
invocations.

Example mkosi.default:

```
[Host]
QemuArgs=-fw_cfg name=opt/io.systemd.credentials/foo,string=bar
```

3 years agoqemu: Only enable uefi related options when we want to boot using uefi 981/head
Daan De Meyer [Wed, 18 May 2022 16:06:28 +0000 (18:06 +0200)] 
qemu: Only enable uefi related options when we want to boot using uefi

3 years agomkosi: Always use the embedded default version when no release is specified
Daan De Meyer [Mon, 16 May 2022 13:57:53 +0000 (15:57 +0200)] 
mkosi: Always use the embedded default version when no release is specified

Let's not have the host system determine the image distribution release.
Instead, let's always default to the default release embedded within mkosi.
This gives more consistent results when building images for a single distro
regardless of the host distribution.

3 years agoAdd two more OVMF code locations
Daan De Meyer [Tue, 17 May 2022 13:57:32 +0000 (15:57 +0200)] 
Add two more OVMF code locations

Used on Ubuntu. Should make sure we find the secure boot OVMF stuff
on Github Actions.

3 years agoFix wrong verity sigs for s390
Daan De Meyer [Wed, 18 May 2022 13:15:17 +0000 (15:15 +0200)] 
Fix wrong verity sigs for s390

3 years agoMerge pull request #978 from behrmann/manifestsizeoptional
Jörg Behrmann [Wed, 18 May 2022 09:18:45 +0000 (11:18 +0200)] 
Merge pull request #978 from behrmann/manifestsizeoptional

manifest: don't assume the size field to be valid on deb systems

3 years agomanifest: don't assume the size field to be valid on deb systems 978/head
Joerg Behrmann [Tue, 17 May 2022 17:38:22 +0000 (19:38 +0200)] 
manifest: don't assume the size field to be valid on deb systems

Fixes: 977
3 years agomachine: Translate \r\n to \n in logfile
Daan De Meyer [Tue, 17 May 2022 09:45:08 +0000 (11:45 +0200)] 
machine: Translate \r\n to \n in logfile

Output lines from pexpect sent to the logfile will always end with
"\r\n" (side-effect of working with pseudo-TTYs) . On Github Actions,
this results in blank lines in the test output. Let's add a simple
adapter that translates "\r\n" back to "\n" before actually writing
to the logfile.

3 years agoMerge pull request #972 from DaanDeMeyer/remove-pacstrap-refs
Jörg Behrmann [Mon, 16 May 2022 07:51:24 +0000 (09:51 +0200)] 
Merge pull request #972 from DaanDeMeyer/remove-pacstrap-refs

Replace references to pacstrap with pacman

3 years agoReplace references to pacstrap with pacman 972/head
Daan De Meyer [Mon, 16 May 2022 07:48:05 +0000 (09:48 +0200)] 
Replace references to pacstrap with pacman

We call pacman directly these days so let's remove all references
to pacstrap.

3 years agoAllow rhel-likes to build on more than x86_64
Neil Hanlon [Sat, 14 May 2022 03:11:22 +0000 (23:11 -0400)] 
Allow rhel-likes to build on more than x86_64

* also add Rocky 9 key name change and the bdb/sqlite fix as well

Relates-to: #323
3 years agoadd a workaround for missing user= parameter in subprocess.run on python 3.8
Joerg Behrmann [Fri, 13 May 2022 07:27:18 +0000 (09:27 +0200)] 
add a workaround for missing user= parameter in subprocess.run on python 3.8

Fixes: #967
3 years agoMerge pull request #966 from DaanDeMeyer/ubuntu-jammy
Jörg Behrmann [Thu, 12 May 2022 07:43:42 +0000 (09:43 +0200)] 
Merge pull request #966 from DaanDeMeyer/ubuntu-jammy

Update ubuntu default version to jammy

3 years agoUpdate ubuntu default version to jammy 966/head
Daan De Meyer [Wed, 11 May 2022 21:57:37 +0000 (23:57 +0200)] 
Update ubuntu default version to jammy

3 years agoMerge pull request #961 from DaanDeMeyer/fedora-36
Daan De Meyer [Wed, 11 May 2022 13:22:43 +0000 (15:22 +0200)] 
Merge pull request #961 from DaanDeMeyer/fedora-36

3 years agoMerge pull request #963 from behrmann/debian-ca-certs
Jörg Behrmann [Wed, 11 May 2022 11:58:18 +0000 (13:58 +0200)] 
Merge pull request #963 from behrmann/debian-ca-certs

debian: include ca-certificates for bootstrap packages

3 years agoInstall util-linux explicitly on Fedora 961/head
Daan De Meyer [Wed, 11 May 2022 11:54:24 +0000 (13:54 +0200)] 
Install util-linux explicitly on Fedora

In Fedora 36, by default only util-linux-core is pulled in which
is missing /bin/login which is required by /sbin/agetty to function
properly. Let's pull it in explicitly until the bug is resolved.

3 years agoDon't fail if /etc/pam.d/login doesn't exist.
Daan De Meyer [Wed, 11 May 2022 07:58:15 +0000 (09:58 +0200)] 
Don't fail if /etc/pam.d/login doesn't exist.

3 years agodebian: include ca-certificates for bootstrap packages 963/head
Joerg Behrmann [Wed, 11 May 2022 07:41:35 +0000 (09:41 +0200)] 
debian: include ca-certificates for bootstrap packages

apt throws warnings because it cannot verify the certificates for the security
repositories we included recently. We could add this to extra-packages, but then
ca-certificates is missing when we call apt update for the first time, so add it
to the debootsrap call.

Fixes: #962
3 years agoUpdate default fedora version to 36
Daan De Meyer [Tue, 10 May 2022 19:43:30 +0000 (21:43 +0200)] 
Update default fedora version to 36

3 years agoMerge pull request #960 from DaanDeMeyer/fixes
Daan De Meyer [Sun, 8 May 2022 06:19:42 +0000 (08:19 +0200)] 
Merge pull request #960 from DaanDeMeyer/fixes

Fixes

3 years agoRun git operations as user running mkosi 960/head
Daan De Meyer [Sat, 7 May 2022 18:58:38 +0000 (20:58 +0200)] 
Run git operations as user running mkosi

Latest git complains when executed as root on a user owned directory.
Let's run the git operations as the user running mkosi to avoid the
error.

3 years agoAlways update /etc/kernel/cmdline
Daan De Meyer [Sat, 7 May 2022 18:56:59 +0000 (20:56 +0200)] 
Always update /etc/kernel/cmdline

Allows updating the kernel cmdline without needing a full rebuild.

3 years agoMerge pull request #959 from DaanDeMeyer/arch
Daan De Meyer [Thu, 5 May 2022 13:24:47 +0000 (15:24 +0200)] 
Merge pull request #959 from DaanDeMeyer/arch

3 years agoAdd nspawn version check to check_native() 959/head
Daan De Meyer [Thu, 5 May 2022 09:23:29 +0000 (11:23 +0200)] 
Add nspawn version check to check_native()

From systemd-nspawn v250 onwards, it's possible to run build scripts
on non-native architectures (as long as binfmt.d is configured correctly)
so update the native check to consider that.

3 years agoAdd env variable to configure nspawn executable to use
Daan De Meyer [Thu, 5 May 2022 09:22:54 +0000 (11:22 +0200)] 
Add env variable to configure nspawn executable to use

Useful when working on nspawn to configure mkosi to use nspawn
from the build directory instead of system nspawn.

3 years agoEnsure we use C.UTF-8 as the default locale on all distributions
Daan De Meyer [Fri, 22 Apr 2022 13:49:03 +0000 (15:49 +0200)] 
Ensure we use C.UTF-8 as the default locale on all distributions

3 years agodebian: load skeletons after running debootstrap
Joerg Behrmann [Fri, 22 Apr 2022 15:09:15 +0000 (17:09 +0200)] 
debian: load skeletons after running debootstrap

Right now mkosi.skeleton cannot be used for dpkg-based distributions, since
debootstrap will not work on a non-empty target. This adds a parameter to
install_skeleton_trees to hack around this for Debian and Ubuntu, so that the
call before install_distribution is skipped and we only add skeletons before
invoking apt again after doing the initial debootstrap.

3 years agoMerge pull request #957 from keszybz/py3.11-compat
Daan De Meyer [Mon, 25 Apr 2022 11:13:54 +0000 (13:13 +0200)] 
Merge pull request #957 from keszybz/py3.11-compat

py3.11: fix Enum formatting to work with python3.11-a7

3 years agoDrop special __repr__ from Parseable mixin 957/head
Zbigniew Jędrzejewski-Szmek [Sun, 24 Apr 2022 14:07:03 +0000 (16:07 +0200)] 
Drop special __repr__ from Parseable mixin

We want to override __str__, and we also did __repr__, but there doesn't
seem to be any particular reason for this.

3 years agopy3.11: fix Enum formatting to work with python3.11-a7
Zbigniew Jędrzejewski-Szmek [Sun, 24 Apr 2022 10:54:57 +0000 (12:54 +0200)] 
py3.11: fix Enum formatting to work with python3.11-a7

Something strange is happening with .__repr__() access in python3.11:

>>> mkosi.backend.ManifestFormat.mro()
[<enum 'ManifestFormat'>, <class 'mkosi.backend.Parseable'>, <enum 'Enum'>, <class 'object'>]
>>> mkosi.backend.ManifestFormat.changelog.__repr__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.11/enum.py", line 1194, in __repr__
    return "<%s.%s: %s>" % (self.__class__.__name__, self._name_, v_repr(self._value_))
                                                                  ^^^^^^^^^^^^^^^^^^^^
  File "/home/zbyszek/src/mkosi/mkosi/backend.py", line 95, in __repr__
    return cast(str, getattr(self, "name"))
                     ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'name'

Enum somehow subverts normal lookup and makes its own __repr__ function be
used, even though Parseable is listed first in MRO. This seems to be related to
PEP 663, which was rejected, and the changes reverted for -a4 [1], but then the revert
was reverted [2].

Let's just sidestep MRO with a method redefinition:

>>> mkosi.backend.ManifestFormat.changelog.__repr__
<bound method ManifestFormat.__repr__ of changelog>
>>> mkosi.backend.ManifestFormat.changelog.__repr__()
'changelog'

This should work on all python versions. If python3.11 returns to previous
semantics before the final release, we can remove the workaround.

[1] commit acf7403f9baea3ae1119fc6b4a3298522188bf96
Author: Ethan Furman <ethan@stoneleaf.us>
Date:   Sat Jan 15 22:41:43 2022 -0800

    bpo-40066:  [Enum] update str() and format() output (GH-30582)

    Undo rejected PEP-663 changes:

    - restore `repr()` to its 3.10 status
    - restore `str()` to its 3.10 status

[2] commit 42a64c03ec5c443f2a5c2ee4284622f5d1f5326c
Author: Victor Stinner <vstinner@python.org>
Date:   Mon Jan 17 13:58:40 2022 +0100

    Revert "bpo-40066:  [Enum] update str() and format() output (GH-30582)" (GH-30632)

    This reverts commit acf7403f9baea3ae1119fc6b4a3298522188bf96.

3 years agoMerge pull request #954 from behrmann/missingdocs
Daan De Meyer [Fri, 22 Apr 2022 11:27:48 +0000 (13:27 +0200)] 
Merge pull request #954 from behrmann/missingdocs

Add missing docs

3 years agodocs: add missing genkey command summary 954/head
Joerg Behrmann [Fri, 22 Apr 2022 11:24:20 +0000 (13:24 +0200)] 
docs: add missing genkey command summary

3 years agodocs: add missing commands to synopsis
Joerg Behrmann [Fri, 22 Apr 2022 11:24:07 +0000 (13:24 +0200)] 
docs: add missing commands to synopsis

3 years agoMake a relative symlink instead of an absolute one
Joerg Behrmann [Wed, 20 Apr 2022 17:53:36 +0000 (19:53 +0200)] 
Make a relative symlink instead of an absolute one

THis should ensure, that we never link outside of the image.

3 years agoMerge pull request #952 from DaanDeMeyer/locale-force-symlink
Jörg Behrmann [Thu, 21 Apr 2022 14:50:47 +0000 (16:50 +0200)] 
Merge pull request #952 from DaanDeMeyer/locale-force-symlink

mkosi: Force /etc/default/locale to be a symlink to locale.conf

3 years agomkosi: Force /etc/default/locale to be a symlink to locale.conf 952/head
Daan De Meyer [Wed, 20 Apr 2022 18:08:24 +0000 (20:08 +0200)] 
mkosi: Force /etc/default/locale to be a symlink to locale.conf

If the locales package is installed, /etc/default/locale will exist
in the filesystem already. Let's make sure we handle that properly.

3 years agoMerge pull request #932 from DaanDeMeyer/debug-bootable
Daan De Meyer [Tue, 19 Apr 2022 14:55:23 +0000 (16:55 +0200)] 
Merge pull request #932 from DaanDeMeyer/debug-bootable

Various fixes

3 years agoarch: Use C.UTF-8 instead of en_US.UTF-8 932/head
Daan De Meyer [Tue, 19 Apr 2022 07:33:40 +0000 (09:33 +0200)] 
arch: Use C.UTF-8 instead of en_US.UTF-8

3 years agoubuntu/debian: Add updates/security repos to new images
Daan De Meyer [Thu, 14 Apr 2022 19:05:55 +0000 (21:05 +0200)] 
ubuntu/debian: Add updates/security repos to new images

Fixes #534

3 years agoubuntu/debian: Preserve runtime directory
Daan De Meyer [Wed, 13 Apr 2022 11:02:12 +0000 (13:02 +0200)] 
ubuntu/debian: Preserve runtime directory

sshd logs on CI complain about a missing runtime directory. Let's
make sure the runtime directory is preserved to avoid this error.

3 years agoci: Update dependency versions
Daan De Meyer [Wed, 13 Apr 2022 15:51:57 +0000 (17:51 +0200)] 
ci: Update dependency versions

3 years agoci: Cache dependencies build step
Daan De Meyer [Wed, 13 Apr 2022 10:43:06 +0000 (12:43 +0200)] 
ci: Cache dependencies build step

3 years agoci: Fix $BUILDDIR unset in setup-github-actions.sh
Daan De Meyer [Tue, 19 Apr 2022 13:17:04 +0000 (15:17 +0200)] 
ci: Fix $BUILDDIR unset in setup-github-actions.sh

sudo doesn't transfer environment variables by default.

3 years agoubuntu/debian: Set up locale correctly on Debian/Ubuntu
Daan De Meyer [Wed, 13 Apr 2022 09:08:03 +0000 (11:08 +0200)] 
ubuntu/debian: Set up locale correctly on Debian/Ubuntu

Let's make sure we configure the locale. Also, some programs
expect /etc/default/locale to exist on Ubuntu/Debian so let's
create a symlink from there to /etc/locale.conf as well.

3 years agomachine: Rework run() output capture
Daan De Meyer [Tue, 12 Apr 2022 20:52:10 +0000 (22:52 +0200)] 
machine: Rework run() output capture

Let's not capture output by default. Instead, let's forward it
directly to stdout/stderr to simplify debugging. Similar to the
subprocess.run() function, let's add a capture_output argument
to allow configuring whether to capture the output.

We also remove the debug argument from Machine since logging to
stdout/stderr is now the default.

3 years agoRename test_skip_not_supported() to skip_not_supported()
Daan De Meyer [Tue, 12 Apr 2022 13:15:58 +0000 (15:15 +0200)] 
Rename test_skip_not_supported() to skip_not_supported()

pytest runs it as a test with the previous name which is not
what we want to happen.

3 years agoExpect qemu tests to fail on centos_epel due to arch issue
Daan De Meyer [Tue, 12 Apr 2022 12:02:47 +0000 (14:02 +0200)] 
Expect qemu tests to fail on centos_epel due to arch issue

3 years agoAdd --qemu-kvm option
Daan De Meyer [Tue, 12 Apr 2022 11:58:58 +0000 (13:58 +0200)] 
Add --qemu-kvm option

Allows running without KVM acceleration on machines that support KVM.
Useful when trying to reproduce CI issues where KVM is not supported.

3 years agoci: Print more verbose output when running pytest
Daan De Meyer [Tue, 12 Apr 2022 11:38:55 +0000 (13:38 +0200)] 
ci: Print more verbose output when running pytest

Let's have pytest output which tests succeeded and were skipped.

3 years agoDrop --hostonly-initrd from test machine bootable images
Daan De Meyer [Thu, 7 Apr 2022 13:06:18 +0000 (15:06 +0200)] 
Drop --hostonly-initrd from test machine bootable images

Causes a few boot issues with rocky and alma bootable images so
let's remove the option as it the speed improvement shouldn't matter
too much for integration tests.

3 years agoAdd missing binaries to initrd
Daan De Meyer [Thu, 7 Apr 2022 12:57:10 +0000 (14:57 +0200)] 
Add missing binaries to initrd

These aren't included on Ubuntu which causes an error during boot,
let's fix that by including them explicitly.

3 years agoci: Remove systemd.volatile from kernel command line
Daan De Meyer [Thu, 7 Apr 2022 09:49:58 +0000 (11:49 +0200)] 
ci: Remove systemd.volatile from kernel command line

volatile doesn't work on many distros. We initially added it to
support booting GPT squashfs images but since we don't test those
in CI anymore, we can safely remove volatile from the kernel
commandline as well.

3 years agoci: Use gpt_ext4 as the bootable system format instead of gpt_btrfs
Daan De Meyer [Thu, 7 Apr 2022 09:49:27 +0000 (11:49 +0200)] 
ci: Use gpt_ext4 as the bootable system format instead of gpt_btrfs

gpt_ext4 is usable everywhere unlike gpt_btrfs.

3 years agotests: Add back isinstance() check to pytest_assertrepr_compare()
Daan De Meyer [Thu, 7 Apr 2022 08:48:25 +0000 (10:48 +0200)] 
tests: Add back isinstance() check to pytest_assertrepr_compare()

Turns out that the added typing was wrong, not the isinstance()
check so add back the isinstance() check and change the type to Any
instead.