Bug 1213838

Summary: BTRFS utils not able to list or delete subvolumes of external drives
Product: [openSUSE] openSUSE Aeon Reporter: Stephan Schindel <stephan>
Component: DistroboxAssignee: Richard Brown <rbrown>
Status: RESOLVED INVALID QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Stephan Schindel 2023-08-01 05:50:19 UTC
I have an external drive attached to the OS, it looks like this from the Tumbleweed distrobox:



stephan@tumbleweed:~> mount | grep SEAGATE-5QM2PNLQ
/dev/mapper/luks-699dbae3-5236-4238-b947-03e6dc6dee3e on /run/host/run/media/stephan/SEAGATE-5QM2PNLQ type btrfs (rw,nosuid,nodev,relatime,seclabel,space_cache=v2,subvolid=5,subvol=/)
/dev/mapper/luks-699dbae3-5236-4238-b947-03e6dc6dee3e on /home/stephan/.local/share/containers/storage/overlay/6248c4c74fbbca45d5ba85d2aa118708af9da2ad8cca0ab755f55f877c63042a/merged/run/host/run/media/stephan/SEAGATE-5QM2PNLQ type btrfs (rw,nosuid,nodev,relatime,seclabel,space_cache=v2,subvolid=5,subvol=/)
/dev/mapper/luks-699dbae3-5236-4238-b947-03e6dc6dee3e on /run/media/stephan/SEAGATE-5QM2PNLQ type btrfs (rw,nosuid,nodev,relatime,seclabel,space_cache=v2,subvolid=5,subvol=/)




I can access all files and folders from withing the distrobox. Creating BTRFS subvolumes work fine, however listing and deleting does not work (no permissions):

stephan@tumbleweed:~> sudo btrfs subvol list /run/media/stephan/SEAGATE-5QM2PNLQ/
ERROR: cannot access '/run/media/stephan/SEAGATE-5QM2PNLQ/': Permission denied
ERROR: can't access '/run/media/stephan/SEAGATE-5QM2PNLQ/'
Comment 1 Richard Brown 2023-08-01 08:19:17 UTC
This isn't a bug, but actually a feature

Your default distrobox runs as your user

Your external drive is connected on your host

Sudo in your distrobox doesn't give you root on your host

So in order to get the behaviour you want, either you need to run distrobox --root or run the btrfs tools from the host, not inside a distrobox