Skip to content

Commit

Permalink
v8.22
Browse files Browse the repository at this point in the history
- Bookworm | Resolved an issue where poweroff/reboot/halt commands did throw errors about missing dbus or logind. DietPi ships without dbus and with logind masked by default, as we do not see their features being used on a typical DietPi system. Instead, dbus is installed and logind unmasked on demand on certain software installs or when chosen via dietpi.txt. However, the newer systemd version since Bookworm attempts dbus > logind communication in any case when calling poweroff/reboot/halt, despite no wall message being sent, e.g. to handle shutdown inhibitors (like open SSH session being able to prevent shutdown), and throws errors if either dbus is not reachable or logind not running. Until in case dbus or logind are further tied into common system commands or features, we solved the issue by creating shell functions for poweroff/reboot/halt which call the respective systemd target directly to bypass logind (and hence dbus), but fall back to the original commands, depending on given command-line parameters.
  • Loading branch information
MichaIng committed Sep 19, 2023
1 parent 20f42c4 commit e591aeb
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Enhancements:

Bug fixes:
- NanoPi R4S | Resolved a v8.20 regression where the Ethernet LEDs did not react correctly after the kernel upgrade. Many thanks to @idaanx for reporting this issue: https://github.com/MichaIng/DietPi/issues/6342#issuecomment-1697669420
- Bookworm | Resolved an issue where poweroff/reboot/halt commands did throw errors about missing dbus or logind. DietPi ships without dbus and with logind masked by default, as we do not see their features being used on a typical DietPi system. Instead, dbus is installed and logind unmasked on demand on certain software installs or when chosen via dietpi.txt. However, the newer systemd version since Bookworm attempts dbus > logind communication in any case when calling poweroff/reboot/halt, despite no wall message being sent, e.g. to handle shutdown inhibitors (like open SSH session being able to prevent shutdown), and throws errors if either dbus is not reachable or logind not running. Until in case dbus or logind are further tied into common system commands or features, we solved the issue by creating shell functions for poweroff/reboot/halt which call the respective systemd target directly to bypass logind (and hence dbus), but fall back to the original commands, depending on given command-line parameters.
- dietpi-bookworm-upgrade | Resolved an issue on systems with Armbian repository, where the system was still identified as Bullseye after the distribution upgrade to Bookworm. Reason was Armbian's base-files package, which was not upgraded as intended. On all DietPi systems, the original base-files package from Debian will now be enforced to prevent this and similar issues. Many thanks to @rogerthn2019 for reporting this issue: https://github.com/MichaIng/DietPi/issues/6227#issuecomment-1713688577
- DietPi-Config | The menu option to update the SPI bootloader is now shown on Orange Pi 5 Plus as well, as intended. Many thanks for @zappydood for reporting its absence: https://github.com/MichaIng/DietPi/issues/6501#issuecomment-1697175109
- DietPi-Software | Ampache: Resolved an issue where the latest version was not successfully detected on install, so that an older fallback version was installed instead. Many thanks to @bartolus39 for reporting this issue: https://github.com/MichaIng/DietPi/issues/6598
Expand Down
47 changes: 47 additions & 0 deletions dietpi/func/dietpi-globals
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,53 @@ could not be found in file \$3
read -rt "$1" -u "$G_SLEEP_FD" || :
}

# Override for poweroff/halt/reboot commands to mute dbus/logind error messages on Bookworm and above, if dbus/logind is not installed/masked: https://github.com/MichaIng/DietPi/issues/6500
if [[ $G_DISTRO -gt 6 && -L '/etc/systemd/system/systemd-logind.service' ]]
then
poweroff()
{
local command='poweroff'
for i in "$@"
do
case $i in
'-p'|'--poweroff'|'--no-wall') :;;
'--reboot') command='reboot';;
'--halt') command='halt';;
*) /sbin/poweroff "$@"; return $?;;
esac
done
systemctl start "$command.target"
}
reboot()
{
local command='reboot'
for i in "$@"
do
case $i in
'-p'|'--poweroff') command='poweroff';;
'--reboot'|'--no-wall') :;;
'--halt') command='halt';;
*) /sbin/reboot "$@"; return $?;;
esac
done
systemctl start "$command.target"
}
halt()
{
local command='halt'
for i in "$@"
do
case $i in
'-p'|'--poweroff') command='poweroff';;
'--reboot') command='reboot';;
'--halt'|'--no-wall') :;;
*) /sbin/halt "$@"; return $?;;
esac
done
systemctl start "$command.target"
}
fi

#-----------------------------------------------------------------------------------
: # Return exit code 0, by triggering null as last command to output
#-----------------------------------------------------------------------------------
Expand Down

0 comments on commit e591aeb

Please sign in to comment.