Fresh Mount leads to Fatal error: Directory is not empty:

What is the problem you are having with rclone?

Using systemctl to do a fresh rclone mount. After starting the service or rebooting, I can see my files are properly located in the .gdrive folder. However, if I run "journalctl -u rclone -b", I get:


-- Logs begin at Mon 2021-03-08 03:36:20 UTC, end at Sun 2021-03-28 21:50:53 UTC. --
Mar 28 21:49:03 bbm rclone[1119]: Usage:
Mar 28 21:49:03 bbm rclone[1119]:   rclone [flags]
Mar 28 21:49:03 bbm rclone[1119]:   rclone [command]
Mar 28 21:49:03 bbm rclone[1119]: Available Commands:
Mar 28 21:49:03 bbm rclone[1119]:   about           Get quota information from the remote.
Mar 28 21:49:03 bbm rclone[1119]:   authorize       Remote authorization.
Mar 28 21:49:03 bbm rclone[1119]:   backend         Run a backend specific command.
Mar 28 21:49:03 bbm rclone[1119]:   cat             Concatenates any files and sends them to stdout.
Mar 28 21:49:03 bbm rclone[1119]:   check           Checks the files in the source and destination match.
Mar 28 21:49:03 bbm rclone[1119]:   cleanup         Clean up the remote if possible.
Mar 28 21:49:03 bbm rclone[1119]:   config          Enter an interactive configuration session.
Mar 28 21:49:03 bbm rclone[1119]:   copy            Copy files from source to dest, skipping already copied.
Mar 28 21:49:03 bbm rclone[1119]:   copyto          Copy files from source to dest, skipping already copied.
Mar 28 21:49:03 bbm rclone[1119]:   copyurl         Copy url content to dest.
Mar 28 21:49:03 bbm rclone[1119]:   cryptcheck      Cryptcheck checks the integrity of a crypted remote.
Mar 28 21:49:03 bbm rclone[1119]:   cryptdecode     Cryptdecode returns unencrypted file names.
Mar 28 21:49:03 bbm rclone[1119]:   dedupe          Interactively find duplicate filenames and delete/rename them.
Mar 28 21:49:03 bbm rclone[1119]:   delete          Remove the files in path.
Mar 28 21:49:03 bbm rclone[1119]:   deletefile      Remove a single file from remote.
Mar 28 21:49:03 bbm rclone[1119]:   genautocomplete Output completion script for a given shell.
Mar 28 21:49:03 bbm rclone[1119]:   gendocs         Output markdown docs for rclone to the directory supplied.
Mar 28 21:49:03 bbm rclone[1119]:   hashsum         Produces a hashsum file for all the objects in the path.
Mar 28 21:49:03 bbm rclone[1119]:   help            Show help for rclone commands, flags and backends.
Mar 28 21:49:03 bbm rclone[1119]:   link            Generate public link to file/folder.
Mar 28 21:49:03 bbm rclone[1119]:   listremotes     List all the remotes in the config file.
Mar 28 21:49:03 bbm rclone[1119]:   ls              List the objects in the path with size and path.
Mar 28 21:49:03 bbm rclone[1119]:   lsd             List all directories/containers/buckets in the path.
Mar 28 21:49:03 bbm rclone[1119]:   lsf             List directories and objects in remote:path formatted for parsing.
Mar 28 21:49:03 bbm rclone[1119]:   lsjson          List directories and objects in the path in JSON format.
Mar 28 21:49:03 bbm rclone[1119]:   lsl             List the objects in path with modification time, size and path.
Mar 28 21:49:03 bbm rclone[1119]:   md5sum          Produces an md5sum file for all the objects in the path.
Mar 28 21:49:03 bbm rclone[1119]:   mkdir           Make the path if it doesn't already exist.
Mar 28 21:49:03 bbm rclone[1119]:   mount           Mount the remote as file system on a mountpoint.
Mar 28 21:49:03 bbm rclone[1119]:   move            Move files from source to dest.
Mar 28 21:49:03 bbm rclone[1119]:   moveto          Move file or directory from source to dest.
Mar 28 21:49:03 bbm rclone[1119]:   ncdu            Explore a remote with a text based user interface.
Mar 28 21:49:03 bbm rclone[1119]:   obscure         Obscure password for use in the rclone config file.
Mar 28 21:49:03 bbm rclone[1119]:   purge           Remove the path and all of its contents.
Mar 28 21:49:03 bbm rclone[1119]:   rc              Run a command against a running rclone.
Mar 28 21:49:03 bbm rclone[1119]:   rcat            Copies standard input to file on remote.
Mar 28 21:49:03 bbm rclone[1119]:   rcd             Run rclone listening to remote control commands only.
Mar 28 21:49:03 bbm rclone[1119]:   rmdir           Remove the empty directory at path.
Mar 28 21:49:03 bbm rclone[1119]:   rmdirs          Remove empty directories under the path.
Mar 28 21:49:03 bbm rclone[1119]:   serve           Serve a remote over a protocol.
Mar 28 21:49:03 bbm rclone[1119]:   settier         Changes storage class/tier of objects in remote.
Mar 28 21:49:03 bbm rclone[1119]:   sha1sum         Produces an sha1sum file for all the objects in the path.
Mar 28 21:49:03 bbm rclone[1119]:   size            Prints the total size and number of objects in remote:path.
Mar 28 21:49:03 bbm rclone[1119]:   sync            Make source and dest identical, modifying destination only.
Mar 28 21:49:03 bbm rclone[1119]:   touch           Create new file or change file modification time.
Mar 28 21:49:03 bbm rclone[1119]:   tree            List the contents of the remote in a tree like fashion.
Mar 28 21:49:03 bbm rclone[1119]:   version         Show the version number.
Mar 28 21:49:03 bbm rclone[1119]: Use "rclone [command] --help" for more information about a command.
Mar 28 21:49:03 bbm rclone[1119]: Use "rclone help flags" for to see the global flags.
Mar 28 21:49:03 bbm rclone[1119]: Use "rclone help backends" for a list of supported services.
Mar 28 21:49:08 bbm rclone[1264]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:49:14 bbm rclone[1278]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:49:19 bbm rclone[1297]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:49:25 bbm rclone[1308]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:49:30 bbm rclone[1319]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:49:36 bbm rclone[1331]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:49:41 bbm rclone[1342]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:49:47 bbm rclone[1353]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:49:52 bbm rclone[1363]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:49:58 bbm rclone[1375]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:03 bbm rclone[1385]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:09 bbm rclone[1395]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:14 bbm rclone[1406]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:20 bbm rclone[1416]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:25 bbm rclone[1427]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:31 bbm rclone[1438]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:36 bbm rclone[1449]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:42 bbm rclone[1467]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:47 bbm rclone[1591]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option
Mar 28 21:50:53 bbm rclone[1602]: Fatal error: Directory is not empty: /home/plex/.gdrive If you want to mount it anyway use: --allow-non-empty option

