teejee2008 / timeshift

System restore tool for Linux. Creates filesystem snapshots using rsync+hardlinks, or BTRFS snapshots. Supports scheduled snapshots, multiple backup levels, and exclude filters. Snapshots can be restored while system is running or from Live CD/USB.
GNU Lesser General Public License v3.0
4.68k stars 281 forks source link

Timeshift hangs when backup partition is read-only #309

Open catthou opened 6 years ago

catthou commented 6 years ago

It appears that at some point during timeshifts automated run, the partition my data is backed up to is remounted as read-only. So Timeshift runs rsync followed by an attempt to rm the oldest daily backup, neither of which succeed as the partition can't be changed. One of my cpu cores remains maxed out during this failed rm command. I've experienced this twice and have now completely disabled automated backups.

I'm unsure of the protocol for cleanly exiting Timeshift so I can remount the drive. I manually killed it both times it's done this and now I've disabled automated backups, is this going to cause issues if I try to create another backup?

Steps to reproduce the behavior:

  1. Enable a second partition to be mounted on startup via fstab.
  2. Enable Timeshift automatic daily backups to that partition.
  3. Allow Timeshift to create its initial backup.
  4. Timeshift will remount that partition as read-only during normal operation
  5. Upon Timeshift running its next automated backup, it will hang indefinitely with high CPU.

Expected; Timeshift should not attempt to re-mount any drive if it's already mounted in rw. If Timeshift detects an ro mount option, it should error out at that point and never attempt to do any sort of work.

Screenshot of HTop Report of running Timeshift Processes

$sudo ps aux | grep timeshift
root      1270 98.2  1.1 699456 187704 ?       Ssl  Sep16 638:24 timeshift --check --scripted
root      2259  0.0  0.0  12884   800 ?        S    Sep16   0:00 /bin/bash /tmp/timeshift/notHcqLy/2018-16-09_16-11-28/script.sh
root      2261  0.0  0.0   7716  3836 ?        S    Sep16   0:23 rm -rfv /media/LinuxDATA/timeshift/snapshots/2018-09-13_16-00-01/

Pastebin of /var/log/timeshift/2018-09-17_05-00-01_backup.log - the second run, in which I watched it put my partition into read-only mode. You can see rsync "idles' for 9 minutes before failing and then rm proceeds to hang and the logfile is no longer written to.

System: Linux Mint 19 Cinnamon Desktop Environment Timeshift 18.6+tara

teejee2008 commented 6 years ago

Timeshift will try to mount the device with default options if it is not already mounted. Do you have the "ro" option specified in /etc/fstab for that device?

catthou commented 6 years ago

It would appear to be complete chance, that a sector has gone bad sometime between when timeshift wrote to it a few days ago and when it's tried to read it now. I believe this is what's caused the drive to be remounted read-only (at least, from what I can discern from the "coincidental" kern.log messages of read errors vs when timeshift is running). I've been working on fixing this and will update further when I have timeshift ready and running again.

However, there is still the issue that when this happens, timeshift hangs. Is there no way to set a time limits on the rsync or rm commands ran at which point they should maybe try to error out?