mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
270b20b98b
In several Ubuntu CI jobs I noticed timeouts in TEST-69, which are apparently caused by a very stubborn bash/login process: $ journalctl -o short-monotonic --no-hostname --file artifacts/TEST-69-SHUTDOWN.journal [ 2011.698430] systemd[1]: shutdown.target: starting held back, waiting for: veritysetup.target [ 2011.698473] systemd[1]: sysinit.target: stopping held back, waiting for: user@0.service [ 2045.884982] systemd[1]: systemd-oomd.service: Got notification message from PID 54 (WATCHDOG=1) [ 2071.576424] systemd[1]: Received SIGCHLD from PID 65 (bash). [ 2071.576941] systemd[1]: Child 65 (bash) died (code=killed, status=1/HUP) [ 2071.577026] systemd[1]: session-13.scope: Child 65 belongs to session-13.scope. [ 2071.577100] systemd[1]: session-13.scope: cgroup is empty [ 2071.577249] systemd[1]: session-13.scope: Deactivated successfully. $ journalctl -o short-monotonic --no-hostname --file artifacts/TEST-69-SHUTDOWN.journal _PID=65 [ 3038.661488] login[65]: ROOT LOGIN on '/dev/pts/0' Since, in this case, we really care only about the actual shutdown, let's shorten the service stop/abort timeouts to let systemd SIGKILL all remaining processes in the 60s `expect` window.
46 lines
1.2 KiB
Bash
Executable File
46 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
set -e
|
|
|
|
TEST_DESCRIPTION="shutdown testing"
|
|
IMAGE_NAME="shutdown"
|
|
TEST_NO_QEMU=yes
|
|
# Prevent shutdown in test suite, the expect script does that manually.
|
|
TEST_SKIP_SHUTDOWN=yes
|
|
|
|
# shellcheck source=test/test-functions
|
|
. "${TEST_BASE_DIR:?}/test-functions"
|
|
|
|
_ORIG_NSPAWN="${SYSTEMD_NSPAWN:?}"
|
|
SYSTEMD_NSPAWN="${STATEDIR:?}/run-nspawn"
|
|
|
|
setup_nspawn_root_hook() {
|
|
cat >"${STATEDIR:?}/run-nspawn" <<EOF
|
|
#!/bin/bash
|
|
exec "${TEST_BASE_DIR:?}/test-shutdown.py" -v -- "$_ORIG_NSPAWN" "\$@"
|
|
exit 1
|
|
EOF
|
|
chmod 755 "${STATEDIR:?}"/run-nspawn
|
|
}
|
|
|
|
test_append_files() {
|
|
local workspace="${1:?}"
|
|
|
|
# Shorten the service stop/abort timeouts to let systemd SIGKILL stubborn
|
|
# processes as soon as possible, as we don't really care about them in this
|
|
# particular test
|
|
mkdir -p "$workspace/etc/systemd/system.conf.d"
|
|
cat >"$workspace/etc/systemd/system.conf.d/99-timeout.conf" <<EOF
|
|
[Manager]
|
|
DefaultTimeoutStopSec=30s
|
|
DefaultTimeoutAbortSec=30s
|
|
EOF
|
|
|
|
inst /usr/bin/screen
|
|
echo "PS1='screen\$WINDOW # '" >>"$workspace/root/.bashrc"
|
|
echo 'startup_message off' >"$workspace/etc/screenrc"
|
|
echo 'bell_msg ""' >>"$workspace/etc/screenrc"
|
|
}
|
|
|
|
do_test "$@"
|