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.7k stars 282 forks source link

Timeshift messes up snapshot restores #416

Open g0r3 opened 5 years ago

g0r3 commented 5 years ago

Hi,

since about a year I am using Arch Linux on BTRFS, mainly because of this neat snapshot functionality. To easily manage it I decided to go with timeshift. Since I still occationally try out break stuff, so currently I am working on my third Arch installation. While everything (regarding timeshift) worked perfectly on the first installation, I encountered this snapshot restore problem on my second and third installation of Arch Linux. Which is: Every time when I restore a snapshot, my PC won't boot anymore and I have to manually fiddle around in /etc/fstab, removing the subvolume ID of the /home entry. At least that is the only way I've found to get it working again, of course denying me the snapshot funcitonality for /home.

My disk setup looks like this:

sda      8:0    0 953.9G  0 disk 
├─sda1   8:1    0   512M  0 part 
├─sda2   8:2    0    16G  0 part [SWAP]
└─sda3   8:3    0 937.4G  0 part /home

Where /dev/sda3 contains a btrfs filesystem with a @ and @home subvolume

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda3 LABEL=ARCH
UUID=37843247-9973-483b-b3ee-62a111f3a527   /           btrfs       rw,nodev,relatime,ssd,discard,space_cache,autodefrag,subvolid=257,subvol=/@,subvol=@    0 0

# /dev/sda3 LABEL=ARCH
UUID=37843247-9973-483b-b3ee-62a111f3a527   /home       btrfs       rw,nodev,relatime,ssd,discard,space_cache,autodefrag,subvol=/@home  0 0

# network shares:
nas.lan:/export/files               /srv/files  nfs         defaults,soft,noatime,nofail,rw
nas.lan:/export/backup              /srv/backup nfs         defaults,soft,noatime,nofail,rw

The /home mountpoint had an additional "subvolid=257" as option which I had to remove in order to get it booting again.

If you need additional information, I am happy to provide it.

Describe the bug Systemd fails to mount /home after restoring snapshot

To Reproduce Steps to reproduce the behavior:

Apr 20 11:10:44 desktop systemd[1]: Mounting /home...
Apr 20 11:10:44 desktop kernel: audit: type=1130 audit(1555751444.967:5): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=lvm2-monitor comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=?>
Apr 20 11:10:44 desktop mount[514]: mount: /home: wrong fs type, bad option, bad superblock on /dev/sda3, missing codepage or helper program, or other error.
Apr 20 11:10:44 desktop systemd[1]: home.mount: Mount process exited, code=exited, status=32/n/a
Apr 20 11:10:44 desktop systemd[1]: home.mount: Failed with result 'exit-code'.
Apr 20 11:10:44 desktop systemd[1]: Failed to mount /home.
Apr 20 11:10:44 desktop systemd[1]: Dependency failed for Local File Systems.
Apr 20 11:10:44 desktop systemd[1]: local-fs.target: Job local-fs.target/start failed with result 'dependency'.

Expected behavior

System:

                   -`                    xxx@desktop 
                  .o+`                   ---------------- 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: All Series 
               `+oooooo:                 Kernel: 5.0.7-arch1-1-ARCH 
               -+oooooo+:                Uptime: 11 mins 
             `/:-:++oooo+:               Packages: 1271 (pacman) 
            `/++++/+++++++:              Shell: zsh 5.7.1 
           `/++++++++++++++:             Resolution: 2560x1440 
          `/+++ooooooooooooo/`           DE: Budgie 
         ./ooosssso++osssssso+`          WM: Mutter(Budgie) 
        .oossssso-````/ossssss+`         Theme: X-Arc-White [GTK2/3] 
       -osssssso.      :ssssssso.        Icons: Paper [GTK2/3] 
      :osssssss/        osssso+++.       Terminal: tilix 
     /ossssssss/        +ssssooo/-       CPU: Intel i7-4770K (8) @ 4.000GHz 
   `/ossssso+/:-        -:/+osssso+-     GPU: NVIDIA GeForce GTX 1070 
  `+sso+:-`                 `.-/+oso:    Memory: 1714MiB / 15982MiB 
 `++:.                           `-/+/
 .`                                 `/                           
teejee2008 commented 5 years ago

Your fstab entry is incorrect for / and /home. subvol and subvolid should not be used together. subvol should not be repeated.

Keep subvol=@ for / and subvol=@home for /home entry

g0r3 commented 5 years ago

It seems to have fixed the issue, but I will try it out a couple of times more. Thank you!

The mount points looked fishy to me but that is the way, genfstab wrote them into /etc/fstab, so I assumed, the tool knows what it is doing.

jwatt commented 3 years ago

@g0r3 / @teejee2008 can this be closed now?