Ghost snapshot corrupting snapper
I realised this morning that snapper stopped taking snapshot of my system since late November (!).
At first, I thought it was because I had snapshots that didn't registered in snapper, but were still there in /.snapshots and as btrfs subvolume, so I removed those subvolumes directly from btrfs and then in the /.snapshots/ folder.
But, snapper still complains:
> snapper create
Échec de la création de l'instantané.
(French for "failed to create snapshot")
> snapper list
# | Type | Pre # | Date | Utilisateur | Espace utilisé | Nettoyer | Description | Do
-----+--------+-------+-------------------------------+-------------+----------------+----------+-----------------------+---
0 | single | | | root | | | current |
754* | single | | Sun 21 Jun 2020 09:20:25 CEST | root | 15.41 Gio | | writable copy of #726 |
> tail -n 28 /var/log/snapper.log
2021-01-11 12:24:18 MIL libsnapper(10928) snapperd.cc(main):276 - Requesting DBus name
2021-01-11 12:24:18 MIL libsnapper(10928) snapperd.cc(main):280 - Loading snapper configs
2021-01-11 12:24:18 MIL libsnapper(10928) Snapper.cc(getConfigs):273 - Snapper get-configs
2021-01-11 12:24:18 MIL libsnapper(10928) Snapper.cc(getConfigs):274 - libsnapper version 0.8.15
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(reload):115 - loading file /etc/sysconfig/snapper
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(getValue):242 - key:SNAPPER_CONFIGS value:root
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(reload):115 - loading file /etc/snapper/configs/root
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(getValue):242 - key:SUBVOLUME value:/
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(getValue):242 - key:ALLOW_USERS value:
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(getValue):242 - key:ALLOW_GROUPS value:
2021-01-11 12:24:18 MIL libsnapper(10928) snapperd.cc(main):284 - Listening for method calls and signals
2021-01-11 12:24:18 MIL libsnapper(10928) Snapper.cc(Snapper):92 - Snapper constructor
2021-01-11 12:24:18 MIL libsnapper(10928) Snapper.cc(Snapper):93 - libsnapper version 0.8.15
2021-01-11 12:24:18 MIL libsnapper(10928) Snapper.cc(Snapper):94 - config_name:root disable_filters:false
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(reload):115 - loading file /etc/snapper/configs/root
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(getValue):242 - key:SUBVOLUME value:/
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(getValue):242 - key:FSTYPE value:btrfs
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(getValue):242 - key:QGROUP value:1/0
2021-01-11 12:24:18 MIL libsnapper(10928) AsciiFile.cc(getValue):242 - key:SYNC_ACL value:no
2021-01-11 12:24:18 MIL libsnapper(10928) Snapper.cc(Snapper):125 - subvolume:/ filesystem:btrfs
2021-01-11 12:24:18 MIL libsnapper(10928) Snapper.cc(loadIgnorePatterns):178 - number of ignore patterns:8
2021-01-11 12:24:18 MIL libsnapper(10928) Snapshot.cc(read):274 - found 2 snapshots
2021-01-11 12:24:18 WAR libsnapper(10928) FileUtils.cc(SDir):91 - THROW: open failed path://.snapshots/755 errno:2 (No such file or directory)
2021-01-11 12:24:18 ERR libsnapper(10928) Btrfs.cc(createSnapshot):327 - create snapshot failed, ioctl(BTRFS_IOC_SNAP_CREATE_V2) failed, errno:26 (Text file busy)
2021-01-11 12:24:18 WAR libsnapper(10928) Btrfs.cc(createSnapshot):328 - THROW: create snapshot failed
2021-01-11 12:24:18 WAR libsnapper(10928) Snapshot.cc(createHelper):680 - CAUGHT: create snapshot failed
2021-01-11 12:24:18 WAR libsnapper(10928) Snapshot.cc(createHelper):685 - RETHROW: create snapshot failed
2021-01-11 12:24:18 WAR libsnapper(10928) Client.cc(dispatch):1794 - CAUGHT: create snapshot failed
Note these two lines:
2021-01-11 12:24:18 MIL libsnapper(10928) Snapshot.cc(read):274 - found 2 snapshots
2021-01-11 12:24:18 WAR libsnapper(10928) FileUtils.cc(SDir):91 - THROW: open failed path://.snapshots/755 errno:2 (No such file or directory)
Indeed, snapshot 755 doesn't exist (note that it wasn't one of the snapshots I just removed that snapper didn't registered, it's even more of a "ghost" snapshot, so to speak). Intriguing is that it's supposed to be the snapshot right after the existing "master" one (754).
Where does snapper looks for this second non-existing 755 snapshot since it's neither in /.snapshots/, nor a subvolume of the btrfs filesystem (I checked)? How can I make snapper forget about this ghost, and hope it'll work again after that?
Any help appreciated!
Posted Jan 11, 2021, 11:29 AM UTC
Can you list exactly what's in your
/.snapshotsfolder, and what subvolumes remain according to btrfs (btrfs subvolume list /)?Sounds like when cleaning up a reference somewhere broke.
Sure, here you go :
I don't see anything weird here, do you?
Thanks for your time!
Oh, looks like snapper's internal structure is completely messed up by manually deleting subvolumes. You should only use snapper to interact with snapper snapshots, not btrfs.
Your current snapshot (754) should always appear mounted under /.snapshots. I think snapper is trying to make a comparison before making a new snapshot and failing because you deleted the parent read-only copy.
What does
btrfs subvolume show /give you (especially parent id)? Have you rebooted since doing the deleting -- maybe things will remount properly. Or maybe you will just have a broken system, I'm not totally sure.Agreed, and this is what I do normally, of course. I had to use btrfs directly because snapper apparently "missed" to cleanup some snapshots (well, at least, something went wrong, don't know what), they were no longer listed in snapper, but appeared as btrfs subvolumes. I had little choice, especially as they were starting to fill up a huge chunk of "/", I was close to the space limit. I carefully did not touch anything that snapper listed as the "current" snapshot, but it was already broken, so who knows! Anyway...
Here's the result of the command:
Doesn't this mean that 754 is currently mounted and seen as the "current" snapshot?
EDIT: I looked at my other (sane) computer, is it the
top level 266before 754 snapshot inbtrfs subvolume list /that worries you? Should it betop level 265?Yes, it is the current snapshot mounted to /. But it should also appear as /.snapshots/754/ -- I think this is what snapper is struggling with.
What is in your
/etc/fstab? Is/.snapshotsreally mounted?