Umount on CoreELEC 19.3 (Kernel 4.9.113) provokes a segmentation fault with an external harddrive having a BTRFS file system

After having setup CoreELEC 19.3 for an Amlogic LePotato single-board computer with Kernel 4.9.113 from scratch, mounting a BTRFS formatted external disk drive works flawlessly via:

CoreELEC:~ # uname -a
Linux CoreELEC 4.9.113 #1 SMP PREEMPT Sun Oct 24 21:34:02 CEST 2021 aarch64 GNU/Linux
CoreELEC:~ # cryptsetup luksOpen /dev/sda usb-drive
CoreELEC:~ # mount -t btrfs /dev/mapper/usb-drive /media

A severe segmentation fault occurs when trying to unmount the BTRFS drive e.g. even directly after the mount via:

CoreELEC:~ # umount /media
Segmentation fault

Beyond, CoreELEC completely freezes when browsing the mounted BTRFS drive - even before the umount - via:

du -kh

Obviously, it seems to be a well-known issue related to the used kernel version < 4.9.168. Details see: [RESOLVED, DUPLICATE] Using BTRFS on N2: Unable to handle kernel NULL pointer dereference - ODROID

Is there any plan to update to a higher kernel version 4.9.168+ to get rid of that problem?

Hint: with LibreELEC 10.0.0 provided by sky42 containing:

  • dm-crypt
  • cryptsetup
  • LUKS

support, mounting and unmounting a BTRFS formatted harddrive works without any issues. LibreELEC in this version offers a kernel in version 5.10.47.

Sure. But who knows what the future will bring and when.

Maybe you could apply required patches to current kernel.

Well, taking the effort and porting back fixes to a kernel version quite old makes only sense when it is clear, when a new kernel version for CoreELEC comes into play as higher versions already exist that solve this issue here.

Otherwise, it’s worth to switch from CoreELEC to LibreELEC. That’s an approach consuming less work effort and allows getting a more up-to-date kernel version with less problems in this regard.

Of course the LE path is available for those who use other functions besides video playback. As you may know, video has problems with LE, huge problems.

1 Like

Okay - so when will a higher minor version of the currently used 4.9 major kernel be available for CoreELEC?

Obviously, it seems to be sufficient to switch to a version 4.9.168+. A major version kernel change is not needed.

sure…

And all media playback is using software decoder… So 720p will work, maybe 1080p, maybe not.
It’s not every time best to have newest…

:rofl:

Well, I wanna give a back port from a 4.9.168+ kernel version a chance and I’m absolutely open for that. But again - this makes only sense, when CoreELEC does not have the plan to switch to this version or beyond in the next releases.

Is there anybody here who knows about that plan?

IMPORTANT: an alternative for those who can switch the file system on the attached external hard drives is using EXT4 instead of BTRFS. Then this kernel related problem does not occur!

There is a plan to switch to a newer kernel, but there’s no ETA on that.

@TheCoolest: a rough assumption would be great. Do you expect the kernel version change to be done in the first quarter 2022 or later?

Checkout Le Potato Segmentation Fault on Large File Transfer - #54 by anon88919003 , at that time it was caused by bootloader. Give it a try…

I have no rough estimations, as it doesn’t depend solely on us.
If the backport is just a few commits, you should be able to achieve it rather quickly.

@rho-bot: I doubt it’s the boot loader in this case as with an EXT4-formatted external hard drive the issue does explicitly not occur. That’s been practically verified right now. It’s completely BTRFS-related. Beyond, we’re not talking about a file transfer here - just about unmounting a BTRFS file system.

@rho-bot: It’s even worse. When writing the referenced bootloader image to the LePotato CoreELEC 19.3 block device “/dev/mmcblk1” it does not boot anymore and results in a black screen:

dd if=/storage/bootloader.img of=/dev/mmcblk1 conv=fsync bs=1 count=112
dd if=/storage/bootloader.img of=/dev/mmcblk1 conv=fsync bs=512 skip=1 seek=1

Finally, giving the bootloader a try was a bad idea as it seems not to be compatible with CoreELEC 19.3 on LePotato! Now, I have to re-install CoreELEC 19.3 again :roll_eyes:

So, the current work-around is to switch the used file system on the attached hard drive from BTRFS to EXT4 - and the issue has gone :slightly_smiling_face:

Even better news added here on 05/30/2022: starting with CoreELEC 19.4 the CoreELEC team bumped Linux kernel to 4.9.269 that sustainably fixes the BTRFS segmentation fault issue!

Great work CoreELEC team!!!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.