-
Notifications
You must be signed in to change notification settings - Fork 402
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
dracut-shutdown.service lacks DRACUT_SYSTEMD=1 environment variable #1862
Comments
This is wrong, |
Indeed. However, the bug remains. During Seems like this is actually a systemd bug? systemd's system-shutdown https://github.com/systemd/systemd/blob/main/src/shutdown/shutdown.c should set the |
Right, now I see the problem.
This is not a systemd bug, systemd is not going to export any environment variable unrelated to systemd... |
You can try this patch and give some feedback. If it works, update your PR with it. diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh
index 73550ba9..6b1e526b 100755
--- a/modules.d/99shutdown/shutdown.sh
+++ b/modules.d/99shutdown/shutdown.sh
@@ -17,6 +17,9 @@ ACTION="$1"
export TERM=linux
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
+if [ -e /oldroot/etc/machine-id ]; then
+ export DRACUT_SYSTEMD=1
+fi
. /lib/dracut-lib.sh
if [ "$(stat -c '%T' -f /)" = "tmpfs" ]; then |
@dtardon WDYT? |
Why do you think so? This whole |
Yes, 8-year old code added by Harald, good old days. |
Why don't you ask them instead of guessing? |
That aside, the main point is if it even makes any sense to export |
Thank you for your consideration!
I wouldn't worry just yet. My interpretation is that systemd is quite fond of dracut, because quote https://systemd.io/INITRD_INTERFACE/
Then systemd could accommodate the request in a generic way. They already have a generic term for this as in above link "initrd Interface of systemd". Instead of
dracut-lib.sh looks at the DRACUT_SYSTEMD environment variable. For example, the info and warn functions of dracut-lib.sh require a properly set DRACUT_SYSTEMD. Otherwise, the info and warn function do not work as expected, as they usually do. https://github.com/zfsonlinux/dracut/blob/master/modules.d/99base/dracut-lib.sh
|
Why wouldn't they work? What's the exact problem there? |
No output visible in console during shutdown. Because they don't write to kmsg. |
They do, if DRACUT_SYSTEMD is unset. You pasted the code here yourself... |
Indeed. I was wrong. It's no about kmsg. It's about stdout vs stderr. For a systemd enabled system...
stdout vs stderr:
That is inconsistent. But it's not about a formality but difference in console / serial console output that I experienced.
In other words, shorter... Or more generically worded: |
During dracut now (while using
@aafeijoo-suse #1862 (comment)
Thank you for your patch suggestion! Tested it... dracut with patch suggestion (
I am not sure why that is but seems actually setting environment variable
Seems to work all as intended according to dracut manpage on In conclusion, probably user error.
One could argue that the So unless someone (still) believes there might be an issue here, the pull request and this issue can be closed. |
Describe the bug
dracut-shutdown.service lacks DRACUT_SYSTEMD=1 environment variable
Distribution used
Debian but easily seen in dracut upstream source code:
https://github.com/dracutdevs/dracut/blob/master/modules.d/98dracut-systemd/dracut-shutdown.service#L11
Dracut version
latest git
Init system
systemd
To Reproduce
Write a shutdown hook and check for DRACUT_SYSTEMD variable existence.
Expected behavior
DRACUT_SYSTEMD=1 environment variable should be set during
Additional context
dracut-lib.sh looks at the DRACUT_SYSTEMD environment variable. For example, the
info
andwarn
functions of dracut-lib.sh require a properly set DRACUT_SYSTEMD.All other dracut systemd units in https://github.com/dracutdevs/dracut/blob/master/modules.d/98dracut-systemd/ are setting the DRACUT_SYSTEMD environment variable too.
The text was updated successfully, but these errors were encountered: