]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
4 years agoPass the list of choices to argparse.Action 671/head
Frantisek Sumsal [Fri, 5 Mar 2021 12:06:12 +0000 (13:06 +0100)] 
Pass the list of choices to argparse.Action

This way our custom ListAction action can properly generate a list of
choices in the help message when the metavar is not defined:

Before:
$ mkosi --help
...
  --debug SELECTOR      Turn on debugging output

After:
$ mkosi --help
...
  --debug {run,build-script,workspace-command}
                          Turn on debugging output

4 years agoDocument the --prepare-script config file counterpart
Frantisek Sumsal [Fri, 5 Mar 2021 12:04:38 +0000 (13:04 +0100)] 
Document the --prepare-script config file counterpart

4 years agoMerge pull request #663 from liam-mcb/encrypted-squashfs
Daan De Meyer [Thu, 4 Mar 2021 11:34:07 +0000 (11:34 +0000)] 
Merge pull request #663 from liam-mcb/encrypted-squashfs

Fix encrypted gpt_squashfs

4 years agoFix generated root partition being too small for encrypted images. 663/head
Liam McBirnie [Sun, 28 Feb 2021 20:43:27 +0000 (21:43 +0100)] 
Fix generated root partition being too small for encrypted images.

Building encrypted minimized or squashfs images was failing
at the 'dd' command in 'insert_partition' with the
error 'No space left on device'.
Increasing the luks overhead from 2MB to 16MB allows enough space.
16MB was found to be the smallest overhead which wouldn't fail.

4 years agoFix incorrect arguments given to 'luks_format_root'.
Liam McBirnie [Sun, 28 Feb 2021 20:31:00 +0000 (21:31 +0100)] 
Fix incorrect arguments given to 'luks_format_root'.

Commit 99453d9c added a 'cached' parameter to the 'luks_format_root'
command but didn't add the paramter to where the command is called
inside 'insert_partition'.
This patch sets 'cached' to False and fixes 'inserting_generated_root'
which should be True.

4 years agoReread partition table after inserting partition.
Liam McBirnie [Sun, 28 Feb 2021 20:24:40 +0000 (21:24 +0100)] 
Reread partition table after inserting partition.

Fixes issue where the sfdisk command fails to re-read the partition
table when creating a squashfs image with encrypted data.
This is because the encrypted data partition is mounted so sfdisk gives
the warning 'Device or resource busy'.
This causes the 'dd' command failing because it can't find the newly
created partition.

4 years agoMerge pull request #670 from behrmann/cosmetics
Daan De Meyer [Tue, 2 Mar 2021 19:06:13 +0000 (19:06 +0000)] 
Merge pull request #670 from behrmann/cosmetics

Cosmetics

4 years agoci: add isort 670/head
Joerg Behrmann [Tue, 2 Mar 2021 17:27:44 +0000 (18:27 +0100)] 
ci: add isort

4 years agoblack: bump code style to py37
Joerg Behrmann [Tue, 2 Mar 2021 17:27:26 +0000 (18:27 +0100)] 
black: bump code style to py37

4 years agomkosi: add new simple "serve" verb for serving built images via HTTP
Lennart Poettering [Tue, 2 Mar 2021 16:34:30 +0000 (17:34 +0100)] 
mkosi: add new simple "serve" verb for serving built images via HTTP

If found this quite useful for testing things with "machinectl pull-tar"
and "machinectl pull-raw": add a tiny HTTP server that can serve the
generated output once it#s done. Love the simplicity of this:

```
mkosi -i -f serve
```

and then

```
machinectl pull-raw http://localhost:8081/image.raw --verify=checksum
```

4 years agomkosi: explicitly flush SHA256SUMS file
Lennart Poettering [Tue, 2 Mar 2021 16:32:07 +0000 (17:32 +0100)] 
mkosi: explicitly flush SHA256SUMS file

Apparently we have to flush things explicitly after writing it,
otherwise things remain buffered by python IO and the SHA256SUMS file
will remain empty on disk.

4 years agomkosi: fix minor typo in docs
Lennart Poettering [Tue, 2 Mar 2021 16:37:21 +0000 (17:37 +0100)] 
mkosi: fix minor typo in docs

