r/openSUSE•
flyos

Ghost snapshot corrupting snapper

Solved

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

310
MasterPatrickoMember: KDE Dev•

Can you list exactly what's in your /.snapshots folder, and what subvolumes remain according to btrfs (btrfs subvolume list /)?

Sounds like when cleaning up a reference somewhere broke.

1
flyosOPUser (KDE)•

Sure, here you go :

> ls /.snapshots/
754/  grub-snapshot.cfg

> btrfs subvolume list /
ID 256 gen 199727 top level 5 path @
ID 258 gen 325439 top level 256 path @/var
ID 259 gen 324073 top level 256 path @/usr/local
ID 260 gen 325439 top level 256 path @/tmp
ID 261 gen 324314 top level 256 path @/srv
ID 262 gen 325439 top level 256 path @/root
ID 263 gen 325020 top level 256 path @/opt
ID 264 gen 273528 top level 256 path @/boot/grub2/x86_64-efi
ID 265 gen 199727 top level 256 path @/boot/grub2/i386-pc
ID 266 gen 325439 top level 256 path @/.snapshots
ID 1581 gen 325434 top level 266 path @/.snapshots/754/snapshot

I don't see anything weird here, do you?

Thanks for your time!

1
MasterPatrickoMember: KDE Dev•

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.

1
flyosOPUser (KDE)•

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:

> btrfs subvolume show /
@/.snapshots/754/snapshot
        Name:                   snapshot
        UUID:                   99f20d00-6c50-8b40-8066-82ab2fa1234f
        Parent UUID:            bae2ebeb-522e-5c40-b493-00d984632a96
        Received UUID:          -
        Creation time:          2020-06-21 09:20:25 +0200
        Subvolume ID:           1581
        Generation:             325642
        Gen at creation:        212359
        Parent ID:              266
        Top level ID:           266
        Flags:                  -
        Snapshot(s):
        Quota group:            0/1581
          Limit referenced:     -
          Limit exclusive:      -
          Usage referenced:     15.45GiB
          Usage exclusive:      15.45GiB

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 266 before 754 snapshot in btrfs subvolume list / that worries you? Should it be top level 265?

1
MasterPatrickoMember: KDE Dev•

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 /.snapshots really mounted?

1