diff --git a/modules.d/35network-manager/nm-config.sh b/modules.d/35network-manager/nm-config.sh index 85f89cb0..2b13d0a7 100755 --- a/modules.d/35network-manager/nm-config.sh +++ b/modules.d/35network-manager/nm-config.sh @@ -18,12 +18,17 @@ if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then ) > /run/NetworkManager/conf.d/initrd-logging.conf if [ -n "$DRACUT_SYSTEMD" ]; then - mkdir -p /run/systemd/system/nm-initrd.service.d - cat << EOF > /run/systemd/system/nm-initrd.service.d/tty-output.conf + # Enable tty output if a usable console is found + # See https://github.com/coreos/fedora-coreos-tracker/issues/943 + # shellcheck disable=SC2217 + if [ -w /dev/console ] && (echo < /dev/console) > /dev/null 2> /dev/null; then + mkdir -p /run/systemd/system/nm-initrd.service.d + cat << EOF > /run/systemd/system/nm-initrd.service.d/tty-output.conf [Service] StandardOutput=tty EOF - systemctl --no-block daemon-reload + systemctl --no-block daemon-reload + fi fi fi diff --git a/modules.d/35network-manager/nm-initrd.service b/modules.d/35network-manager/nm-initrd.service index 6d85777e..e84aba95 100644 --- a/modules.d/35network-manager/nm-initrd.service +++ b/modules.d/35network-manager/nm-initrd.service @@ -17,7 +17,7 @@ ExecReload=/usr/bin/busctl call org.freedesktop.NetworkManager /org/freedesktop/ ExecStart=/usr/sbin/NetworkManager --debug KillMode=process # The following gets changed to StandardOutput=tty by nm-config.sh -# when debug is enabled. +# when debug is enabled and a usable console is found. StandardOutput=null Environment=NM_CONFIG_ENABLE_TAG=initrd Restart=on-failure