Skip to content

systemd: Failed to connect to bus: No such file or directory

abraunegg edited this page Sep 16, 2019 · 2 revisions

On Ubuntu and Debian systems, if you attempt to enable the systemd 'onedrive' service as the 'root' user as per these instructions this may fail with the following error:

Failed to connect to bus: No such file or directory

This is not a 'onedrive' bug or client issue, rather than a Ubuntu & Debian systemd issue. If you encounter this issue, the steps below is a workaround for running the systemd service as root.

  1. Ensure that the client is 'authorised' and works 100% when as 'root' & using onedrive --synchronize --verbose
  2. Enable the service with the following: systemctl enable [email protected]
  3. Edit /etc/systemd/system/multi-user.target.wants/[email protected] and update the confdir parameter:
--confdir=/root/.config/onedrive
  1. Issue a systemctl daemon-reload
  2. Start the service with: systemctl start [email protected]
  3. Check the status with: systemctl status [email protected]
root@alex-virtual-machine:~# uname -a
Linux alex-virtual-machine 5.0.0-27-generic #28~18.04.1-Ubuntu SMP Thu Aug 22 03:00:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
root@alex-virtual-machine:~# systemctl status [email protected]
â—� [email protected] - OneDrive Free Client for root
   Loaded: loaded (/lib/systemd/system/[email protected]; indirect; vendor preset: enabled)
   Active: active (running) since Tue 2019-09-17 06:48:54 AEST; 8min ago
     Docs: https://github.com/abraunegg/onedrive
 Main PID: 1906 (onedrive)
    Tasks: 2 (limit: 2302)
   CGroup: /system.slice/system-onedrive.slice/[email protected]
           └─1906 /usr/local/bin/onedrive --monitor --confdir=/root/.config/onedrive

Sep 17 06:56:44 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: random_files/ILg9AFI0BLiE1TwT3fK4j0atyyKyZNd3/file0.data
Sep 17 06:56:44 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: random_files/ILg9AFI0BLiE1TwT3fK4j0atyyKyZNd3/file2.data
Sep 17 06:56:44 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: random_files/ILg9AFI0BLiE1TwT3fK4j0atyyKyZNd3/file8.data
Sep 17 06:56:44 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: random_files/ILg9AFI0BLiE1TwT3fK4j0atyyKyZNd3/file9.data
Sep 17 06:56:45 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: random_files/ILg9AFI0BLiE1TwT3fK4j0atyyKyZNd3/file3.data
Sep 17 06:56:45 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: random_files/ILg9AFI0BLiE1TwT3fK4j0atyyKyZNd3/file5.data
Sep 17 06:56:46 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: random_files/ILg9AFI0BLiE1TwT3fK4j0atyyKyZNd3/file1.data
Sep 17 06:56:46 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: random_files/ILg9AFI0BLiE1TwT3fK4j0atyyKyZNd3/file4.data
Sep 17 06:56:47 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: random_files/ILg9AFI0BLiE1TwT3fK4j0atyyKyZNd3
Sep 17 06:56:47 alex-virtual-machine onedrive[1906]: Deleting item from OneDrive: ./random_files
root@alex-virtual-machine:~#