Need help in auto mount script

What is the problem you are having with rclone?

I am able to mount and access using the command "`rclone mount --allow-other --dir-cache-time 48h MyDrive: mnt/gdrive'". I tried to set up the mounting script so that it will mount automatically when the system starts up, but failed to do so.

What is your rclone version (output from rclone version)

v1.50.2

Which OS you are using and how many bits (eg Windows 7, 64 bit)

os/arch: linux/amd64

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

Google Drive

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

rclone mount --allow-other --dir-cache-time 48h MyDrive: mnt/gdrive

Below is my script

[Unit]
Description=RClone Service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount --allow-other --dir-cache-time 48h MyDrive: mnt/gdrive
#ExecStop=/bin/fusermount -uz mnt/gdrive
Restart=on-abort

[Install]

WantedBy=default.target

Error Msg:

sudo systemctl start rclone.service
Job for rclone.service failed because the control process exited with error code. See "systemctl status rclone.service" and "journalctl -xe" for details.

I'm guessing you are not running it as root? You can be missing the user / group section.

If you check journalctl -u servicename -b

What's the output?

felix@gemini:/etc/systemd/system$ cat rclone.service
[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf
KillMode=none
RestartSec=5
ExecStart=/usr/bin/rclone mount gcrypt: /GD \
--allow-other \
--buffer-size 256M \
--dir-cache-time 1000h \
--log-level INFO \
--log-file /opt/rclone/logs/rclone.log \
--poll-interval 15s \
--timeout 1h \
--umask 002 \
--rc \
--rc-addr 127.0.0.1:5572
ExecStop=/bin/fusermount -uz /GD
Restart=on-failure
User=felix
Group=felix

[Install]
WantedBy=multi-user.target

My service file as an example.

Manage to solve the error by adding --config /home/stevensp/.config/rclone/rclone.conf
But then the mounted drive is empty.

[Unit]
Description=RClone Service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount --config /home/stevensp/.config/rclone/rclone.conf --allow-other --dir-cache-time 48h MyDrive: mnt/gdrive
#ExecStop=/bin/fusermount -uz mnt/gdrive
Restart=on-abort

[Install]

WantedBy=default.target

noob here. What do I add for user and group?
Do i need to create the user and group first?

I think you are missing /mnt/gdrive as the first slash is missing if that is where you are trying to mount to.

It would be whatever user/group you already are using if not root. If you scroll up, you can see the User= and Group= in my service file as an example. If you want to run as root, that's fine, as you have allow other in there so it should work.

1 Like

oh yes you are right! Thanks a lot!

On a side note, I saw the user and group in your example.
How do I check what user and group that I am using?

My user and group are the same as that's how I am setup:

felix@gemini:~$ id
uid=1000(felix) gid=1000(felix) groups=1000(felix),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),109(netdev)

I run everything as felix as he's super cool.

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