2 # SPDX-License-Identifier: LGPL-2.1-or-later
6 # Check if the colored --version output behaves correctly
7 SYSTEMD_COLORS
=256 systemctl
--version
9 # Check if we properly differentiate between a full systemd setup and a "light"
10 # version of it that's done during daemon-reexec
12 # See: https://github.com/systemd/systemd/issues/27106
13 if systemd-detect-virt
-q --container; then
14 # We initialize /run/systemd/container only during a full setup
15 test -e /run
/systemd
/container
16 cp -afv /run
/systemd
/container
/tmp
/container
17 rm -fv /run
/systemd
/container
18 systemctl daemon-reexec
19 test ! -e /run
/systemd
/container
20 cp -afv /tmp
/container
/run
/systemd
/container
22 # We bring the loopback netdev up only during a full setup, so it should
23 # not get brought back up during reexec if we disable it beforehand
24 [[ "$(ip -o link show lo)" =~ LOOPBACK
,UP
]]
26 [[ "$(ip -o link show lo)" =~ state\ DOWN
]]
27 systemctl daemon-reexec
28 [[ "$(ip -o link show lo)" =~ state\ DOWN
]]
31 # We also disable coredumps only during a full setup
32 sysctl
-w kernel.core_pattern
=dont-overwrite-me
33 systemctl daemon-reexec
34 diff <(echo dont-overwrite-me
) <(sysctl
--values kernel.core_pattern
)
37 # Collect failed units & do one daemon-reload to a basic sanity check
38 systemctl
--state=failed
--no-legend --no-pager |
tee /failed
40 systemctl daemon-reload
42 # Check that the early setup is actually skipped on reexec.
43 # If the early setup is done more than once, then several timestamps,
44 # e.g. SecurityStartTimestamp, are re-initialized, and causes an ABRT
45 # of systemd-analyze blame. See issue #27187.
48 # Test for 'systemd-update-utmp runlevel' vs 'systemctl daemon-reexec'.
50 # shellcheck disable=SC2034
51 if [[ -x /usr
/lib
/systemd
/systemd-update-utmp
]]; then
53 systemctl daemon-reexec
&
55 # shellcheck disable=SC2034
57 SYSTEMD_LOG_LEVEL
=debug
/usr
/lib
/systemd
/systemd-update-utmp runlevel