Poweroff/reboot returns error message but does the job anyway

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version | cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=9
G_DIETPI_VERSION_SUB=2
G_DIETPI_VERSION_RC=1
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
bookworm 0
  • Kernel version | uname --all
Linux node01 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
  • Architecture | dpkg --print-architecture
arm64
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
RPi CM 4 (aarch64)
  • Power supply used | (EG: 5V 1A RAVpower)
turing pi

Steps to reproduce

  1. Installed dietpi on my system.
  2. Try to sudo reboot, same happend via ansible

Expected behaviour

  • Reboot the system without error. Ansible is compaining because of the message.

Actual behaviour

Failed to set wall message, ignoring: Unit dbus-org.freedesktop.login1.service failed to load properly, please adjust/correct and reload service manager: File exists
Call to Reboot failed: Unit dbus-org.freedesktop.login1.service failed to load properly, please adjust/correct and reload service manager: File exists

This causes my ansible-script to fail at the end.

Extra details

I saw the fix, as well the tickets and the blogpost from sep , but somehow still having the error.

Did i miss something? Do i have to activate or set something? Did not find anything in the documentation.
I checked /boot/dietpi/func/dietpi-globals and it is fine.

Thanks a lot

how does it behave to start systemd-logind service? (if not already done)

systemctl unmask systemd-logind.service
systemctl start systemd-logind.service

Hi,

thanks a lot.
Now it works without problems.

does it survive a reboot?

The workaround we applied creates a shell function for the reboot command. But when using sudo, this function is not used, but the actual reboot command, which includes the logind access attempts and hence the errors (if logind is not running).

Pretty ugly, but it would be possible to solve this with an alias, which passes through this function:

alias reboot='dash -c "$(declare -f reboot); reboot"'

Normally, aliases do not work after sudo, but we create an alias sudo='sudo ', so that DietPi scripts can be executed with sudo, and hence such reboot alias as well. Not sure whether it is worth it :smile:?