-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(network-manager): disable tty output if the console is not usable #1611
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,20 @@ if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then | |
echo '[logging]' | ||
echo 'level=TRACE' | ||
) > /run/NetworkManager/conf.d/initrd-logging.conf | ||
|
||
if [ -n "$DRACUT_SYSTEMD" ]; then | ||
# 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any implications of running this daemon-reload here? If we ran this as part of a systemd generator would we need to do the daemon-reload? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not aware of any side effect of calling daemon-reload here. A generator would be an alternative and wouldn't require a daemon-reload; I think it requires to ship new service and a script. I like how the current code is self-contained, but I have no objections in turning it into a generator if that's the general consensus. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lucab - any thoughts here on the tradeoffs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, reloading in the middle of a boot isn't the nicest, a generator would be advisable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree a generator would be slightly cleaner and would make a good follow-up, but if this is already tested IMO it's not worth the respin. |
||
fi | ||
fi | ||
fi | ||
|
||
nm_generate_connections |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume
echo < /dev/console
is a test and will fail if the console doesn't work? It seems weird to me to send anything to stdin ofecho
since it doesn't do anything with it.cat
does.Also:
I think this is equivalent with less characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this code from https://github.com/dracutdevs/dracut/blob/055/modules.d/99shutdown/shutdown.sh#L15
The idea is to try to open the console via shell redirection, but don't actually read or write anything from/to it. If
/dev/console
can't be opened, the command returns a non-zero value which is interpreted asfalse
.The interpreter of this script is
/bin/sh
, so it must be POSIX compatible.&>
is a bashism and is not POSIX.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reply/explanation.