It seems neither su nor sudo add process to the user context (proper
cgroup, XDG session), so attempts to talk to the systemd user session
through D-Bus fail.
setpriv --reuid 1000 --regid 1000 --init-groups --reset-env -- \
env XDG_RUNTIME_DIR="/run/user/1000" \
systemd-run --user --slice=app.slice -- \
xterm
I have realized that earlier I forgot to add --user to systemd-run. To
my surprise, it does not work if I set
BUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" instead of
XDG_RUNTIME_DIR. I expected that the former is required for systemd-run.
This command works from a root shell prompt, I hope it should work
during resume as well.