Mount OneDrive at boot

What is the problem you are having with rclone?

I want to execute Rclone at boot of my OS.

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

rclone v1.65.0-DEV
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 6.2.0-37-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21.4
- go/linking: static
- go/tags: none


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

OneDrive

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

  1. Create a new service file:
sudo nano /etc/systemd/system/rclone-mount.service

  1. Add the following content to the service file:
[Unit]
Description=Rclone OneDrive Mount
After=network-online.target

[Service]
Type=simple
ExecStart=/home/salvatore/rclone/rclone --vfs-cache-mode writes mount OneDrive: ~/OneDrive
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

  1. Reload systemd to read the new service file:
sudo systemctl daemon-reload

  1. Enable the service to run at startup:
sudo systemctl enable rclone-mount.service

  1. Start the service:
sudo systemctl start rclone-mount.service

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 = business
### Double check the config for sensitive info before posting publicly

Are you having some problem with it? Or rather your intention was to post it in Howto Guides?

I have still problems, since it is not working

I am sorry but you did not mention a word what is not working:)

Start with full debug log.

in this case capture it to a file

ExecStart=/home/salvatore/rclone/rclone --vfs-cache-mode writes mount OneDrive: ~/OneDrive -vv --log-file /path/to/rclone.log

and post content here

Please note that systemd job usually runs as root (unless you specify it differently).... which means:

  1. rclone.config file is in another location than when you run it as your user
  2. ~ means /root
  3. mount established by root is not accessible by other users

To rectify it modify your service file:

great, now it works. Thank you,

1 Like

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