Rclone deletes home directory when you rm -r mountpoint if

What is the problem you are having with rclone?

rclone just right now deleted everything in my home directory.

TLDR;

  1. mount local folder in homedir to a mountpoint also in your home dir
  2. rm -r the mountpoint
  3. your home directory is now empty

But why would anyone mount a local folder and delete the mountpoint??

That's not the point.

rclone should never rm -r the parent directory of a mountpoint

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

[niki@archlinux user]$ rclone version
rclone v1.60.0

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

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

27/local disk

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

I was deleting the mount point while it was mounted

[niki@archlinux ~]$ rm -r rclocaltest_yes_rc_yes_cache/

The rclone config contents with secrets removed.

Unfortunately, rclone deleted the config. And all other configs and everything else.
From memory: It was simple 27 / local disk, defaults

Journal

[niki@archlinux ~]$ journalctl --user -fu rclone-bench.service                                                                                                                                                 [666/4047]
Nov 18 23:15:26 archlinux systemd[282]: Started rclone bench.                                                                                                                                                            
Nov 18 23:15:29 archlinux rclone[2263502]: INFO  : Local file system at /home/niki: poll-interval is not supported by this remote                                                                                        
Nov 18 23:15:29 archlinux rclone[2263502]: INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)                                                                        
Nov 18 23:16:33 archlinux rclone[2263502]: INFO  : vfs cache: cleaned: objects 1 (was 1) in use 1, to upload 0, uploading 0, total size 0 (was 0)                                                                        
Nov 18 23:16:55 archlinux rclone[2263502]: INFO  : 1G.BIN: vfs cache: queuing for upload in 5s                                                                                                                           
Nov 18 23:17:01 archlinux rclone[2263502]: INFO  : 1G.BIN: Copied (replaced existing)                                                                                                                                    
Nov 18 23:17:01 archlinux rclone[2263502]: INFO  : 1G.BIN: vfs cache: upload succeeded try #1                                                                                                                            
Nov 18 23:17:07 archlinux rclone[2263502]: NOTICE: .cache/yay/iriunwebcam-bin/src/iriunwebcam-2.7.deb: Can't follow symlink without -L/--copy-links                                                                      
Nov 18 23:17:07 archlinux rclone[2263502]: ERROR : .cache/yay/iriunwebcam-bin/src/: Dir.Remove failed to remove directory: remove /home/niki/.cache/yay/iriunwebcam-bin/src: directory not empty                         
Nov 18 23:17:07 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/.cache/yay/iriunwebcam-bin/src: directory not empty                                                                                       
Nov 18 23:17:08 archlinux rclone[2263502]: ERROR : .cache/yay/yt-dlp-git/pkg: failed to open directory ".cache/yay/yt-dlp-git/pkg": open /home/niki/.cache/yay/yt-dlp-git/pkg: permission denied                         
Nov 18 23:17:19 archlinux rclone[2263502]: NOTICE: .config/systemd/user/default.target.wants/rclone-od5tb1-youtube-backups.service: Can't follow symlink without -L/--copy-links                                         
Nov 18 23:17:19 archlinux rclone[2263502]: ERROR : .config/systemd/user/default.target.wants/: Dir.Remove failed to remove directory: remove /home/niki/.config/systemd/user/default.target.wants: directory not empty
Nov 18 23:17:19 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/.config/systemd/user/default.target.wants: directory not empty                                               
Nov 18 23:17:19 archlinux rclone[2263502]: INFO  : 1G.BIN: vfs cache: removed cache file as file deleted                                                                                    
Nov 18 23:17:22 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/go/pkg/mod/github.com/!mercury!engineering/!cookie!monster@v0.0.0-20180304172713-1584578b3403/.gitignore: permission denied            
Nov 18 23:17:22 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/go/pkg/mod/github.com/!mercury!engineering/!cookie!monster@v0.0.0-20180304172713-1584578b3403/.travis.yml: permission denied           
Nov 18 23:17:22 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/go/pkg/mod/github.com/!mercury!engineering/!cookie!monster@v0.0.0-20180304172713-1584578b3403/LICENSE: permission denied    
Nov 18 23:17:22 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/go/pkg/mod/github.com/!mercury!engineering/!cookie!monster@v0.0.0-20180304172713-1584578b3403/README.md: permission denied
Nov 18 23:17:22 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/go/pkg/mod/github.com/!mercury!engineering/!cookie!monster@v0.0.0-20180304172713-1584578b3403/cookiemonster.go: permission denied      
Nov 18 23:17:22 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/go/pkg/mod/github.com/!mercury!engineering/!cookie!monster@v0.0.0-20180304172713-1584578b3403/cookiemonster_test.go: permission denied 
Nov 18 23:17:22 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/go/pkg/mod/github.com/!mercury!engineering/!cookie!monster@v0.0.0-20180304172713-1584578b3403/testcookies.txt: permission denied      
Nov 18 23:17:22 archlinux rclone[2263502]: ERROR : IO error: remove /home/niki/go/pkg/mod/github.com/!puerkito!bio/goquery@v1.8.0/.gitattributes: permission denied                                            

