Package: runit Version: 2.1.2-31 Followup-For: Bug #930758 Hi, it looks like init-system-helpers 1.57 breaks the test (it removes runit-init from the list of supported init). Anyway the following patches should work
Lorenzo -- System Information: Debian Release: 10.0 APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.20.3-van (SMP w/4 CPU cores; PREEMPT) Kernel taint flags: TAINT_OOT_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: runit (via /run/runit.stopit) Versions of packages runit depends on: ii libc6 2.28-10 ii runit-helper 2.8.10 ii sysuser-helper 1.3.3 Versions of packages runit recommends: ii runit-init 2.1.2-30 runit suggests no packages. -- Configuration Files: /etc/runit/3 changed [not included] -- no debconf information
>From c0aab1be9b76ddbbbcbcaf12838092922008342a Mon Sep 17 00:00:00 2001 From: Lorenzo Puliti <lorenzo.r...@gmail.com> Date: Thu, 20 Jun 2019 00:47:17 +0200 Subject: [PATCH 1/3] Provide a service for a getty on serial tty Provide a getty-ttyS0 service; this is needed by autopkgtest for connecting with the testbed (qemu), otherwise a reboot into a runit-init VM will fail the test. --- debian/getty-ttyS0/run | 15 +++++++++++++++ debian/runit.install | 1 + 2 files changed, 16 insertions(+) create mode 100755 debian/getty-ttyS0/run diff --git a/debian/getty-ttyS0/run b/debian/getty-ttyS0/run new file mode 100755 index 0000000..4618e21 --- /dev/null +++ b/debian/getty-ttyS0/run @@ -0,0 +1,15 @@ +#!/bin/sh +NAME=getty-ttyS0 + +if pgrep -x agetty -t ttyS0; then + sv d getty-ttyS0 + echo "already another getty on ttyS0" +fi + +exec 2>&1 + +if [ -e /sbin/fgetty ]; then + exec chpst -P fgetty /dev/ttyS0 +else + exec /sbin/getty -L ttyS0 9600 vt100 +fi diff --git a/debian/runit.install b/debian/runit.install index 40a9466..a9a72fe 100644 --- a/debian/runit.install +++ b/debian/runit.install @@ -21,5 +21,6 @@ runit-2.1.2/src/runit /sbin debian/contrib/shutdown /lib/runit debian/contrib/runlevel /lib/runit debian/sulogin/run /etc/runit/runsvdir/single/sulogin +debian/getty-ttyS0/run /etc/sv/getty-ttyS0 debian/contrib/lib/async-timeout /lib/runit debian/contrib/lib/run_sysv_scripts /lib/runit -- 2.20.1
>From 44982688d5b564c53b9faa8d999ec6f558cee49a Mon Sep 17 00:00:00 2001 From: Lorenzo Puliti <lorenzo.r...@gmail.com> Date: Mon, 17 Jun 2019 14:43:55 +0200 Subject: [PATCH 2/3] Prepare source for autopkgtest Add a debian/tests directory needed for autopkgtest --- debian/tests/control | 1 + 1 file changed, 1 insertion(+) create mode 100644 debian/tests/control diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1 @@ + -- 2.20.1
>From 952d066fb987d0ec37b886bc2df1e6dc786e40e4 Mon Sep 17 00:00:00 2001 From: Lorenzo Puliti <lorenzo.r...@gmail.com> Date: Mon, 17 Jun 2019 16:05:00 +0200 Subject: [PATCH 3/3] add a test for switching to runit-init Add a smoke test for the switch systemd --> runit-init --- debian/tests/control | 9 ++++- debian/tests/init-switch | 85 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100755 debian/tests/init-switch diff --git a/debian/tests/control b/debian/tests/control index 8d1c8b6..5729428 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1 +1,8 @@ - +Tests: init-switch +Depends: runit, + procps, + rsyslog, + cron, + dbus, + udev, +Restrictions: needs-root, isolation-machine, breaks-testbed diff --git a/debian/tests/init-switch b/debian/tests/init-switch new file mode 100755 index 0000000..73fff86 --- /dev/null +++ b/debian/tests/init-switch @@ -0,0 +1,85 @@ +#!/bin/sh +set -e + +if [ -z "$AUTOPKGTEST_REBOOT_MARK" ]; then + if [ -d /run/systemd/system ]; then + init=systemd + elif [ -e /run/initctl ]; then + init=sysv + else + init=unknown-init + fi + echo "testbed is running with $init" + #installing runit-init must be done inside the test + #untill it becomes a dependency of 'init' package + echo "installing runit-init" + apt-get install -y --allow-remove-essential runit-init + if [ -e /tmp/autopkgtest-reboot ]; then + echo "enabling the serial getty" + ln -s /etc/sv/getty-ttyS0 /etc/service/ + echo "Done" + echo "preparing for reboot" + /tmp/autopkgtest-reboot-prepare runit1 + reboot + else + echo "testbed does not support reboot" + echo "can't perform this test" + exit 1 + fi +elif [ "$AUTOPKGTEST_REBOOT_MARK" = runit1 ]; then + echo "detecting runit-init" + if [ -e /run/runit.stopit ]; then + echo "OK" + else + echo "init is not runit" && exit 1 + fi + #searching for runsvdir is pointless, since autopkgtest use serial getty + #to connect with the qemu-system, and getty-S0 starts only after runsvdir.. + echo "detecting gettys" + if pidof getty; then + echo "OK" + elif pidof fgetty; then + echo "OK" + else + echo " no getty to perform login with " && exit 1 + fi + echo "getting the runsvdir log:" + ps aux | grep runsvdir + echo "Detecting active services.." + sv status /etc/service/* + service udev status + service rsyslog status + service cron status + service dbus status + #service --status-all # not usable since some services will exit nonzero with [?] + echo "OK" + echo "Attempting a reboot with runit" + /tmp/autopkgtest-reboot-prepare runit2 + reboot +else + echo "detecting runit-init" + if [ -e /run/runit.stopit ]; then + echo "OK" + else + echo "init is not runit" && exit 1 + fi + echo "detecting gettys" + if pidof getty; then + echo "OK" + elif pidof fgetty; then + echo "OK" + else + echo " no getty to perform login with " && exit 1 + fi + echo "getting the runsvdir log:" + ps aux | grep runsvdir + echo "Detecting active services.." + sv status /etc/service/* + service udev status + service rsyslog status + service cron status + service dbus status + echo "OK" + echo "switching to runit init complete" +fi +echo "test done" -- 2.20.1