What's causing this? I confirm the folder is empty before starting but still get error.

What is your rclone version (output from rclone version)

1.54.1

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

Ubuntu 20.04

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)


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

[Service]
Type=notify
# Environment=RCLONE_CONFIG=/home/plex/.config/rclone/rclone.conf
KillMode=none
RestartSec=5
ExecStart=/usr/bin/rclone mount crypt: /home/plex/.gdrive \
# This is for allowing users other than the user running rclone access to the mount
--allow-other \
# Google Drive is a polling remote so this value can be set very high and any changes are detected via polling.
--dir-cache-time 1000h \
# To log to syslog as well
--syslog \
# I reduce the poll internval down to 15 seconds as this makes changes appear fast the API quotas per day are huge
--poll-interval 15s \
# This is setting the file permission on the mount to user and group have the same access and other can read
--umask 002 \
# The local disk used for caching
--cache-dir=/home/plex/.cache \
# This is used for caching files to local disk for streaming
--vfs-cache-mode full \
# This limits the cache size to the value below
--vfs-cache-max-size 800G \
# This adds a little buffer for read ahead
--vfs-read-ahead 256M \
# This limits the age in the cache if the size is reached and it removes the oldest files first
--vfs-cache-max-age 1000h \

ExecStop=/bin/fusermount -uz /home/plex/.gdrive
ExecStartPost=/usr/bin/rclone

The rclone config contents with secrets removed.

[gdrive]
type = drive
client_id = 4xyz
client_secret = xyz
scope = drive
root_folder_id = xyz
token = {"access_token":"xyz>

[crypt]
type = crypt
remote = gdrive:media
filename_encryption = standard
directory_name_encryption = true
password = xyz
password2 =xyz

A log from the command with the -vv flag

Paste  log here

what is the output of ls /home/plex/.gdrive

After rebooting or starting the service (censored folder names),

plex@bbm:~$ ls /home/plex/.gdrive
xyz abc

If I stop the service, unmount, and before starting the service again, there's nothing.

not a linux/systemd expert but we do have them in the forum

that last line in multi-line command, perhaps should not have a trailing slash
--vfs-cache-max-age 1000h \

Thanks. I removed that and tried again.

For reference to any future readers, here are steps I'm taking:

sudo systemctl stop rclone.service
fusermount -uz /home/plex/.gdrive
ls .gdrive (confirming nothing is in folder)
sudo systemctl daemon-reload
sudo systemctl start rclone.service

Which leads to:

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

journalctl -u rclone -b leads to the same errors as shown in OP.

this is the goto template for systemd, rclone for plex. try to make your service file like it.

https://github.com/animosity22/homescripts/blob/master/systemd/rclone.service

Thanks. I fully used this template instead of removing features I didn't want (only commenting out the change to the rclone config), and it's working. Looks like my removal of the rc features led to me improperly revising the template.

I plan on having separate users for deluge, sonarr, radarr, etc. Will that have any issue with:

# no-auth is used as no one else uses my server and it is not a shared seedbox
--rc-no-auth \

I'm not exactly what this is used for but don't want to have any huge security issues.

good, that template is well tested.

rclone can run a webserver.
if you use that flag, then any process can access the webserver without logging in
https://rclone.org/rc/#rc-no-auth

as for sonnar, plex and rclone, that same github deals with that.
https://github.com/animosity22/homescripts

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