diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c9006b5cb1..cc2d9bd5b6 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index d90ec52a45..bcd7c3667c 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -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 #-----------------------------------------------------------------------------------