delete-older-than destroys inappropriate snapshots

Bug #1322838 reported by Tamas Papp
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apt-btrfs-snapshot (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

$ apt-btrfs-snapshot list
Available snapshots:
@apt-snapshot-2014-05-21_10:28:38
@apt-snapshot-2014-05-21_15:35:10
@apt-snapshot-2014-05-21_22:27:11
@apt-snapshot-2014-05-22_08:03:10
@apt-snapshot-2014-05-22_16:18:19
@apt-snapshot-2014-05-22_20:33:33
@apt-snapshot-2014-05-23_10:53:46
@apt-snapshot-2014-05-23_16:18:06
@apt-snapshot-2014-05-24_09:11:51
@apt-snapshot-2014-05-24_09:12:32
@apt-snapshot-2014-05-24_09:49:25
@apt-snapshot-2014-05-24_12:19:05
@apt-snapshot-2014-05-24_12:19:44
@apt-snapshot-2014-05-24_12:31:31

$ apt-btrfs-snapshot list-older-than 1d
Available snapshots older than '1d':
@apt-snapshot-2014-05-21_10:28:38
@apt-snapshot-2014-05-21_15:35:10
@apt-snapshot-2014-05-21_22:27:11
@apt-snapshot-2014-05-22_08:03:10
@apt-snapshot-2014-05-22_16:18:19
@apt-snapshot-2014-05-22_20:33:33
@apt-snapshot-2014-05-23_10:53:46
@apt-snapshot-2014-05-23_16:18:06
@apt-snapshot-2014-05-24_09:11:51
@apt-snapshot-2014-05-24_09:12:32
@apt-snapshot-2014-05-24_09:49:25

$ date
Sat May 24 13:39:46 CEST 2014

The same is true for the 'delete-older-than' switch.

ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: apt-btrfs-snapshot 0.3.4.2
ProcVersionSignature: Ubuntu 3.15.0-2.6-generic 3.15.0-rc6
Uname: Linux 3.15.0-2-generic x86_64
ApportVersion: 2.14.2-0ubuntu4
Architecture: amd64
Date: Sat May 24 13:34:24 2014
InstallationDate: Installed on 2013-03-23 (426 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Alpha amd64 (20130321)
PackageArchitecture: all
SourcePackage: apt-btrfs-snapshot
UpgradeStatus: Upgraded to utopic on 2013-05-03 (385 days ago)

Revision history for this message
Tamas Papp (tomposmiko) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in apt-btrfs-snapshot (Ubuntu):
status: New → Confirmed
Revision history for this message
Tamas Papp (tomposmiko) wrote :

It has actually been fixed for a while.
At least in recent releases.

# apt-btrfs-snapshot delete-older-than 1d
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-7e2mente/@apt-snapshot-2020-09-18_13:29:22'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-sy5zjd_t/@apt-snapshot-2020-09-18_14:27:05'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-6dsfzf10/@apt-snapshot-2020-09-18_14:27:29'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-qprhlmpv/@apt-snapshot-2020-09-18_14:28:43'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-pckyk9vw/@apt-snapshot-2020-09-18_14:31:07'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-7pej0agf/@apt-snapshot-2020-09-18_14:31:15'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-6busdmsx/@apt-snapshot-2020-09-18_22:06:09'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-4ar23moh/@apt-snapshot-2020-09-21_11:11:38'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-4rd9a6o6/@apt-snapshot-2020-09-22_06:42:01'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-m5xcx94q/@apt-snapshot-2020-09-22_22:44:18'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-ku1q9ctc/@apt-snapshot-2020-09-23_05:36:05'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-dkz8pavo/@apt-snapshot-2020-09-23_05:43:45'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-h_won84w/@apt-snapshot-2020-09-23_06:36:15'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-pl4hszo_/@apt-snapshot-2020-09-23_22:24:57'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-moy4y1l9/@apt-snapshot-2020-09-24_07:08:36'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-jvfkp6ae/@apt-snapshot-2020-09-24_10:38:54'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-oidw2g05/@apt-snapshot-2020-09-24_10:41:14'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-qtw5duet/@apt-snapshot-2020-09-24_17:55:35'

# date
Fri Sep 25 02:38:12 PM CEST 2020

# apt-btrfs-snapshot list
Available snapshots:
@apt-snapshot-2020-09-24_23:50:56
@apt-snapshot-2020-09-25_00:29:27
@apt-snapshot-2020-09-25_14:26:05

Revision history for this message
Ansgar Bohmann (ansgar-bohmann) wrote :

I experience the same problems with the list-older-than and delete-older-than commands.

Since delete-older-than is also called from /etc/cron.weekly/apt-btrfs-snapshot (also belonging to the same package), this cron-job just doesn't do what it should. Potentially, the all the available space fills up with old snapshots never being deleted. At the same time . That's quite an implication.

(Simply turning around the < line 205 in /usr/lib/python3/dist-packages/apt_btrfs_snapshot.py is not the solution. In that case, the command list always returns an empty list. Another side note: the docstrings in the source code use the incorrect spelling „then“ instead of „than“.)

Revision history for this message
Ansgar Bohmann (ansgar-bohmann) wrote :

Thanks Tamas! Sorry, I missed you reply #3 earlier. I'm using apt-btrfs-snapshot version 3.5.3 (according to apt show) on Focal (Ubuntu 20.04) and still experiencing these problems. Which version do you use?

Revision history for this message
Tamas Papp (tomposmiko) wrote :

ii apt-btrfs-snapshot 3.5.4 all Automatically create snapshot on apt operations

It is also Focal, but I'm pretty sure it's OK for a while.

Revision history for this message
Ansgar Bohmann (ansgar-bohmann) wrote :

How did you get 3.5.4 on Focal? But besides that, differences between the two versions are marginal. In particular, the actual Python code ( /usr/lib/python3/dist-packages/apt_btrfs_snapshot.py ) didn't change at all.

I did some further testing. Right now,

# apt-btrfs-snapshot list-older-than 1d

also works on my system. What doesn't work however, is any interval greater than 1d: 2d, 3d, 4d, 30d, 90d, … In all these cases an empty list is returned (at the moment right now).

What makes things even more strange: Scrolling back in same terminal window to what I've tried just a few hours ago, I have clear evidence, that the very same command

# apt-btrfs-snapshot list-older-than 1d

did return only two snapshots, one taken a bit less than 24 h ago, the other slightly older, omitting many other snapshots. I have no clue what caused this change. (No updates or other changes to any installed packages have been made between the two scenarios.)

Revision history for this message
Tamas Papp (tomposmiko) wrote :

> How did you get 3.5.4 on Focal?

Oops, I lied.
It's Groovy.

Revision history for this message
Ansgar Bohmann (ansgar-bohmann) wrote :
Download full text (3.9 KiB)

On my system, there are still issues running:

# apt-btrfs-snapshot list-older-than …d

After I didn't have any explanation for the behaviour I mentioned earlier, I delete all snapshot on my system. Over the past month, more and more new snapshots were created. I checked from time to time and list-older-than did work as expected for more than 30 days.

Two days ago I upgraded to Ubuntu 20.10 (Groovy Gorilla). Here's what I get now:

# apt-btrfs-snapshot list
Available snapshots:
@apt-snapshot-2020-10-05_14:36:46
@apt-snapshot-2020-10-07_00:46:30
@apt-snapshot-2020-10-07_16:13:40
@apt-snapshot-2020-10-12_17:20:46
@apt-snapshot-2020-10-14_01:09:54
@apt-snapshot-2020-10-14_11:57:39
@apt-snapshot-2020-10-14_11:57:40
@apt-snapshot-2020-10-14_15:29:28
@apt-snapshot-2020-10-16_02:02:21
@apt-snapshot-2020-10-16_22:40:26
@apt-snapshot-2020-10-16_22:42:10
@apt-snapshot-2020-10-21_00:39:28
@apt-snapshot-2020-10-21_00:41:01
@apt-snapshot-2020-10-21_00:43:22
@apt-snapshot-2020-10-21_15:18:29
@apt-snapshot-2020-10-21_15:49:19
@apt-snapshot-2020-10-22_16:01:06
@apt-snapshot-2020-10-23_13:06:50
@apt-snapshot-2020-10-26_10:19:15
@apt-snapshot-2020-10-27_14:42:40
@apt-snapshot-2020-10-28_16:38:02
@apt-snapshot-2020-10-28_16:39:36
@apt-snapshot-release-upgrade-groovy-2020-10-29_04:28:47
@apt-snapshot-release-upgrade-groovy-2020-10-29_04:28:50
@apt-snapshot-2020-10-29_04:28:50
@apt-snapshot-2020-10-29_04:28:51
@apt-snapshot-release-upgrade-groovy-2020-10-29_04:30:54
@apt-snapshot-2020-10-29_04:30:55
@apt-snapshot-2020-10-29_04:30:56
@apt-snapshot-2020-10-29_05:17:49
@apt-snapshot-2020-10-29_05:24:34
@apt-snapshot-2020-10-29_13:58:16
@apt-snapshot-2020-10-30_09:16:20
@apt-snapshot-2020-10-30_12:36:16
@apt-snapshot-2020-10-30_23:44:55
@apt-snapshot-2020-10-30_23:45:17

# apt-btrfs-snapshot list-older-than 1d
Available snapshots older than '1d':
@apt-snapshot-2020-10-05_14:36:46
@apt-snapshot-2020-10-07_00:46:30
@apt-snapshot-2020-10-07_16:13:40
@apt-snapshot-2020-10-12_17:20:46
@apt-snapshot-2020-10-14_01:09:54
@apt-snapshot-2020-10-14_11:57:39
@apt-snapshot-2020-10-14_11:57:40
@apt-snapshot-2020-10-14_15:29:28
@apt-snapshot-2020-10-16_02:02:21
@apt-snapshot-2020-10-16_22:40:26
@apt-snapshot-2020-10-16_22:42:10
@apt-snapshot-2020-10-21_00:39:28
@apt-snapshot-2020-10-21_00:41:01
@apt-snapshot-2020-10-21_00:43:22
@apt-snapshot-2020-10-21_15:18:29
@apt-snapshot-2020-10-21_15:49:19
@apt-snapshot-2020-10-22_16:01:06
@apt-snapshot-2020-10-23_13:06:50
@apt-snapshot-2020-10-26_10:19:15
@apt-snapshot-2020-10-27_14:42:40
@apt-snapshot-2020-10-28_16:38:02
@apt-snapshot-2020-10-28_16:39:36
@apt-snapshot-release-upgrade-groovy-2020-10-29_04:28:47
@apt-snapshot-release-upgrade-groovy-2020-10-29_04:28:50
@apt-snapshot-2020-10-29_04:28:50
@apt-snapshot-2020-10-29_04:28:51
@apt-snapshot-release-upgrade-groovy-2020-10-29_04:30:54
@apt-snapshot-2020-10-29_04:30:55
@apt-snapshot-2020-10-29_04:30:56
@apt-snapshot-2020-10-29_05:17:49
@apt-snapshot-2020-10-29_05:24:34
@apt-snapshot-2020-10-29_13:58:16
@apt-snapshot-2020-10-30_09:16:20
@apt-snapshot-202...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.