Skip to content

Raspberry PI Compute Module 5 - eMMC write hungs in kernel during tar.gz unpack #7249

@berndbenner

Description

@berndbenner

Describe the bug

We have made a base board for a DIN Mounting Rail, with a Raspberry PI Compute Module 5 for data acquisition and control.
Now I am trying to run our python installation tool on the CM5 to setup the eMMC-partitions, filesystems and config files.
The tool is able to setup partitions and popule filesystems on PCIe-NVME, USB-Sticks and mmc/sd-cards by calling system tools like fdisk,parted, tar, pigz, df etc.

The tool is able to setup all other testet media [ NVME, slow and fast USB-sticks ] , but not the CM5 eMMC- flash.

What happens:

The tool will setup the partitions, format the target mmc-rootfs-partition with ext4 and extract a tar.gz ( with pigz ) over a pipe very fast from a tar container file ( loaded from the usb-boot device ) to the mountpoint-dir of the emmc-rootfs.

The error appears during extraction of a tar.gz with uncompressed/compressed size of 4.4 GB/1.8 GB to the rootfs partition mmcblk0p5.

I try to slow down the extraction, by using gzip instead of pigz-extraction, but this will affect only the frequency of hung/deadlock errors.

Our python tool will extract the gz-archive in a background thread calling os.system('tar ...').
A foreground thread will call os.system('df -lBk /mnt/mountpoint') every 0.5 s to get the progress information from the used-col of the df-output.

partition layout of the eMMC-device

The tool partitions the eMMC with 1 GB boot and 2 logical drives of 20 and 37 GB size.

root@rta-sl-mhinst-000:/projects# fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 58.24 GiB, 62537072640 bytes, 122142720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6aaa2ac9
/dev/mmcblk0p1 *           8   2097167   2097160    1G  c W95 FAT32 (LBA)
/dev/mmcblk0p2       2097176 122142719 120045544 57.2G  f W95 Ext'd (LBA)
/dev/mmcblk0p5       2097184  44040231  41943048   20G 83 Linux
/dev/mmcblk0p6      44040240 122142719  78102480 37.2G 83 Linux

The error appears in 90 % of the starts of the tool. After hung of the tar-gz extraction I need to reboot, because the background tar-process will hung in a kernel function and I am unable to kill it. The access to the eMMC is blocked.

root@rta-sl-mhinst-000:/projects/rtflex# ps aux | grep tar
root        1085  0.0  0.0  11520  7760 ?        Ss   13:09   0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
root        7516  0.0  0.0   9024  4128 pts/0    D    13:27   0:01 tar -C /mnt/itarget -xzf -
root        7517  0.0  0.0      0     0 pts/0    Z    13:27   0:00 [tar] <defunct>
root       40460  0.0  0.0   6384  2128 pts/1    S+   14:27   0:00 grep tar

Our tool will execute 'echo 0 > /proc/sys/kernel/hung_task_timeout_secs' to avoid kernel hung messages of background ext4-journal sync processes.

If I do not switch off hung_task_timeout, I get the hung messages in the kernel log, but this will also happen on installations to slow usb-devices, but without a complete hung of the device.

With 'echo 0 > /proc/sys/kernel/hung_task_timeout_secs' there are no kernel error message.
The last message is the mount of the filesystem

root@rta-sl-mhinst-000:/projects/rtflex#journalctl -k -f
Feb 17 14:52:07 rta-sl-mhinst-000 kernel: EXT4-fs (mmcblk0p5): mounted filesystem 

I am using the newest kernel 6.12.62+rpt-rpi-2712
and a CM5 with 16GB RAM and 64 GB eMMC Flash.

Revision        : e04180
Serial          : 785aeb8744d30d55
Model           : Raspberry Pi Compute Module 5 Rev 1.0

Steps to reproduce the behaviour

The error can be reproduced on a similar prepared eMMC and a similar sized tar.gz archive with 2 terminals

first terminal:

mount /dev/mmcblk0p5 /mnt/mmcblk0p5
tar -C /mnt/mmcblk0p5 -xf setup-root.tar.gz --use-compress-program=pigz

second terminal:

watch df -lBk /dev/mmcblk0p5

Device (s)

Raspberry Pi CM5

System

Raspberry Pi reference 2025-12-04
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 4997bf4e4e49bc3305eb182a4a08bd023529da04, stage4
root@rta-sl-mhinst-000:/projects/rtflex#

2025/12/08 19:29:54
Copyright (c) 2012 Broadcom
version 2226a853 (release) (embedded)

Logs

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions