From: Daan De Meyer Date: Thu, 13 Jul 2023 10:51:46 +0000 (+0200) Subject: Beef up --kernel-command-line-extra= defaults a little bit X-Git-Tag: v15~79^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=005a6548881dd39007680810bec16f5b818faeea;p=thirdparty%2Fmkosi.git Beef up --kernel-command-line-extra= defaults a little bit Let's provide a better experience out of the box when booting an image: - Always blacklist vmw_vmci so it can't interfere with vsock - Always pull in network-online.target - Configure systemd-network-generator for enp0s1 and host0 if not configured explicitly - Use a default loglevel where only warnings or higher are logged to the serial console by the kernel - Set SYSTEMD_SULOGIN_FORCE=1 unless configured explicitly so users get a shell in the initrd if something goes wrong, even if no root password is configured --- diff --git a/mkosi/config.py b/mkosi/config.py index 2efd02405..53818ca4f 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -2021,10 +2021,20 @@ def load_kernel_command_line_extra(args: argparse.Namespace) -> list[str]: f"systemd.tty.columns.ttyS0={columns}", f"systemd.tty.rows.ttyS0={lines}", "console=ttyS0", + # Make sure we set up networking in the VM/container. + "systemd.wants=network-online.target", + # Make sure we don't load vmw_vmci which messes with virtio vsock. + "module_blacklist=vmw_vmci", ] - if args.output_format == OutputFormat.cpio: - cmdline += ["rd.systemd.unit=default.target"] + if not any(s.startswith("ip=") for s in args.kernel_command_line_extra): + cmdline += ["ip=enp0s1:any", "ip=host0:any"] + + if not any(s.startswith("loglevel=") for s in args.kernel_command_line_extra): + cmdline += ["loglevel=4"] + + if not any(s.startswith("SYSTEMD_SULOGIN_FORCE=") for s in args.kernel_command_line_extra): + cmdline += ["SYSTEMD_SULOGIN_FORCE=1"] for s in args.kernel_command_line_extra: key, sep, value = s.partition("=")