I want to show how I (luckily) fixed forced read-only BTRFS filesystem (originally I planed to give up…)
Below are related kernel messages that resulted in read-only filesystem:
Linux version 6.12.0-160000.32-default (geeko@buildhost) (gcc-13 (SUSE Linux) 13.4.0, GNU ld (GNU Binutils; SUSE Linux 16) 2.45.0.20251103-1600001) #1 SMP PREEMPT_DYNAMIC Fri May 15 19:14:55 UTC 2026 (78b265d)
Command line: BOOT_IMAGE=/boot/vmlinuz-6.12.0-160000.32-default root=UUID=aa507e72-f74d-4d48-b589-c03d7b260430 mitigations=off security=selinux selinux=1 net.ifnames=0 ia32_emulation=1 console=ttyS0
...
Btrfs loaded, assert=on, zoned=yes, fsverity=yes
BTRFS: device label leap-root devid 1 transid 2348 /dev/vda2 (254:2) scanned by mount (547)
BTRFS info (device vda2): first mount of filesystem aa507e72-f74d-4d48-b589-c03d7b260430
BTRFS info (device vda2): using crc32c (crc32c-intel) checksum algorithm
BTRFS info (device vda2): turning on async discard
BTRFS info (device vda2): enabling free space tree
...
BTRFS info (device vda2 state M): use zstd compression, level 3
page: refcount:4 mapcount:0 mapping:00000000af0adc7f index:0x3a1f54 pfn:0x107264
memcg:ffff8cc840335800
aops:btree_aops [btrfs] ino:1
flags: 0x17ffffc000412e(referenced|uptodate|lru|active|private|writeback|node=0|zone=2|lastcpupid=0x1fffff)
raw: 0017ffffc000412e fffff6f0c41c9c48 fffff6f0c41c9b08 ffff8cc849cae3b8
raw: 00000000003a1f54 ffff8cc8488344b0 00000004ffffffff ffff8cc840335800
page dumped because: eb page dump
BTRFS critical (device vda2): corrupt leaf: root=2 block=15602106368 slot=25 bg_start=31437357056 bg_len=1073741824, invalid block group used, have 18446744072635809792 expect [0, 1073741824)
BTRFS info (device vda2): leaf 15602106368 gen 2351 total ptrs 135 free space 6187 owner 2
item 0 key (27120435200 169 0) itemoff 16250 itemsize 33
extent refs 1 gen 2332 flags 2
ref#0: tree block backref root 3
...
extent refs 1 gen 2332 flags 1
ref#0: shared data backref parent 15650095104 count 1
BTRFS error (device vda2): block=15602106368 write time tree block corruption detected
BTRFS: error (device vda2) in btrfs_commit_transaction:2539: errno=-5 IO failure (Error while writing out transaction)
BTRFS info (device vda2 state E): forced readonly
BTRFS warning (device vda2 state E): Skipping commit of aborted transaction.
BTRFS error (device vda2 state EA): Transaction aborted (error -5)
BTRFS: error (device vda2 state EA) in cleanup_transaction:2026: errno=-5 IO failure
BTRFS info (device vda2 state EA): balance: resume -dusage=0
BTRFS info (device vda2 state EA): balance: ended with status: 0
That’s situation.
We can’t use scrub:
leap16-obs-pil:~ # btrfs scrub start -B /
WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.aa507e72-f74d-4d48-b589-c03d7b260430: Read-only file system, progress cannot be queried
WARNING: failed to write the progress status file: Read-only file system, status recording disabled
Starting scrub on devid 1
ERROR: scrubbing / failed for device id 1: ret=-1, errno=30 (Read-only file system)
scrub canceled for aa507e72-f74d-4d48-b589-c03d7b260430
Scrub started: Sun Oct 11 12:05:24 2026
Status: aborted
Duration: 0:00:00
Total to scrub: 0.00B
Rate: 0.00B/s
Error summary: no errors found
Running read-only btrfs check:
leap16-obs-pil:~ # btrfs check /dev/vda2
Opening filesystem to check...
ERROR: /dev/vda2 is currently mounted, use --force if you really intend to check the filesystem
leap16-obs-pil:~ # btrfs check--force
Opening filesystem to check...
WARNING: filesystem mounted, continuing because of --force
Checking filesystem on /dev/vda2
UUID: aa507e72-f74d-4d48-b589-c03d7b260430
[1/8] checking log skipped (none written)
[2/8] checking root items
[3/8] checking extents
block group [31437357056 1073741824] used 0 but extent items used 1073741824
ERROR: errors found in extent allocation tree or chunk allocation
[4/8] checking free space tree
[5/8] checking fs roots
[6/8] checking only csums items (without verifying data)
[7/8] checking root refs
[8/8] checking quota groups skipped (not enabled on this FS)
found 19996229632 bytes used, error(s) found
total csum bytes: 6101012
total tree bytes: 165625856
total fs tree bytes: 146358272
total extent tree bytes: 11730944
btree space waste bytes: 31128070
file data blocks allocated: 93878190080
referenced 23560949760
WARNING!
initially I did serious mistake: I tried to fix BTRFS from Tumbleweed Rescue ISO. But it failed miserably with:ERROR: please finish/cacnel the running replace/balance before running this commandOnly when I used
btrfs-progsfrom booted system (and its kernel) I was able to fix that filesystem!
After backup I tried --repair and --force (on system that failed to boot - to match Kernel and BTRFS Progs versions!):
leap16-obs-pil:~ # btrfs check --repair --force /dev/vda2
enabling repair mode
Opening filesystem to check...
WARNING: filesystem mounted, continuing because of --force
Checking filesystem on /dev/vda2
UUID: aa507e72-f74d-4d48-b589-c03d7b260430
[1/8] checking log skipped (none written)
[2/8] checking root items
Fixed 0 roots.
[3/8] checking extents
block group [31437357056 1073741824] used 0 but extent items used 1073741824
super bytes used 19996246016 mismatches actual used 19996229632
No device size related problem found
[4/8] checking free space tree
[5/8] checking fs roots
[6/8] checking only csums items (without verifying data)
[7/8] checking root refs
[8/8] checking quota groups skipped (not enabled on this FS)
found 39992475648 bytes used, no error found
total csum bytes: 12202024
total tree bytes: 331268096
total fs tree bytes: 292716544
total extent tree bytes: 23461888
btree space waste bytes: 62245999
file data blocks allocated: 187756380160
referenced 47121899520
When I run again just btrfs check --force /dev/vda2 it no longer reported error - good sign. However fix somehow killed grub (initial menu no longer appeared).
To fix grub I did:
- booted Tumbleweed Rescue ISO:
openSUSE-Tumbleweed-Rescue-CD-x86_64-Snapshot20261009-Media.iso - installed and used
arch-chrootcommand (it is handy because it bind-mounts all synthetic filesystems required by grub2-install):
zypper in arch-chroot-scripts
mkdir /mnt/target
mount /dev/vda2 /mnt/target # my BTRFS partition
mount /dev/vda1 /mnt/target/boot/efi # my EFI partition
arch-chroot /mnt/target
# in chroot:
grub2-install /dev/vda
exit # exits chroot
cd /
umount -lR /mnt/target
reboot
After reboot, GRUB worked again. Finally I verified installed RPMs with:
rpm -Va
There was no corrupted binary reported (only some configuration files and permissions which is expected).
Hopefully this will help someone else. But please remember that you should always make Image backup before any repair attempt. And I fully understand that I was just lucky - your mileage may vary.