4 years agomkosi.md: update documentation to match https://github.com/systemd/mkosi/pull/462
Eduard Tolosa [Tue, 2 Mar 2021 08:42:42 +0000 (03:42 -0500)] 
mkosi.md: update documentation to match https://github.com/systemd/mkosi/pull/462

4 years agomkosi: fix table indenting of summary output
Lennart Poettering [Tue, 2 Mar 2021 16:30:32 +0000 (17:30 +0100)] 
mkosi: fix table indenting of summary output

4 years agoOpenMandriva: support more architectures, and install systemd-networkd if requested...
tpgxyz [Fri, 26 Feb 2021 15:11:41 +0000 (16:11 +0100)] 
OpenMandriva: support more architectures, and install systemd-networkd if requested by options

4 years agoMerge pull request #659 from mrc0mmand/unlink-without-btrfs
Daan De Meyer [Fri, 26 Feb 2021 16:11:40 +0000 (16:11 +0000)] 
Merge pull request #659 from mrc0mmand/unlink-without-btrfs

Check if btrfs is available before trying to unlink a subvolume

4 years agoci: build an upstream version of systemd-nspawn 659/head
Frantisek Sumsal [Fri, 26 Feb 2021 14:32:12 +0000 (15:32 +0100)] 
ci: build an upstream version of systemd-nspawn

Ubuntu's systemd-nspawn doesn't support faccessat2() syscall, which is
required, since current Arch's glibc implements faccessat() via
faccessat2().

4 years agoCheck if btrfs is available before trying to unlink a subvolume
Frantisek Sumsal [Mon, 22 Feb 2021 21:42:59 +0000 (22:42 +0100)] 
Check if btrfs is available before trying to unlink a subvolume

