Linux Mastering Development

systemd service stops logging to systemd-journal after executing dbus as non-root user

Sorry for the confusing title,

My current situation is following: I have a normal systemd service running (as root user&privileges). However, the service should alter my regular user’s certain dconf values. Therefore I’m writing the dconf value from the service with help of sudo as follows:

sudo -u user dbus-launch dconf write /...

The writing of the dconf value works perfectly fine. However, after writing the dconf value, the service itself cannot log anything to the systemd log (cannot see the log output of the service via journalctl or systemctl status). I can only see the log output PRIOR to the execution of the sudo’ed dbus command.

The last lines from service’s log are something like:

sudo[1478]:    root : TTY=unknown ; PWD=/ ; USER=user ; COMMAND=/usr/bin/dbus-launch dconf write /...
sudo[1478]: pam_unix(sudo:session): session opened for user used by (uid=0)
dbus-daemon[1493]: [session uid=1000 pid=1491] Activating service name='ca.desrt.dconf' requested by ':1.0' (uid=1000 pid=1489 comm=dbus-launch dconf write ...)
dbus-daemon[1493]: [session uid=1000 pid=1491] Successfully activated service 'ca.desrt.dconf'
sudo[1478]: pam_unix(sudo:session): session closed for user user

How could I work this around so that I would not lose the possibility to log output after running dconf commands as a regular used from a elevated systemd service?

Leave a Reply

Your email address will not be published. Required fields are marked *