systemctl/ hostnamectl/ timedatectl and dbus

Started by thom_nic, January 06, 2017, 04:30:08 PM

Previous topic - Next topic

thom_nic

I'm using release 5 of the official Debian image and it seems the dbus session bus is not running (or maybe dbus is not installed at all? `ps ax|grep dbus` shows nothing...)


root@AM335x:~# systemctl --user
Failed to get D-Bus connection: Connection refused

root@AM335x:~# hostnamectl
Failed to create bus connection: No such file or directory

root@AM335x:~# timedatectl
Failed to create bus connection: No such file or directory


The application I'll be building wants to do things like configure network settings, hostname, etc.  Using systemd utilities (and dbus more generally) to accomplish this seemed like it might be a better way to go vs e.g. writing directly to files in /etc/.  Thanks in advance!


thom_nic

To answer my own old question...

systemctl works fine without dbus only when run as root (which you pretty much always need to run as root anyway)

instead of hostnamectl I do the "classic": write to /etc/hostname then sudo hostname -f /etc/hostname

instead of timedatectl I use the "classic" form:

ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime to set timezone

write to `/etc/systemd/timesyncd.conf` and `sudo systemctl reload systemd-timesyncd`