From 010bd5fd9d74c24a5c62657121610308d1e03fdb Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Fri, 22 Feb 2019 10:52:26 -0800 Subject: [PATCH 1/3] systemd: enable switch debug-tty to provide a debug console This allows us to use the default debug-shell.service provided by systemd and cut down on custom made services. This will also always provide a debug shell as there is no reason we shouldn't have access to one. --- distributions/LibreELEC/options | 2 ++ packages/sysutils/busybox/package.mk | 1 - .../busybox/system.d/debug-shell.service | 25 ------------------- packages/sysutils/systemd/package.mk | 5 ++-- .../lib/systemd/system/serial-console.service | 23 ----------------- projects/Allwinner/options | 4 +++ .../lib/systemd/system/serial-console.service | 23 ----------------- projects/RPi/options | 3 +++ .../lib/systemd/system/serial-console.service | 24 ------------------ projects/Rockchip/options | 3 +++ 10 files changed, 14 insertions(+), 99 deletions(-) delete mode 100644 packages/sysutils/busybox/system.d/debug-shell.service delete mode 100644 projects/Allwinner/filesystem/usr/lib/systemd/system/serial-console.service delete mode 100644 projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service delete mode 100644 projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service diff --git a/distributions/LibreELEC/options b/distributions/LibreELEC/options index 59fe3e9798..10503e5bc7 100644 --- a/distributions/LibreELEC/options +++ b/distributions/LibreELEC/options @@ -222,3 +222,5 @@ # IR remote keymaps supported in default config IR_REMOTE_KEYMAPS="rc6_mce xbox_360 xbox_one" +# debug tty path + DEBUG_TTY="/dev/tty3" diff --git a/packages/sysutils/busybox/package.mk b/packages/sysutils/busybox/package.mk index 7968b13155..387276201a 100644 --- a/packages/sysutils/busybox/package.mk +++ b/packages/sysutils/busybox/package.mk @@ -181,7 +181,6 @@ post_install() { add_user nobody x 65534 65534 "Nobody" "/" "/bin/sh" add_group nogroup 65534 - enable_service debug-shell.service enable_service shell.service enable_service show-version.service enable_service var.mount diff --git a/packages/sysutils/busybox/system.d/debug-shell.service b/packages/sysutils/busybox/system.d/debug-shell.service deleted file mode 100644 index ce7cfc45b3..0000000000 --- a/packages/sysutils/busybox/system.d/debug-shell.service +++ /dev/null @@ -1,25 +0,0 @@ -[Unit] -Description=Debug Shell - -DefaultDependencies=no -ConditionKernelCommandLine=|tty -ConditionKernelCommandLine=|debugging -ConditionPathExists=|/storage/.cache/debug.libreelec - -[Service] -Environment=TTY=3 -WorkingDirectory=/storage -ExecStart=/bin/sh -c '. /etc/profile; exec /bin/sh' -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/tty3 -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk index 6cdd0bef26..ea7dcbe4d9 100644 --- a/packages/sysutils/systemd/package.mk +++ b/packages/sysutils/systemd/package.mk @@ -89,6 +89,7 @@ PKG_MESON_OPTS_TARGET="--libdir=/usr/lib \ -Dkmod-path=/usr/bin/kmod \ -Dmount-path=/usr/bin/mount \ -Dumount-path=/usr/bin/umount \ + -Ddebug-tty=$DEBUG_TTY \ -Dversion-tag=${PKG_VERSION}" pre_configure_target() { @@ -128,9 +129,6 @@ post_makeinstall_target() { safe_remove $INSTALL/usr/lib/udev/rules.d/71-seat.rules safe_remove $INSTALL/usr/lib/udev/rules.d/73-seat-late.rules - # remove debug-shell.service, we install our own - safe_remove $INSTALL/usr/lib/systemd/system/debug-shell.service - # remove getty units, we dont want a console safe_remove $INSTALL/usr/lib/systemd/system/autovt@.service safe_remove $INSTALL/usr/lib/systemd/system/console-getty.service @@ -259,4 +257,5 @@ post_install() { enable_service usercache.service enable_service kernel-overlays.service enable_service hwdb.service + enable_service debug-shell.service } diff --git a/projects/Allwinner/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Allwinner/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index 196e8c4a97..0000000000 --- a/projects/Allwinner/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/console -DefaultDependencies=no -ConditionKernelCommandLine=console - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/console -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/Allwinner/options b/projects/Allwinner/options index cd43653a28..0f754273e6 100644 --- a/projects/Allwinner/options +++ b/projects/Allwinner/options @@ -73,3 +73,7 @@ # build with installer (yes / no) INSTALLER_SUPPORT="no" + + # debug tty path + DEBUG_TTY="/dev/console" + diff --git a/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service b/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index 196e8c4a97..0000000000 --- a/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/console -DefaultDependencies=no -ConditionKernelCommandLine=console - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/console -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/RPi/options b/projects/RPi/options index 4e80d70494..0927b0cbc6 100644 --- a/projects/RPi/options +++ b/projects/RPi/options @@ -130,3 +130,6 @@ # for a list of additional drivers see packages/linux-driver-addons # Space separated list is supported, DRIVER_ADDONS="crazycat dvb-latest" + + # debug tty path + DEBUG_TTY="/dev/console" diff --git a/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index 80d27f78c0..0000000000 --- a/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,24 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/ttyS2 -DefaultDependencies=no -ConditionKernelCommandLine=|console=ttyS2 -ConditionKernelCommandLine=|console=uart8250,mmio32,0xff130000 -ConditionKernelCommandLine=|console=uart8250,mmio32,0xff1a0000 -ConditionKernelCommandLine=|console=uart8250,mmio32,0xff690000 - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/ttyS2 -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/Rockchip/options b/projects/Rockchip/options index a6a46fdcee..269e469373 100644 --- a/projects/Rockchip/options +++ b/projects/Rockchip/options @@ -79,3 +79,6 @@ # for a list of additinoal drivers see packages/linux-driver-addons # Space separated list is supported, DRIVER_ADDONS="dvb-latest" + + # debug tty path + DEBUG_TTY="/dev/ttyS2" From e1d6e92907f8e4d84176c348b25886a11b01911b Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Sat, 29 Jun 2019 00:31:11 +0100 Subject: [PATCH 2/3] systemd: fix issues after #3326 /etc/98-busybox.conf configures the prompt and TERM. PR #3326 stopped sourcing /etc/profile, which meant the prompt no longer includes the HOSTNAME. Additionally, #3326 removed code which unhides the cursor. --- ...ystemd-0300-config-env-unhide-cursor.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 packages/sysutils/systemd/patches/systemd-0300-config-env-unhide-cursor.patch diff --git a/packages/sysutils/systemd/patches/systemd-0300-config-env-unhide-cursor.patch b/packages/sysutils/systemd/patches/systemd-0300-config-env-unhide-cursor.patch new file mode 100644 index 0000000000..7405fa07e3 --- /dev/null +++ b/packages/sysutils/systemd/patches/systemd-0300-config-env-unhide-cursor.patch @@ -0,0 +1,27 @@ +From 49285dae6756b22bc6881c04939f7c43c35b5506 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Sat, 29 Jun 2019 00:26:41 +0100 +Subject: [PATCH] debug-shell: configure environment, unhide cursor + +--- + units/debug-shell.service.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/units/debug-shell.service.in b/units/debug-shell.service.in +index 1127e68..4c3e971 100644 +--- a/units/debug-shell.service.in ++++ b/units/debug-shell.service.in +@@ -16,8 +16,8 @@ IgnoreOnIsolate=yes + ConditionPathExists=@DEBUGTTY@ + + [Service] +-Environment=TERM=linux +-ExecStart=@SUSHELL@ ++Environment=ENV=/etc/profile ++ExecStart=/bin/sh -c 'echo -en "\033[?25h"; exec /bin/sh' + Restart=always + RestartSec=0 + StandardInput=tty +-- +2.14.1 + From 259a5b7f731f81e7be2c58b5ccda5e8978d7532c Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Wed, 18 Sep 2019 15:10:42 +0200 Subject: [PATCH 3/3] systemd: use upstream method to enable and configure debug shell With systemd-debug-generator installed we can use the standard "systemd.debug_shell" kernel command line parameter to enable the debug shell. Since systemd 243 the tty can also be changed by appending "=ttyXYZ" to that parameter. Use this method instead of enabling the debug shell on all systems by default. Signed-off-by: Matthias Reichl --- packages/sysutils/systemd/package.mk | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk index ea7dcbe4d9..9f79c815ed 100644 --- a/packages/sysutils/systemd/package.mk +++ b/packages/sysutils/systemd/package.mk @@ -156,8 +156,19 @@ post_makeinstall_target() { safe_remove $INSTALL/usr/bin/systemd-nspawn safe_remove $INSTALL/usr/lib/systemd/system/systemd-nspawn@.service - # remove genetators/catalog - safe_remove $INSTALL/usr/lib/systemd/system-generators + # remove unneeded generators + for gen in $INSTALL/usr/lib/systemd/system-generators/*; do + case "$gen" in + */systemd-debug-generator) + # keep it + ;; + *) + safe_remove "$gen" + ;; + esac + done + + # remove catalog safe_remove $INSTALL/usr/lib/systemd/catalog # remove partition @@ -257,5 +268,4 @@ post_install() { enable_service usercache.service enable_service kernel-overlays.service enable_service hwdb.service - enable_service debug-shell.service }