Skip to content

Commit f6e6be2

Browse files
bengaljohannbg
authored andcommitted
fix(network-manager): disable tty output if the console is not usable
The network-manager module also writes logs to the console, so that it's easier to debug network-related boot issues. If systemd can't open the console, the service fails and network doesn't get configured. Add a check to disable tty output when the console is not present or not usable. coreos/fedora-coreos-tracker#943
1 parent e07b7ad commit f6e6be2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

modules.d/35network-manager/nm-config.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
1818
) > /run/NetworkManager/conf.d/initrd-logging.conf
1919

2020
if [ -n "$DRACUT_SYSTEMD" ]; then
21-
mkdir -p /run/systemd/system/nm-initrd.service.d
22-
cat << EOF > /run/systemd/system/nm-initrd.service.d/tty-output.conf
21+
# Enable tty output if a usable console is found
22+
# See https://github.com/coreos/fedora-coreos-tracker/issues/943
23+
# shellcheck disable=SC2217
24+
if [ -w /dev/console ] && (echo < /dev/console) > /dev/null 2> /dev/null; then
25+
mkdir -p /run/systemd/system/nm-initrd.service.d
26+
cat << EOF > /run/systemd/system/nm-initrd.service.d/tty-output.conf
2327
[Service]
2428
StandardOutput=tty
2529
EOF
26-
systemctl --no-block daemon-reload
30+
systemctl --no-block daemon-reload
31+
fi
2732
fi
2833
fi
2934

modules.d/35network-manager/nm-initrd.service

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ExecReload=/usr/bin/busctl call org.freedesktop.NetworkManager /org/freedesktop/
1818
ExecStart=/usr/sbin/NetworkManager --debug
1919
KillMode=process
2020
# The following gets changed to StandardOutput=tty by nm-config.sh
21-
# when debug is enabled.
21+
# when debug is enabled and a usable console is found.
2222
StandardOutput=null
2323
Environment=NM_CONFIG_ENABLE_TAG=initrd
2424
Restart=on-failure

0 commit comments

Comments
 (0)