You are not logged in.
I'm using ly as desktop-manager and dwm as window manager, it's started through my xinitrc which is posted below.
The first time I login XDG_SESSION_TYPE is set to tty, at this point both XDG_SESSION_ID and DBUS_SESSION_BUS_ADDRESS are set.
The next time I login XDG_SESSION_TYPE is x11, at this point neither of above mentioned variables are set. Resulting in loss of session knowledge within for example power management utilities (reboot, poweroff not working).
I've tried to dig around the ly code to be able to identify what's actually happening, but it hasn't made me smarted. According to the source, since I use xinitrc it should set XDG_SESSION_TYPE to x11.
pam_systemd that's responsible for setting XDG_SESSION_ID doesn't have necessarily respond to changes with the set session type.
Any idea what might cause this behaviour?
.xinitrc.sh:
#!/bin/sh
setxkbmap -option "ctrl:nocaps" se
[ -f $HOME/.Xmodmap ] && xmodmap $HOME/.Xmodmap
[ -f $HOME/.Xresources ] && xrdb -merge $HOME/.Xresources
[ -f $HOME/.fehbg ] && source $HOME/.fehbg
(bash $HOME/.config/statusbar.sh | while read LINE; do xsetroot -name "${LINE}" &>/dev/null; done) &
# Android Studio fix on DWM
export _JAVA_AWT_WM_NONREPARENTING=1
# Set adaptable QT theme
export QT_QPA_PLATFORMTHEME=qt5ct
systemctl --user start xss-lock.service
exec dwm &> $HOME/.local/dwm.logOffline