The ERROR messages in the rclone log come from rclone trying to delete folders in my home directory but lacking permissions

hello and welcome to the forum,

can you post the rclone debug log, including the top lines and the exact rclone mount command?
and the systemd service file?

Well, rclone wiped the whole home dir, that includes the systemd files. I believe all necessary information is in my OP. Not looking for a solution, too late, just reporting the issue.

What’s the actual mount command? I can’t follow what you mounted or how.

It looks like you mounted your home directory to a mount point, ran rm -rf on the mount point and deleted it.

At that point from what I call, it did exactly what you asked it to so not an issue from what I can see from that log file as it seems to be a bizarre set of circumstances.

If you mounted it somewhere in the path, you get an error saying you can't overlap.

felix@gemini:~$ rclone mount /home/felix /home/felix/test
2022/11/18 19:58:09 Fatal error: mount point "/home/felix/test" and directory to be mounted "/home/felix" mustn't overlap

So I'm not quite what you did without seeing a service file or the full mount command.

I tried repeating that and that doesn't delete anything but the mountpoint as I'd expect. Output below.

felix@gemini:~$ rclone mount /home/felix/test2 /home/felix/test -vv
2022/11/18 20:00:57 DEBUG : Setting --config "/opt/rclone/rclone.conf" from environment variable RCLONE_CONFIG="/opt/rclone/rclone.conf"
2022/11/18 20:00:57 DEBUG : rclone: Version "v1.60.1" starting with parameters ["rclone" "mount" "/home/felix/test2" "/home/felix/test" "-vv"]
2022/11/18 20:00:57 DEBUG : Creating backend with remote "/home/felix/test2"
2022/11/18 20:00:57 DEBUG : Using config file from "/opt/rclone/rclone.conf"
2022/11/18 20:00:57 INFO  : Local file system at /home/felix/test2: poll-interval is not supported by this remote
2022/11/18 20:00:57 DEBUG : Local file system at /home/felix/test2: Mounting on "/home/felix/test"
2022/11/18 20:00:57 DEBUG : : Root:
2022/11/18 20:00:57 DEBUG : : >Root: node=/, err=<nil>
2022/11/18 20:01:09 DEBUG : /: Attr:
2022/11/18 20:01:09 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/11/18 20:01:25 DEBUG : /: Attr:
2022/11/18 20:01:25 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
^C2022/11/18 20:01:33 INFO  : Signal received: interrupt
2022/11/18 20:01:33 ERROR : /home/felix/test: Unmounted rclone mount
2022/11/18 20:01:33 INFO  : Exiting...

and I do

felix@gemini:~$ rm -rf test2
felix@gemini:~$ cd test2
-bash: cd: test2: No such file or directory

After searching through terminal log that I still had cached in tmux, it seems I did mount home, not a folder in home.

Thank you for trying to reproduce it! I think this can be closed.

Very sorry about causing a fuzz with this "suspected bug". I was 100% certain.

This is what I had typed up just now before I found the mistake:

Idea was to:

  • mount /home/niki/folder_raw to /home/niki/mountpoint
  • add cache-dir /tmp/cache (to have cache in RAM)
  • rm -r /home/niki/mountpoint (without umount first)

I also had a very short writeback interval for full caching as well, I think 5s (seconds)

Basically I wanted to mount a local folder to another local mountpoint (both have the same parent dir) and add a cache to it to measure performance improvement of such a "cached" local folder. Performance did not improve, so I deleted /home/niki/mountpoint without umounting first.

Did you find what you mounted it to? That's the bit I was trying to figure out.

Every person has pretty much deleted or done something over the course of time to delete something unexpectedly.

I've done a rm -rf * a few times in the wrong spot and nuked things I didn't mean to. Just happens unfortunately.

I was trying to see if some pattern or some loop though as we've put in checks for the circular mounts and I wasn't sure if you used allow-empty either as that causes problems.

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