otherwise the output is full of pointless errors on certain systems
(like CentOS 8, which doesn't support btrfs):

# mkosi --force --debug run --qemu-headless=true build
‣ Removing output files...
+ btrfs subvol show /home/vagrant/mkosi/mkosi.output/fedora.raw
‣ Error: btrfs not found in PATH.
...
‣ Configuring serial tty (ttyS0)...
‣ Cleaning dnf metadata......
+ btrfs subvol show /var/tmp/mkosi-polqexiq/root/var/log/dnf.log
‣ Error: btrfs not found in PATH.
+ btrfs subvol show /var/tmp/mkosi-polqexiq/root/var/cache/dnf
‣ Error: btrfs not found in PATH.
+ btrfs subvol show /var/tmp/mkosi-polqexiq/root/var/log/dnf.librepo.log
‣ Error: btrfs not found in PATH.
+ btrfs subvol show /var/tmp/mkosi-polqexiq/root/var/log/hawkey.log
‣ Error: btrfs not found in PATH.
+ btrfs subvol show /var/tmp/mkosi-polqexiq/root/var/lib/dnf
‣ Error: btrfs not found in PATH.
+ btrfs subvol show /var/tmp/mkosi-polqexiq/root/var/log/dnf.rpm.log
‣ Error: btrfs not found in PATH.
‣ Cleaning rpm metadata......
+ btrfs subvol show /var/tmp/mkosi-polqexiq/root/var/lib/rpm
‣ Error: btrfs not found in PATH.
‣ Resetting machine ID...
...

4 years agoAllow overriding # of CPUs and amount of RAM for qemu guests
Frantisek Sumsal [Thu, 25 Feb 2021 15:33:48 +0000 (16:33 +0100)] 
Allow overriding # of CPUs and amount of RAM for qemu guests

This commit introduces two options - `--qemu-smp` and `--qemu-mem` - which
can be used to override the default number of CPUs and amount of RAM for
guests started via the `qemu` verb.

4 years agoArch: Fix autologin on nspawn --boot and qemu
Nick Labich [Sat, 20 Feb 2021 18:41:07 +0000 (13:41 -0500)] 
Arch: Fix autologin on nspawn --boot and qemu

4 years agoMake CommandLineArguments fully typed
Daan De Meyer [Sun, 6 Sep 2020 21:06:48 +0000 (22:06 +0100)] 
Make CommandLineArguments fully typed

This commit extends CommandLineArguments with all necessary fields
from the argument parser, removes the inheritance from argparse.Namespace
and fixes all resulting typing errors.

We try to stick to typing only changes as much as possible to reduce the
chance of breaking something (although there are a few non-typing changes
where doing so made things easier).

Because we use a dataclass now for the CommandLineArguments class, we
up the required python version to 3.7.

4 years agoremove duplicate the in README
Justin Vreeland [Sat, 20 Feb 2021 04:07:00 +0000 (20:07 -0800)] 
remove duplicate the in README

4 years agoCheck if image being built is bootable before checking CentOS versions
Justin Vreeland [Sat, 20 Feb 2021 04:30:27 +0000 (20:30 -0800)] 
Check if image being built is bootable before checking CentOS versions

The CentOS specific tests need to know the final value for
boot_protocols.

Before:
  sudo mkosi -d centos -r 7 --bootable
  ...
  ‣ Generating combined kernel + initrd boot file...
  getopt: unrecognized option '--uefi'
  Usage: /usr/sbin/dracut [OPTION]... [<initramfs> [<kernel-version>]]

  Version: 033-572.el7

  Creates initial ramdisk images for preloading modules

    -h, --help  Display all options

  If a [LIST] has multiple arguments, then you have to put these in quotes.

  For example:

      # dracut --add-drivers "module1 module2"  ...

  ‣ Error: Workspace command `/etc/kernel/install.d/50-mkosi-dracut-unified-kernel.install add 3.10.0-1160.15.2.el7.x86_64 /efi/8bb4954ccdbb43c9bb7422a279666f09/3.10.0-1160.15.2.el7.x86_64 ` returned non-zero exit code 1.
  ‣ Unmounting image...
  ‣ Detaching image file...

After:
  sudo mkosi -d centos -r 7 --bootable --force
  ‣ Error: Sorry, CentOS 7 does not support unified kernel images. You must use --without-unified-kernel-images.

4 years agoopenSUSE: Fix autologin setup
Michal Koutný [Fri, 12 Feb 2021 17:01:45 +0000 (18:01 +0100)] 
openSUSE: Fix autologin setup

The distro PAM config resides under /usr/etc and customizations are
supposed to be under /etc. Use the distro file as a template for the
autologin customization.

4 years agoMerge pull request #650 from DaanDeMeyer/secure-boot
Daan De Meyer [Mon, 8 Feb 2021 21:35:47 +0000 (21:35 +0000)] 
Merge pull request #650 from DaanDeMeyer/secure-boot

qemu: Add secure boot support

4 years agoRemove unecesssary dict.get() default None value 650/head
Daan De Meyer [Thu, 4 Feb 2021 11:44:58 +0000 (11:44 +0000)] 
Remove unecesssary dict.get() default None value

4 years agoqemu: Add secure boot support
Daan De Meyer [Wed, 3 Feb 2021 23:12:54 +0000 (23:12 +0000)] 
qemu: Add secure boot support

Adds support for booting OVMF firmware blobs with secure boot
support.

We have to point qemu to an OVMF vars file to get this working.
Currently, we point directly at the vars file in /usr/share but
add the readonly flag so we make sure we don't modify it. I'm
hoping this means the UEFI variable changes in the VM will be
ephmeral instead of writes to these variables failing when the
readonly flag is set. If readonly means we can't enroll secure-boot,
we'll need to make a copy of the VARS file and store it somewhere so
we can remove the readonly flag.

4 years agoqemu: Factor out binary/firmware finding functions
Daan De Meyer [Wed, 3 Feb 2021 22:05:49 +0000 (22:05 +0000)] 
qemu: Factor out binary/firmware finding functions

Also apply the machine argument to every qemu binary.

4 years agoqemu: Use q35 machine 649/head
Daan De Meyer [Wed, 3 Feb 2021 22:03:15 +0000 (22:03 +0000)] 
qemu: Use q35 machine

This is necessary for booting with secure boot enabled in QEMU.
Switching to q35 somehow changed the boot order causing us to drop
into the EFI shell at boot. To fix this, I switched from virtio-blk
to virtio-scsci-pci (which is supposed to be the future anyway)
which allows us to set bootindex to override the boot order.

4 years agoprevent mounting EFI partition with compress (#648)
John Pitney [Wed, 3 Feb 2021 19:26:09 +0000 (13:26 -0600)] 
prevent mounting EFI partition with compress (#648)

prevent mounting EFI and XBOOTLDR partitions with compress

4 years agoKeep commented locales in /etc/locale.gen
Lénaïc Huard [Mon, 1 Feb 2021 17:20:50 +0000 (18:20 +0100)] 
Keep commented locales in /etc/locale.gen

4 years agoMerge pull request #633 from behrmann/keypair
Daan De Meyer [Sat, 30 Jan 2021 11:08:12 +0000 (11:08 +0000)] 
Merge pull request #633 from behrmann/keypair

add command genkey

4 years agoReplace master with main across repo
Daan De Meyer [Sun, 24 Jan 2021 12:40:23 +0000 (12:40 +0000)] 
Replace master with main across repo

4 years agomkosi: add command genkey 633/head
Joerg Behrmann [Mon, 18 Jan 2021 18:27:16 +0000 (19:27 +0100)] 
mkosi: add command genkey

4 years agomkosi: switch to RawConfigParser instead of ConfigParser
Joerg Behrmann [Sat, 23 Jan 2021 17:50:36 +0000 (18:50 +0100)] 
mkosi: switch to RawConfigParser instead of ConfigParser

To allow for expanding systemd.unit like specifier like %u for user, we have to
disable the basic interpolation that configparser allows, because it too uses %
as its specifier.

4 years agoAdd support for passing arguments to the build command
Daan De Meyer [Sat, 23 Jan 2021 20:36:40 +0000 (20:36 +0000)] 
Add support for passing arguments to the build command

Aside from environment variables, it's also useful to be able to
pass arguments to the build script. For example, in systemd we can
use this to pass the target to build to the build script. Build
scripts determine how the passed arguments are interpreted, mkosi
just passes them on.

4 years agoRemove redundant cast
Daan De Meyer [Sat, 23 Jan 2021 20:52:08 +0000 (20:52 +0000)] 
Remove redundant cast

4 years agoUEFI boot: make sure efivarfs loaded in initrd
Michal Koutný [Thu, 21 Jan 2021 17:52:43 +0000 (18:52 +0100)] 
UEFI boot: make sure efivarfs loaded in initrd

The efivarfs is needed in order to GPT root partition discovery work.
Without efivarfs initrd won't be able to switch to the real root.

Add the module regardless of hostonly or distro configuration because
dracut takes into account info from the build host and not the target
distro. Adding a module that's already included in dracut's list makes
no harm.

Fixes #562

4 years agoEnabling console autologin
Mark Walters [Fri, 22 Jan 2021 03:08:19 +0000 (20:08 -0700)] 
Enabling console autologin

4 years agoDrop networkd not running to a warning instead of a fatal error
Daan De Meyer [Thu, 21 Jan 2021 19:23:28 +0000 (19:23 +0000)] 
Drop networkd not running to a warning instead of a fatal error

Without networkd, the veth link won't come up properly on the host
but that doesn't prevent mkosi boot or mkosi qemu from working so
let's drop those messages to warnings instead of fatal errors.

4 years agoRemove "complete" steps from output
Daan De Meyer [Tue, 12 Jan 2021 20:36:16 +0000 (21:36 +0100)] 
Remove "complete" steps from output

The next step start message implies the end of the previous step so
there's no real benefit to printing a complete message for every step.
Let's remove the message and only print a "complete" message if the
caller of complete_step() has provided a custom "complete" message.

4 years agoRemove usage of keyword arguments when calling install_distribution
Daan De Meyer [Sat, 9 Jan 2021 16:11:33 +0000 (17:11 +0100)] 
Remove usage of keyword arguments when calling install_distribution

This make the callsite consistent with the surrounding calls to
other functions.

4 years agoWrite step messages when configuring serial, autologin and network veth
Daan De Meyer [Sat, 9 Jan 2021 15:56:42 +0000 (16:56 +0100)] 
Write step messages when configuring serial, autologin and network veth

4 years agoCache more operations
Daan De Meyer [Sat, 9 Jan 2021 15:52:48 +0000 (16:52 +0100)] 
Cache more operations

Let's cache all steps that write data directly from the config file.
This improves consistency overall and reduces noise in the output
when doing incremental builds.

4 years agoOnly mount image for unified kernel/secure boot when required
Daan De Meyer [Sat, 9 Jan 2021 15:40:30 +0000 (16:40 +0100)] 
Only mount image for unified kernel/secure boot when required

4 years agoOnly print step execution messages if we're executing them
Daan De Meyer [Sat, 9 Jan 2021 14:28:33 +0000 (15:28 +0100)] 
Only print step execution messages if we're executing them

Replace some usage of completestep decorator with complete_step
contextmanager so we only print the step message after checking
if we actually need to execute the step.

4 years agoOnly mount package cache when required
Daan De Meyer [Sat, 9 Jan 2021 15:08:07 +0000 (16:08 +0100)] 
Only mount package cache when required

4 years agoImprove metadata cleanup
Daan De Meyer [Sat, 9 Jan 2021 14:14:18 +0000 (15:14 +0100)] 
Improve metadata cleanup

Use complete_step, os.path.join and only print step message if we're
actually doing any cleanup at all.

4 years agoAdd --build-environment option
Daan De Meyer [Fri, 15 Jan 2021 19:45:46 +0000 (20:45 +0100)] 
Add --build-environment option

Allows setting environment variables for the build script. Useful
to allow users to configure the execution of the build script.

4 years agoCache sshd enable step
Daan De Meyer [Fri, 15 Jan 2021 20:04:45 +0000 (21:04 +0100)] 
Cache sshd enable step

We can't cache the ssh-keygen step easily because it outputs a
file on the host. However, we can cache the enable sshd step as
it only affects the image and not the host.

4 years agoDon't cache --ssh setup step
Daan De Meyer [Thu, 14 Jan 2021 20:18:03 +0000 (21:18 +0100)] 
Don't cache --ssh setup step

Caching the SSH step is non-trivial because it adds an extra file
(the private key file) that has to be taken into account in the
caching logic. For now, let's not cache the step and silence the
stdout of the ssh-keygen command instead.

4 years agoSave ssh private key file in incremental mode
Daan De Meyer [Thu, 14 Jan 2021 16:52:15 +0000 (17:52 +0100)] 
Save ssh private key file in incremental mode

4 years agoDrop completestep mypy workaround
Daan De Meyer [Tue, 12 Jan 2021 21:12:17 +0000 (22:12 +0100)] 
Drop completestep mypy workaround

Seems to not be necessary anymore on latest mypy.

4 years agoModify --source-file-transfer (and sft-final) to accept the empty string
Daan De Meyer [Sun, 10 Jan 2021 11:10:21 +0000 (12:10 +0100)] 
Modify --source-file-transfer (and sft-final) to accept the empty string

4 years agoRemove "quiet" and "rhgb" from default kernel cmdline
Daan De Meyer [Wed, 6 Jan 2021 17:17:11 +0000 (18:17 +0100)] 
Remove "quiet" and "rhgb" from default kernel cmdline

We seem to be running into boot issues semi-regularly in CI because
of the usage of systemd.volatile=overlay. These issues are hard to
debug because we silence boot output by default. Let's enable boot
output by default so we have an easier time debugging these issues
when they occur. Also, mkosi boot shows the same output on
container startup anyway so this brings qemu more in line with mkosi
boot as well.

4 years agoCache ssh and network veth setup steps
Daan De Meyer [Wed, 6 Jan 2021 20:47:32 +0000 (21:47 +0100)] 
Cache ssh and network veth setup steps

These produce output each time they're run so cache the results to
reduce the output clutter when doing an incremental build.

4 years agoUpdate NEWS
Daan De Meyer [Wed, 6 Jan 2021 21:35:51 +0000 (22:35 +0100)] 
Update NEWS

4 years agoSearch for "mkosi.default.d" relative to working directory
Daan De Meyer [Tue, 5 Jan 2021 21:07:50 +0000 (22:07 +0100)] 
Search for "mkosi.default.d" relative to working directory

Searching for the mkosi.default.d dir relative to the file passed
via --default makes it almost impossible to share common settings
between multiple configs  when using --default as simply specifying
a config file via --default changes the location where common configs
are searched. Instead, let's simply look for mkosi.default.d in the
mkosi working directory regardless of the path passed to --default.

4 years agoArch: Remove network configuration
Daan De Meyer [Sun, 27 Dec 2020 17:47:49 +0000 (18:47 +0100)] 
Arch: Remove network configuration

Let's pull Arch in line with the other distros and not do any network
configuration. If needed, we can add this back, but let's do it behind
an option that we implement for all distros so we at least have uniformity
between distros.

4 years agobump version numbers for v9 v9
Daan De Meyer [Wed, 30 Dec 2020 14:42:58 +0000 (15:42 +0100)] 
bump version numbers for v9

4 years agoRemove -e switch from calls to sed in release
Daan De Meyer [Wed, 30 Dec 2020 14:09:09 +0000 (15:09 +0100)] 
Remove -e switch from calls to sed in release

4 years agoadd a NEWS.md
Joerg Behrmann [Sun, 27 Dec 2020 17:08:01 +0000 (18:08 +0100)] 
add a NEWS.md

4 years agoSet correct permission for term.conf to avoid systemd warning
Daan De Meyer [Sun, 27 Dec 2020 17:07:10 +0000 (18:07 +0100)] 
Set correct permission for term.conf to avoid systemd warning

4 years agoqemu: Use virtio-net-pci
Daan De Meyer [Sun, 27 Dec 2020 16:25:48 +0000 (17:25 +0100)] 
qemu: Use virtio-net-pci

We're using virtio for disk, vga and other stuff already, let's
use it as well for the network interface.

4 years agoRegenerate man page
Daan De Meyer [Sun, 27 Dec 2020 16:33:17 +0000 (17:33 +0100)] 
Regenerate man page

4 years agoEnsure networkd is running and 80-vm-vt.network is available when booting images
Daan De Meyer [Sat, 26 Dec 2020 20:23:18 +0000 (21:23 +0100)] 
Ensure networkd is running and 80-vm-vt.network is available when booting images

4 years agoDrop centos from CI (but not centos_epel)
Daan De Meyer [Fri, 25 Dec 2020 15:49:33 +0000 (16:49 +0100)] 
Drop centos from CI (but not centos_epel)

centos_epel should be sufficient testing for centos as well. By
dropping centos, we can test SSH in CI without needing extra logic
to exclude centos from the SSH tests because networkd isn't available
on stock centos without epel.

4 years agoRun networkd in the container/vm when --network-veth is enabled
Daan De Meyer [Fri, 25 Dec 2020 15:15:58 +0000 (16:15 +0100)] 
Run networkd in the container/vm when --network-veth is enabled

4 years agoAdd --ssh option and ssh verb
Daan De Meyer [Tue, 22 Dec 2020 22:21:34 +0000 (23:21 +0100)] 
Add --ssh option and ssh verb

Fixes #593.

Aside from the --ssh option, we also add the "ssh" verb that runs
ssh with all the necessary options.

4 years agoFail when explicit path passed via --default is not found
Daan De Meyer [Fri, 25 Dec 2020 19:14:29 +0000 (20:14 +0100)] 
Fail when explicit path passed via --default is not found

4 years agoFix unsupported operand type error
Luca Boccassi [Sun, 27 Dec 2020 11:52:05 +0000 (11:52 +0000)] 
Fix unsupported operand type error

Packages is a set, and on some version of Python it complains when |= is
used with a list. Use .update instead.

4 years agoUpdate libmodulemd version to 2.11.1
Daan De Meyer [Sat, 26 Dec 2020 22:37:38 +0000 (23:37 +0100)] 
Update libmodulemd version to 2.11.1

4 years agoDon't print a stacktrace when mkosi boot/qemu return a non-zero exit code
Daan De Meyer [Tue, 22 Dec 2020 21:35:17 +0000 (22:35 +0100)] 
Don't print a stacktrace when mkosi boot/qemu return a non-zero exit code

4 years agoUse sets everywhere to store packages
Daan De Meyer [Tue, 22 Dec 2020 14:59:27 +0000 (15:59 +0100)] 
Use sets everywhere to store packages

This gets us automatic deduplication everywhere.

4 years agoMerge pull request #596 from bluca/debian_fixes
Daan De Meyer [Wed, 23 Dec 2020 20:47:38 +0000 (21:47 +0100)] 
Merge pull request #596 from bluca/debian_fixes

Debian: fix HostonlyInitrd and autologin

4 years agoDebian: fix autologin 596/head
Luca Boccassi [Wed, 23 Dec 2020 19:42:40 +0000 (19:42 +0000)] 
Debian: fix autologin

For some reason, PAM on Debian really wants the full path to
the console device in its rules.
eg, this fails:

auth sufficient pam_succeed_if.so tty = ttyS0

But this works:

auth sufficient pam_succeed_if.so tty = /dev/ttyS0

4 years agoDebian: ensure efivars.ko is installed if uefi is used
Luca Boccassi [Wed, 23 Dec 2020 19:39:47 +0000 (19:39 +0000)] 
Debian: ensure efivars.ko is installed if uefi is used

When --hostonly is used, efivars.ko is missing and thus the bootloader
cannot get the UUID of the EFI partition and fails to pivot root.
Specify it manually with add_drivers+=efivarfs if building for Debian
with EFI.

Fixes https://github.com/systemd/mkosi/issues/562

4 years agoSkip output clean/check when using --skip-final-phase
Daan De Meyer [Wed, 23 Dec 2020 14:23:48 +0000 (15:23 +0100)] 
Skip output clean/check when using --skip-final-phase

When using --skip-final-phase, we're not touching any of the output
artifacts so it doesn't make sense to clean the previous output artifacts
or block execution if they already exist.

4 years agoError when using --skip-final-phase with non-build verbs
Daan De Meyer [Wed, 23 Dec 2020 14:19:35 +0000 (15:19 +0100)] 
Error when using --skip-final-phase with non-build verbs

4 years agoClarify --autologin in docs
Daan De Meyer [Mon, 21 Dec 2020 16:02:57 +0000 (17:02 +0100)] 
Clarify --autologin in docs

4 years agoSupport autologin for QEMU without --qemu-headless
Daan De Meyer [Mon, 21 Dec 2020 15:58:01 +0000 (16:58 +0100)] 
Support autologin for QEMU without --qemu-headless

4 years agoMake --autologin work even when a root password is set
Daan De Meyer [Mon, 21 Dec 2020 15:46:36 +0000 (16:46 +0100)] 
Make --autologin work even when a root password is set

Currently, --autologin still asks for a password if the root
password is not explicitly deleted. By adding some PAM short circuit
rules for the relevant TTYs, we avoid PAM asking for the root password
when a user logs in on either pts/0 (nspawn) or ttyS0 (QEMU with
--qemu-headless).

4 years agoAdd --source-file-transfer-final option
Daan De Meyer [Mon, 21 Dec 2020 14:42:21 +0000 (15:42 +0100)] 
Add --source-file-transfer-final option

When debugging in the final image using a debugger, the debugging
experience is greatly improved by having the source files available.
--source-file-transfer-final does exactly what --source-file-transfer
does but applies to the final image instead of the bulid image. While
supporting 'mount' might be possible, we don't do so yet because
the use case is unclear and configuring QEMU to pass through
folders is non-trivial.

4 years agoSmall cleanup of install_build_src
Daan De Meyer [Mon, 21 Dec 2020 14:22:00 +0000 (15:22 +0100)] 
Small cleanup of install_build_src

4 years agoChange --source-file-transfer default to copy-git-others
Daan De Meyer [Mon, 21 Dec 2020 12:44:01 +0000 (13:44 +0100)] 
Change --source-file-transfer default to copy-git-others

I've gotten bitten multiple times by the fact that by default,
untracked files in git are not copied into the build image. Let's
fix this by changing the --source-file-transfer default to
copy-git-others. This adds any untracked files to the build image
(but still excludes ignored files).

4 years agoAdd --ephemeral option
Daan De Meyer [Sat, 19 Dec 2020 20:45:07 +0000 (21:45 +0100)] 
Add --ephemeral option

Identical to systemd-nspawn's --ephemeral option (and that's what how
we implement this for mkosi boot) but also implemented for qemu.

4 years agoDrop execvp argument from run()
Daan De Meyer [Sun, 20 Dec 2020 13:32:04 +0000 (14:32 +0100)] 
Drop execvp argument from run()

run_verb and run_qemu work fine without it so let's remove the
argument so we can let Python do it's usual cleanup after these
commands finish.

4 years agoClean up run_shell
Daan De Meyer [Sat, 19 Dec 2020 20:27:40 +0000 (21:27 +0100)] 
Clean up run_shell

4 years agoRegenerate man page from .md file
ValdikSS [Sun, 20 Dec 2020 14:13:45 +0000 (17:13 +0300)] 
Regenerate man page from .md file

4 years agoSilence "Processing ..." message when building a single image
Daan De Meyer [Sun, 20 Dec 2020 13:05:25 +0000 (14:05 +0100)] 
Silence "Processing ..." message when building a single image

4 years agoAdd option to strip SELinux file context from tar'ed files
ValdikSS [Sun, 20 Dec 2020 12:23:02 +0000 (15:23 +0300)] 
Add option to strip SELinux file context from tar'ed files

This option removes (or not includes) SELinux xattrs into output tar archive.
This is a hack as mkosi does not properly support SELinux contexts. See #130.

The patch adds `--tar-strip-selinux-context` flag and `TarStripSELinuxContext` configuration file option.

4 years agoAdd '--no-chown' to mkosi.md table
ValdikSS [Sun, 20 Dec 2020 12:21:28 +0000 (15:21 +0300)] 
Add '--no-chown' to mkosi.md table

4 years agoAdd file to pass to git blame --ignore-revs-file containing the black commit
Daan De Meyer [Sat, 19 Dec 2020 16:10:17 +0000 (17:10 +0100)] 
Add file to pass to git blame --ignore-revs-file containing the black commit

4 years agoMerge pull request #584 from behrmann/black
Daan De Meyer [Sat, 19 Dec 2020 16:06:46 +0000 (16:06 +0000)] 
Merge pull request #584 from behrmann/black

Use black for code formatting

4 years agoCI: add black to CI and document editable installs now need --no-use-pep517 584/head
Joerg Behrmann [Fri, 18 Dec 2020 15:25:31 +0000 (16:25 +0100)] 
CI: add black to CI and document editable installs now need --no-use-pep517

4 years agoUse black for code formatting
Joerg Behrmann [Fri, 18 Dec 2020 15:21:06 +0000 (16:21 +0100)] 
Use black for code formatting

4 years agoAdd pyproject.toml to configure black
Joerg Behrmann [Fri, 18 Dec 2020 15:12:40 +0000 (16:12 +0100)] 
Add pyproject.toml to configure black

4 years agoReplace the sys.stderr.write calls with a custom MkosiPrinter class
Peter Hutterer [Thu, 17 Dec 2020 00:06:31 +0000 (10:06 +1000)] 
Replace the sys.stderr.write calls with a custom MkosiPrinter class

Most notably, we no longer use ansi escape codes when we are redirecting to a
file.

4 years agoFix flake8 warnings
Peter Hutterer [Thu, 17 Dec 2020 00:13:12 +0000 (10:13 +1000)] 
Fix flake8 warnings

These are all whitespace fixes with a few exceptions:
- one "if not foo is None" -> "if foo is not None"
- one f"static string" changed to "static string"
- two "except Something as e" changed to "except Something" where e isn't
  being used

Flake8 errors disabled:
  501: line too long
  504: line break after binary operator
  741: ambiguous variable name

Flake8 errors left after this patch:
  E241 multiple spaces after ','
  F541 f-string is missing placeholders

Both of the above warnings are triggered by lines that are better left as-is
for consistency with the surrounding code.

4 years agoAdd backticks around the workspace command error
Peter Hutterer [Wed, 16 Dec 2020 23:43:51 +0000 (09:43 +1000)] 
Add backticks around the workspace command error

Better visual separation between the actual command and the full sentence.
We'll never have backticks in our command so unlike other quotes we don't have
to worry about escaping them, and at this point we're all used to backticks
for markdown anyway.