From 6d7f687609b69d9bf74747e7bcac2ca8f34fe89f Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Wed, 27 Nov 2024 14:21:43 +0100 Subject: [PATCH] image: allow autologin on TTY1 for STACKIT cloud (#3499) --- .../system/export_constellation_debug.service | 2 +- .../system-preset/20-constellation-base.preset | 1 - .../system/getty@tty1.service.d/autologin.conf | 11 +++++++++++ .../serial-getty@ttyS0.service.d/autologin.conf | 4 ++-- image/system/variants.bzl | 12 ++++-------- 5 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 image/sysroot-tree/usr/lib/systemd/system/getty@tty1.service.d/autologin.conf diff --git a/image/base/mkosi.skeleton/usr/lib/systemd/system/export_constellation_debug.service b/image/base/mkosi.skeleton/usr/lib/systemd/system/export_constellation_debug.service index 6858dab9bc..9b0fccabe0 100644 --- a/image/base/mkosi.skeleton/usr/lib/systemd/system/export_constellation_debug.service +++ b/image/base/mkosi.skeleton/usr/lib/systemd/system/export_constellation_debug.service @@ -3,7 +3,7 @@ Description=Export Constellation Debug Level to Environment [Service] Type=oneshot -ExecStart=/bin/bash -c "tr ' ' '\n' < /proc/cmdline | grep -q 'constellation.debug' && echo CONSTELLATION_DEBUG_FLAGS=--debug >> /run/constellation.env" +ExecStart=/bin/bash -c "tr ' ' '\n' < /proc/cmdline | grep -q 'constel.debug' && echo CONSTELLATION_DEBUG_FLAGS=--debug >> /run/constellation.env" RemainAfterExit=yes [Install] diff --git a/image/sysroot-tree/usr/lib/systemd/system-preset/20-constellation-base.preset b/image/sysroot-tree/usr/lib/systemd/system-preset/20-constellation-base.preset index f74d34ec85..b213385afd 100644 --- a/image/sysroot-tree/usr/lib/systemd/system-preset/20-constellation-base.preset +++ b/image/sysroot-tree/usr/lib/systemd/system-preset/20-constellation-base.preset @@ -2,7 +2,6 @@ enable systemd-timesyncd.service enable systemd-networkd.service enable systemd-networkd-wait-online.service enable configure-constel-csp.service -enable serial-getty@tty0.service enable dbus.service enable dbus-broker.service enable dbus-daemon.service diff --git a/image/sysroot-tree/usr/lib/systemd/system/getty@tty1.service.d/autologin.conf b/image/sysroot-tree/usr/lib/systemd/system/getty@tty1.service.d/autologin.conf new file mode 100644 index 0000000000..ec52d1369f --- /dev/null +++ b/image/sysroot-tree/usr/lib/systemd/system/getty@tty1.service.d/autologin.conf @@ -0,0 +1,11 @@ +[Unit] +Description=autologin +ConditionPathExists=/proc/cmdline +ConditionKernelCommandLine=|constel.console +ConditionKernelCommandLine=|constel.debug + +[Service] +ExecStart= +ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin root %I $TERM +[Install] +WantedBy=multi-user.target diff --git a/image/sysroot-tree/usr/lib/systemd/system/serial-getty@ttyS0.service.d/autologin.conf b/image/sysroot-tree/usr/lib/systemd/system/serial-getty@ttyS0.service.d/autologin.conf index 77db15a0ab..24fe28a99e 100644 --- a/image/sysroot-tree/usr/lib/systemd/system/serial-getty@ttyS0.service.d/autologin.conf +++ b/image/sysroot-tree/usr/lib/systemd/system/serial-getty@ttyS0.service.d/autologin.conf @@ -1,8 +1,8 @@ [Unit] Description=autologin ConditionPathExists=/proc/cmdline -ConditionKernelCommandLine=|constellation.console -ConditionKernelCommandLine=|constellation.debug +ConditionKernelCommandLine=|constel.console +ConditionKernelCommandLine=|constel.debug [Service] ExecStart= diff --git a/image/system/variants.bzl b/image/system/variants.bzl index 4b9044383b..b9b1c6bd8f 100644 --- a/image/system/variants.bzl +++ b/image/system/variants.bzl @@ -50,7 +50,7 @@ CSPS = [ "qemu", ] -base_cmdline = "selinux=1 enforcing=0 audit=0" +base_cmdline = "selinux=1 enforcing=0 audit=0 console=tty1 console=ttyS0" csp_settings = { "aws": { @@ -62,20 +62,17 @@ csp_settings = { }, "azure": { "kernel_command_line_dict": { - "console": "ttyS0", "constel.csp": "azure", "mitigations": "auto,nosmt", }, }, "gcp": { "kernel_command_line_dict": { - "console": "ttyS0", "constel.csp": "gcp", "mitigations": "auto,nosmt", }, }, "openstack": { - "kernel_command_line": "console=tty0 console=ttyS0 console=ttyS1", "kernel_command_line_dict": { "constel.csp": "openstack", "kvm_amd.sev": "1", @@ -85,9 +82,8 @@ csp_settings = { }, }, "qemu": { - "kernel_command_line": "constellation.console", # All qemu images have console enabled independent of stream + "kernel_command_line": "constel.console", # All qemu images have console enabled independent of stream "kernel_command_line_dict": { - "console": "ttyS0", "constel.csp": "qemu", "mitigations": "auto,nosmt", }, @@ -135,10 +131,10 @@ attestation_variant_settings = { stream_settings = { "console": { - "kernel_command_line": "constellation.console", + "kernel_command_line": "constel.console", }, "debug": { - "kernel_command_line": "constellation.debug", + "kernel_command_line": "constel.debug", }, "nightly": {}, "stable": {},