Bug 1952764 - btrfs compression isn't set if the user renames a mountpoint's subvolume
Summary: btrfs compression isn't set if the user renames a mountpoint's subvolume
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: python-blivet
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Vojtech Trefny
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: https://ask.fedoraproject.org/t/we-ar...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-23 04:40 UTC by Chris Murphy
Modified: 2024-05-15 17:50 UTC (History)
20 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
fstab (45 bytes, text/plain)
2021-04-23 04:40 UTC, Chris Murphy
no flags Details
anaconda.log (63.78 KB, text/plain)
2021-04-23 04:42 UTC, Chris Murphy
no flags Details
program.log (16.07 KB, text/plain)
2021-04-23 04:42 UTC, Chris Murphy
no flags Details
storage.log (983.49 KB, text/plain)
2021-04-23 04:43 UTC, Chris Murphy
no flags Details
anaconda-ks.cfg (1.02 KB, text/plain)
2021-04-23 04:45 UTC, Chris Murphy
no flags Details
anaconda.log (35.52 KB, text/plain)
2021-04-23 18:10 UTC, Chris Murphy
no flags Details
anaconda-ks.cfg (1.07 KB, text/plain)
2021-04-23 18:10 UTC, Chris Murphy
no flags Details
fstab (1.03 KB, text/plain)
2021-04-23 18:10 UTC, Chris Murphy
no flags Details
program.log (15.65 KB, text/plain)
2021-04-23 18:11 UTC, Chris Murphy
no flags Details
storage.log (525.04 KB, text/plain)
2021-04-23 18:11 UTC, Chris Murphy
no flags Details

Description Chris Murphy 2021-04-23 04:40:42 UTC
Created attachment 1774668 [details]
fstab

Created attachment 1774668 [details]
fstab

Description of problem:

If the user changes the name of a subvolume in the Custom/Manual partitioning UI, its line in /etc/fstab lacks 'compress=zstd:1' mount option. This is benign, affecting only fstab entries, except in the case of '/' mount point. If the '/' mountpoint's subvolume is renamed, the entire installation lacks compression, and so will /etc/fstab meaning it's not set on reboot following installation.

Version-Release number of selected component (if applicable):
anaconda-34.24.9-1.fc34.x86_64
python3-blivet-3.3.3-2.fc34.noarch


How reproducible:
Always


Steps to Reproduce:
1. Use Custom UI
2. Use Btrfs partition scheme
3. Click blue text "click here to create them automatically"
4. Click on the '/' mount point, and on the right side change the name from "root" to "root34"

Actual results:

Compress mount option is not used for the installation and does not appear in the /etc/fstab file after installation.

Expected results:

Compression should be enabled for the installation and the /etc/fstab file.


Additional info:


Uncertain to what degree this affects Advanced-Custom UI.

Comment 1 Chris Murphy 2021-04-23 04:42:26 UTC
Created attachment 1774669 [details]
anaconda.log

Comment 2 Chris Murphy 2021-04-23 04:42:56 UTC
Created attachment 1774670 [details]
program.log

Comment 3 Chris Murphy 2021-04-23 04:43:22 UTC
Created attachment 1774671 [details]
storage.log

Comment 4 Chris Murphy 2021-04-23 04:45:41 UTC
Created attachment 1774672 [details]
anaconda-ks.cfg

Comment 5 Chris Murphy 2021-04-23 18:10:17 UTC
Created attachment 1774894 [details]
anaconda.log

Comment 6 Chris Murphy 2021-04-23 18:10:39 UTC
Created attachment 1774895 [details]
anaconda-ks.cfg

Comment 7 Chris Murphy 2021-04-23 18:10:54 UTC
Created attachment 1774896 [details]
fstab

Comment 8 Chris Murphy 2021-04-23 18:11:11 UTC
Created attachment 1774897 [details]
program.log

Comment 9 Chris Murphy 2021-04-23 18:11:27 UTC
Created attachment 1774898 [details]
storage.log

Comment 10 Chris Murphy 2021-04-23 18:24:38 UTC
$ grep compress bug1952764-storage.log 
INFO:program:Running... mount -t btrfs -o subvol=home,compress=zstd:1 /dev/vda3 /mnt/sysimage/home
INFO:program:Running... mount -t btrfs -o subvol=var_lib_libvirt_images,compress=zstd:1 /dev/vda3 /mnt/sysimage/var/lib/libvirt/images
INFO:program:Running... mount -t btrfs -o subvol=var_log,compress=zstd:1 /dev/vda3 /mnt/sysimage/var/log
INFO:program:Running... mount -t btrfs -o subvol=var_swap,compress=zstd:1 /dev/vda3 /mnt/sysimage/var/swap

For some reason, when the subvolume has been renamed, compress=zstd:1 isn't included in the mount option.

$ grep subvol=root bug1952764-storage.log 
INFO:program:Running... mount -t btrfs -o subvol=root34 /dev/vda3 /mnt/sysimage

Comment 11 Chris Murphy 2021-04-23 19:54:40 UTC
DRAFT CommonBugs write up:

If the user changes the name of a subvolume in the Custom/Manual partitioning UI, its line in /etc/fstab lacks 'compress=zstd:1' mount option. This is benign, affecting only fstab entries, except in the case of '/' mount point. If the '/' mountpoint's subvolume is renamed, the entire installation lacks compression. Btrfs compression is a system wide mount option, and the '/' fstab entry effective acts as: 'mount -o remount,rw ...' and any other fstab options that have been set.

If you need to change the '/' subvolume name, e.g. "@root" there are a couple of work arounds for the bug:

Workaround A: make the name change in the installer, and then fix /etc/fstab post-install

Step 1: Modify the Name field for '/' mount point, per user preference.
Step 2 (optional): Immediately after beginning the installation, switch to a shell and enter: sudo mount -o remount,compress=zstd:1 /mnt/sysimage'. If you get an error, you were too fast, the installer hasn't yet mounted the Btrfs file system to '/mnt/sysimage' - simply reissue the command until it returns without error. You can confirm it's enabled by 'mount | grep btrfs'.
Step 3: Modify /etc/fstab post-install, either before or after rebooting from the install environment.

Workaround B: make the subvolume name change post-install

Step 1: Proceed with installation normally, do not modify the subvolume name for '/'.
Step 2: Post-install change the name of the '/' subvolume found in the top-level of the file system, and update /etc/fstab to indicate the subvol=$NAME as appropriate.
NOTE: It is safe to rename actively mounted subvolumes.

Comment 12 Vendula Poncova 2021-04-26 11:02:18 UTC
From storage.log:

DEBUG:anaconda.modules.storage.partitioning.interactive.change_device:Change device: DeviceFactoryRequest(container_encrypted=False, container_name='fedora_localhost-live', container_raid_level='single', container_size_policy=0, container_spec='fedora_localhost-live', device_encrypted=False, device_name='root34', device_raid_level='', device_size=105669197824, device_spec='root', device_type=3, disks=['vda'], format_type='btrfs', label='', luks_version='', mount_point='/', reformat=True)
DEBUG:anaconda.modules.storage.partitioning.interactive.change_device:Replacing a nonexistent device.
DEBUG:anaconda.modules.storage.partitioning.interactive.change_device:Creating a new device.
DEBUG:anaconda.modules.storage.partitioning.interactive.utils:Generated factory arguments: {
device_type = 3,
device = BTRFSSubVolumeDevice instance (0x7fbdd444b100) --
  name = root  status = False  id = 141
  children = []
  parents = ['non-existent 98.41 GiB btrfs volume fedora_localhost-live (131) with '
 'non-existent btrfs filesystem']
  uuid = None  size = 98.41 GiB
  format = non-existent btrfs filesystem mounted at /
  major = 0  minor = 0  exists = False  protected = False
  sysfs path = 
  target size = 0 B  path = /dev/vda3
  format args = []  original_format = None,
disks = [DiskDevice instance (0x7fbdd4578df0) --
  name = vda  status = True  id = 4
  children = ['non-existent 600 MiB partition vda1 (118) with non-existent efi filesystem '
 'mounted at /boot/efi',
 'non-existent 1024 MiB partition vda2 (125) with non-existent ext4 filesystem '
 'mounted at /boot',
 'non-existent 98.41 GiB partition vda3 (111) with non-existent btrfs '
 'filesystem']
  parents = []
  uuid = None  size = 100 GiB
  format = non-existent gpt disklabel
  major = 252  minor = 0  exists = True  protected = False
  sysfs path = /sys/devices/pci0000:00/0000:00:02.3/0000:04:00.0/virtio2/block/vda
  target size = 100 GiB  path = /dev/vda
  format args = []  original_format = None  removable = False  wwn = None],
mountpoint = '/',
fstype = 'btrfs',
label = None,
luks_version = None,
device_name = 'root34',
size = Size (98.412109375 GiB),
raid_level = None,
encrypted = False,
container_name = 'fedora_localhost-live',
container_size = 0,
container_raid_level = <blivet.devicelibs.raid.Single object at 0x7fbdd6a20fd0>,
container_encrypted = False
}
DEBUG:blivet:              InstallerStorage.factory_device: 3, ...

Anaconda is using the Blivet's device factory to rename the device. Reassigning to Blivet.

Comment 13 Neal Gompa 2021-04-26 13:52:38 UTC
This is probably something for Michel to look at, as he introduced this functionality.

Michel, what do you think of this?

Comment 14 Adam Williamson 2021-04-26 21:36:35 UTC
Thanks for the commonbugs draft, Chris, I used it with minor alterations.

Comment 15 Fedora Blocker Bugs Application 2021-10-05 16:02:55 UTC
Proposed as a Freeze Exception for 35-final by Fedora user chrismurphy using the blocker tracking app because:

 There isn't yet a testable fix for this, so we can't evaluate the risk yet. But since this can't be fixed on installation media with an update, and since compression is a headline feature, it'd be nice to get a freeze exception. It does only affect custom/manual installations - but that's also what's required to do a clean install and also preserve an existing "/home".

Comment 16 Chris Murphy 2021-10-05 17:29:24 UTC
Clearing the FE request, as it turns out there's no bandwidth to fix this in any plausible f35 final release time frame.

Comment 17 Chris Murphy 2021-10-05 17:30:50 UTC
Common bugs applies to both F34 and F35 too.

Comment 18 Ben Cotton 2022-08-09 13:11:46 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 19 Fedora Admin user for bugzilla script actions 2023-04-26 00:29:54 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 20 Fedora Admin user for bugzilla script actions 2023-04-26 12:05:52 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 21 Michel Lind 2023-08-22 20:27:55 UTC
Somehow I missed this bug. Happy to revisit once I have bandwith, but looking at my commit, looks like what's happening is the codepath adding the default compression setting (lines 506-508) does not get run in the codepath where the subvolume is renamed

https://github.com/storaged-project/blivet/commit/724855ff0c30eacab3448f66c6076151ed565e89

Comment 22 kapsh 2024-05-15 17:50:57 UTC
F40 installer is still affected by that.

Pressing "Create required partitions" and renaming "root" to "top" in Custom wizard results in the following fstab:

UUID=x /                       btrfs   subvol=top      0 0
UUID=y          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=x /home                   btrfs   subvol=home,compress=zstd:1 0 0
UUID=x /var/lib/flatpak        btrfs   subvol=flatpak  0 0
UUID=x /var/log                btrfs   subvol=logs     0 0

Root is uncompressed (confirmed with compsize), home compressed as it should by default, logs and flatpak (both added from the same screen manually) are not.


Note You need to log in before you can comment on or make changes to this bug.