Mounting on startup systemctl error

What is the problem you are having with rclone?

I'm trying to mount rclone on startup on Arch Linux with systemctl, but am getting an error and can't figure it out.

Run the command 'rclone version' and share the full output of the command.

rclone v1.67.0

  • os/version: arch (64 bit)
  • os/kernel: 6.10.2-arch1-1 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.22.5
  • go/linking: dynamic
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Microsoft OneDrive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

I put this in /etc/systemd/system/rclonemount.service:

Description=rclonemount
AssertPathIsDirectory=/home/mjt/OneDrive
After=network-online.target

[Service]
[Unit]
Description=rclonemount
AssertPathIsDirectory=/home/mjt/OneDrive
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount --config=/root/.config/rclone/rclone.conf --vfs-cache-mode full OneDrive:onedrive /home/mjt/OneDrive
ExecStop=/bin/fusermount -u /home/mjt/OneDrive
Restart=always
RestartSec=10

[Install]
WantedBy=default.target

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[onedrive]
type = onedrive
token = XXX
drive_id = XXX
drive_type = personal
### Double check the config for sensitive info before posting publicly

A log from the command that you were trying to run with the -vv flag

I get this error after running systemctl status rclonemount:

● rclonemount.service - rclonemount
     Loaded: loaded (/etc/systemd/system/rclonemount.service; enabled; preset: disabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-08-03 12:28:31 PDT; 7s ago
 Invocation: 9db8c35660544ecb8b87aa25c1bcd5af
    Process: 3814 ExecStart=/usr/bin/rclone mount --config=/root/.config/rclone/rclone.conf --vfs-cache-mode full OneDrive:onedrive /home/mjt/OneDrive (code=exited, status=1/FAILURE)
   Main PID: 3814 (code=exited, status=1/FAILURE)
   Mem peak: 30.3M
        CPU: 135ms

welcome to the forum,

  • can use a rclone debug log - --log-level=DEBUG --log-file=/path/to/rclone.log
  • make sure the mount command works on the command line, run as the same user as with systemd
  • does that user have permissions to /home/mjt/OneDrive ?
1 Like

Thanks for your reply @asdffdsa, thanks to your second and third suggestions I managed to fix it!

First, the mount command didn't work on the command line. Sorted that out by changing that ExecStart line to:

ExecStart: rclone --vfs-cache-mode full mount "onedrive": /home/mjt/OneDrive

However, after this the error still remained. Thanks to this Rclone forum post in particular I figured it out. Turns out the issue was that systemctl was running the service as root, while I had initially set up the rclone remote on my regular user account. As explained in the linked post, the root user has a different default config file than a non-sudo user. Adding this to rclonemount.service under the [Service] section fixed it:

[Service]
...
User=mjt
...

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.