Trying to change the volume label of a mounted Btrfs or swap partition in the YaST partitioner fails with an error message
Setting label of btrfs on /dev/sda2 (57.50 GiB) to root Unexpected situation found in the system.
The "Details" button shows
Caught signal #127: "/sbin/btrfs filesystem label '/dev/sda2' 'root'
which is scary and confusing and does not give the user any hint what's actually wrong.
In the case of a root Btrfs, it even hangs later because subvolumes cannot be mounted.
Cause
Even though some filesystem types do support changing the volume label while mounted, in our context this has implications with the subvolumes. Handling the subvolumes properly very likely requires a very intrusive code change which involves quite some risk.
Fix
So we chose the less intrusive approach to disable it on the UI level: When we detect that the filesystem or swap space is actively mounted, we are now disabling the "Volume Label" field in the "Fstab Options" dialog.
Screenshots
Partitioner with a mounted Btrfs on /dev/sdb1
Editing /dev/sdb1
"Volume Label" field disabled because the filesystem is mounted, so changing it would fail.
After unmounting, saving the changes and entering the partitioner again, the volume label can now be changed.
Test
Extensive manual tests in a VM with a second virtual disk where partitions can be easily added and changed.
coverage: 97.752% (-0.003%) from 97.755% when pulling ae07279b8daded2f2a3580ba9653f23ed37c4f38 on huha-vol-label-sp4 into 1e609c107a158d4cc4c73361aaad4f3f4182352b on master.
Target Branch
This is for SLE-15-SP4. See below for the merge PRs to SLE-15-SP5 and master / Factory.
Bugzilla
L3: https://bugzilla.suse.com/show_bug.cgi?id=1211337
Trello
https://trello.com/c/JvuZVVU3
Problem
Trying to change the volume label of a mounted Btrfs or swap partition in the YaST partitioner fails with an error message
Setting label of btrfs on /dev/sda2 (57.50 GiB) to root Unexpected situation found in the system.
The "Details" button shows
Caught signal #127: "/sbin/btrfs filesystem label '/dev/sda2' 'root'
which is scary and confusing and does not give the user any hint what's actually wrong.
In the case of a root Btrfs, it even hangs later because subvolumes cannot be mounted.
Cause
Even though some filesystem types do support changing the volume label while mounted, in our context this has implications with the subvolumes. Handling the subvolumes properly very likely requires a very intrusive code change which involves quite some risk.
Fix
So we chose the less intrusive approach to disable it on the UI level: When we detect that the filesystem or swap space is actively mounted, we are now disabling the "Volume Label" field in the "Fstab Options" dialog.
Screenshots
Partitioner with a mounted Btrfs on /dev/sdb1
Editing /dev/sdb1
"Volume Label" field disabled because the filesystem is mounted, so changing it would fail.
After unmounting, saving the changes and entering the partitioner again, the volume label can now be changed.
Test
Extensive manual tests in a VM with a second virtual disk where partitions can be easily added and changed.
Related PRs