Skip to content

Conversation

@zfogg
Copy link
Contributor

@zfogg zfogg commented Dec 4, 2025

Summary

When a btrfs subvolume is deleted, its associated qgroup is often automatically destroyed by btrfs. Timeshift would then attempt to explicitly destroy the qgroup and fail with an error message like:

E: Failed to destroy qgroup: '0/276'

This happened because btrfs auto-destroys qgroups when their associated subvolumes are deleted. The previous fix in #458 made this non-fatal by returning true instead of false, but the error message was still printed, causing confusion.

Fix

This change checks if the qgroup still exists (using btrfs qgroup show) before attempting to destroy it:

  • If the qgroup is already gone (auto-destroyed with the subvolume), we log a debug message and skip the destroy
  • If the qgroup still exists, we attempt to destroy it
  • If destruction fails (race condition), we log a debug message instead of an error

Testing

Tested on Manjaro Linux with btrfs quotas enabled:

  • Before: E: Failed to destroy qgroup: '0/XXX' printed on every snapshot deletion
  • After: No error message, clean output

Related Issues

When a btrfs subvolume is deleted, its associated qgroup is often
automatically destroyed by btrfs. Timeshift would then attempt to
explicitly destroy the qgroup and fail with an error message, even
though the operation was successful.

This change checks if the qgroup still exists before attempting to
destroy it, eliminating the spurious error message. If the qgroup
is already gone (auto-destroyed with the subvolume), we log a debug
message instead. If the qgroup still exists, we attempt to destroy
it and handle any race condition gracefully.

Fixes the "Failed to destroy qgroup" error that occurs during
snapshot deletion when quotas are enabled.

Related: linuxmint#354, linuxmint#437
@mtwebster mtwebster merged commit 00ce451 into linuxmint:master Dec 4, 2025
2 checks passed
@zfogg zfogg deleted the fix-qgroup-already-destroyed branch December 5, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants