Skip to contentSkip to conversation

cannot read default subvolume id?

DISCUSSION Ulli Horlacher 2 participants 4 messages Jul 27, 2025 – Jul 28, 2025 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Why is there a "cannot read default subvolume id"?

tux@quak:~: btrfs sub create xx
Create subvolume './xx'

tux@quak:~: btrfs sub del xx
WARNING: cannot read default subvolume id: Operation not permitted Delete subvolume 292 (no-commit): '/home/tux/xx'

tux@quak:~: df -H .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/nvme0n1p5_crypt 2,0T 64G 1,9T 4% /home

tux@quak:~: mount | grep /home
/dev/mapper/nvme0n1p5_crypt on /home type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,user_subvol_rm_allowed,subvolid=257,subvol=/@home)

tux@quak:~: btrfs version
btrfs-progs v6.6.3

tux@quak:~: uname -a
Linux quak 6.14.0-24-generic #24~24.04.3-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 7 16:39:17 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Signature · 6 lines
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart         E-Mail: [email protected]
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    https://www.tik.uni-stuttgart.de/
REF:<[email protected]>
#1 lore raw
Quoted 8 lines · Ulli Horlacher

Why is there a "cannot read default subvolume id"?

tux@quak:~: btrfs sub create xx
Create subvolume './xx'

tux@quak:~: btrfs sub del xx
WARNING: cannot read default subvolume id: Operation not permitted

It's a warning, not an error. And you can see on the next line, the deletion happened without any problem.

You're running as a non-root user, meanwhile default subvolume id search is done using tree search ioctl, which require root privilege.

Thanks,
Qu

Quoted 15 lines

Delete subvolume 292 (no-commit): '/home/tux/xx'

tux@quak:~: df -H .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/nvme0n1p5_crypt 2,0T 64G 1,9T 4% /home

tux@quak:~: mount | grep /home
/dev/mapper/nvme0n1p5_crypt on /home type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,user_subvol_rm_allowed,subvolid=257,subvol=/@home)

tux@quak:~: btrfs version
btrfs-progs v6.6.3

tux@quak:~: uname -a
Linux quak 6.14.0-24-generic #24~24.04.3-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 7 16:39:17 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

#2 lore raw
Quoted 7 lines · Qu Wenruo

圚 2025/7/28 03:16, Ulli Horlacher 写é":

Quoted 3 lines

Why is there a "cannot read default subvolume id"?

Quoted 8 lines
Quoted 5 lines

tux@quak:~: btrfs sub create xx
Create subvolume './xx'

tux@quak:~: btrfs sub del xx
WARNING: cannot read default subvolume id: Operation not permitted

It's a warning, not an error. And you can see on the next line, the deletion happened without any problem.

But this warning confuses a user:
Is there a problem?
What is going wrong?
Have I made a mistake?

Quoted 2 lines

You're running as a non-root user, meanwhile default subvolume id search is done using tree search ioctl, which require root privilege.

Why is this subvolume id search necessary for subvolume deletion and why is it just a warning and apparently no problem at all?
If it does not have any consequences, it should not be displayed.

Signature · 6 lines
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart         E-Mail: [email protected]
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    https://www.tik.uni-stuttgart.de/
REF:<[email protected]>
#3 lore raw
Quoted 14 lines · Ulli Horlacher
Quoted 13 lines · Qu Wenruo

圚 2025/7/28 03:16, Ulli Horlacher 写é":

Quoted 8 lines

Why is there a "cannot read default subvolume id"?

tux@quak:~: btrfs sub create xx
Create subvolume './xx'

tux@quak:~: btrfs sub del xx
WARNING: cannot read default subvolume id: Operation not permitted

Quoted 7 lines
Quoted 2 lines

It's a warning, not an error. And you can see on the next line, the deletion happened without any problem.

But this warning confuses a user:
Is there a problem?
What is going wrong?
Have I made a mistake?

Yes, that's indeed confusing, and it should be hidden by commit 0e66228959c4 ("btrfs-progs: subvol delete: hide a warning on an unprivileged delete"), which is included in v5.16.

Unfortunately that fix has a bug that the uid check is completely opposite...

Quoted 8 lines
Quoted 3 lines

You're running as a non-root user, meanwhile default subvolume id search is done using tree search ioctl, which require root privilege.

Why is this subvolume id search necessary for subvolume deletion and why is it just a warning and apparently no problem at all?
If it does not have any consequences, it should not be displayed.

It is an extra check to output a more meaningful error message if the end user is trying to delete the default subvolume.

Thus we need to search if the current subvolume is a default one.

Thanks,
Qu