You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Workqueue: events_freezable mmc_rescan crash with Raspbian kernel 4.14.79-v7+ #2810
Hmm, what are the Pi's doing during that time? We haven't seen anything like this in the office, so would be interested to know what they are doing that might cause this.
Same issue here. Attached is my kernel log. kern.log
The issue occurs around Jan 18 19:57:02
This is on a headless install. The green light is constant, the PI responds to pings but is unable to open up an ssh session.
This actually occurs for me during a movie being streamed by plex , around an hour and a half in.
I left the pi to see if it would recover overnight, sadly it didn't.
I noticed this when I used VS Code's SSH Remote Extension which install a bunch of stuff in the remote server. This cause a HUGE use of CPU by "node" program, and then everything freezes, I couldn't even connect via SSH because the server is freezed. My remote server is a simple Raspberry Pi 3 B+, so not very powerful.
Something curious: when all this happens, I noticed in both my host machine and remote server a process "kswapd0" that consumes much CPU too, can this be related?
Also, if the scheduler sends interrupts constantly to context switch and to pass to another process, so why a certain process that consumes too much CPU can freeze the pi? Shouldn't scheduler go on with other processes equally? Why can it monopolize the CPU and freeze the pi?
I believe you are running out of memory, which is why kswapd is going mad, rather than running out of CPU power.
If this happens your SD card is probably bad. Best replace it.
Even relatively new SD cards can go bad, because they are not designed for repeated continuous writes to the same location over & over, nor continuous 24/7 operation.
I have had the best luck with SanDisk Ultra microSDHC UHS-I Memory Card DSQUA4-032G-GN6MT which rarely fail. Regardless I would recommend swapping out SD cards once every year to be safe.
The kernel should be updated nevertheless with better error handling, in my opinion.
All storage devices fail eventually ;) But yes, I have had the best luck with SanDisk, and their warranty (both length and replacement policy) is the best in the business.
I noticed this when I used VS Code's SSH Remote Extension which install and runs a bunch of stuff in the remote server. This cause a HUGE use of memory, and then everything freezes, I couldn't even connect via SSH because the server is freezed.
EDIT: I fixed by increasing the swap partition size!
I would like to thanks everyone for all the comments i've found on this page.
I've an rpi4 4G memory, and from this summer i've began to have this issue too frequently.
My system is a plain debian 11, with /boot/firmware and / mounted on sdcard; /home, /var and /tmp are mounted on ssd.
I think i'll move my / to ssd to and activate the swap, and first of all i'll replace my sdcard!!! 😄
If this happens your SD card is probably bad. Best replace it.
Even relatively new SD cards can go bad, because they are not designed for repeated continuous writes to the same location over & over, nor continuous 24/7 operation.
I have had the best luck with SanDisk Ultra microSDHC UHS-I Memory Card DSQUA4-032G-GN6MT which rarely fail. Regardless I would recommend swapping out SD cards once every year to be safe.
The kernel should be updated nevertheless with better error handling, in my opinion.
All storage devices fail eventually ;) But yes, I have had the best luck with SanDisk, and their warranty (both length and replacement policy) is the best in the business.
For those wondering about the process for doing so:
1. Use SD Card Copier (Raspberry Pi OS GUI app) to copy existing card to new card
2. Physically swap in new card
3. (If desired) Use GParted to:
* resize the shared data partition to its minimum size at the end of the partition table
* extend the root partition into the unallocated space resulting from the above
FWIW replacing the microSD card has fixed the problem. I think I've experienced only 1 crash since.
Hello, just joining the thread on this issue, which also happens to my raspberry pi 3b+ rev1.2.
It had been running fine since ~2018 on raspbian armv7, however this issue has started ever since I migrated to aarch64 raspiOS in march. I'm currently running kernel 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux. It is running docker with HomeAssistant, Nodered, Signal-CLI and mqtt. The raspi locks up every 6 to 8 days.
Also:
cat /etc/debian_version
11.7
I've had to replace the SD card before this migration several times, but the symptoms of a dying SD were different, being random crashes of containers, not a full system lockup.
In this case replacing the SD doesn't change anything. (suing Sandisk 16/32GiB A1 class 10)
I'm currently trying the proposed fix (applied it 3 days ago, currently monitoring):
If it doesn't work, I'll move the swap file to a USB stick and likely the whole system to a USB SSD afterwards.
edit:
the system partly locked up with the fix. the system still runs (replies to pings) but any write will not complete.
now moving swap to a usb key (not ssd, no power budget left)
edit2 (+1month):
it appears the system running low on memory on many occasions mainly due to 2 docker containers requiring more and more ressources (homeassistant and signal-cli in json-rpc mode). Some are now set to restart daily to contain the increasing memory consumption.
the swap on a usb key did work out quite well. However the USB key died in a few weeks : the system crashed within minutes of booting, corrupting docker log files ('\x00' error).
I've "moved" the swap to zram with aggressive values.
It's been a few days, some more time is needed to see if it helps mitigating the issue.
SSD migration still needs to be done, but zram swap doesn't interfere with this upgrade.
edit3 (+1.5months):
so far there are no more hangs with the zram swap. I've graphed the ram and swap usage to get a view of what is happening. it shows there is a major memory consumption after a few days with my workload, with only a few MiB of memory left even in the swap. so the swap increasing slowness on the sd-card was the culprit. no more hangs but I'll have to migrate to a sbc with more memory.
edit4 (+3 months)
still using the raspi3b+ 1GiB of RAM and no hang ups. The memory is heavily occupied but no more crashes.
over the last 1.5months (no reboot)
edit5 (+10 months)
still using raspi3b+ but encountering memory depletion and usb ssd disconnects (other kernel module issue, not power replated).
moved back to armv7l and emmc disk, not a single issue since : 300MiB+ free and no hangups or disconnects.
I am able to reproduce this on a CM4 (lite, 1GB ram, no wifi, no heatsink) using the official CM4 IO board and a Sandisk EVO Select 128GB microSD card (which has not seen much abuse). I am using a 64bit kernel, v5.15.34-v8, built using Yocto and meta-raspberrypi.
Observed this again after updating my kernel to 5.15.92 (still on a CM4 with the same uSD card, this time without running anything stressing the CPU/RAM/SD card IO):
[236227.555571] INFO: task kworker/1:0:1010415 blocked for more than 120 seconds.
[236227.562933] Tainted: G C O 5.15.92-v8 #1
[236227.569081] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[236227.577030] task:kworker/1:0 state:D stack: 0 pid:1010415 ppid: 2 flags:0x00000208
[236227.585685] Workqueue: events_freezable mmc_rescan
[236227.590613] Call trace:
[236227.593207] __switch_to+0x110/0x164
[236227.597452] __schedule+0x32c/0x8f4
[236227.601081] schedule+0x70/0x12c
[236227.604426] __mmc_claim_host+0xc0/0x1f0
[236227.608463] mmc_get_card+0x3c/0x50
[236227.612079] mmc_sd_detect+0x28/0xa0
[236227.616265] mmc_rescan+0x94/0x2f0
[236227.619794] process_one_work+0x1dc/0x4a4
[236227.623935] worker_thread+0x144/0x490
[236227.627810] kthread+0x140/0x154
[236227.631256] ret_from_fork+0x10/0x20
I'm not using Raspberry Pi OS, I'm using an image built with Yocto kirkstone and meta-raspberrypi. This kernel update was a result of the update in meta-raspberrypi.
Activity
ldrolez commentedon Jan 18, 2019
Same problem on a 3B after upgrading to 4.14.79-v7+
Crash every 1-3 days. Now downgrading to 4.14.52-v7+
JamesH65 commentedon Jan 18, 2019
Hmm, what are the Pi's doing during that time? We haven't seen anything like this in the office, so would be interested to know what they are doing that might cause this.
JamesH65 commentedon Jan 18, 2019
Actually, this is a duplicate of an issue on our Linux tracker which is the correct place for it to be. Please continue conversation there...#2810
JamesH65 commentedon Jan 18, 2019
Bum, closed wrong one. Reopened. Will now attempt to close the one in firmware...
op-ecoprintq commentedon Jan 18, 2019
So the machines in question are running LXDE, a Java application, and the onboard keyboard.
pelwell commentedon Jan 18, 2019
That doesn't tell me anything about their level of activity - CPU, file system, network etc.
Alexurb commentedon Jan 19, 2019
Same issue here. Attached is my kernel log.
kern.log
The issue occurs around Jan 18 19:57:02
This is on a headless install. The green light is constant, the PI responds to pings but is unable to open up an ssh session.
This actually occurs for me during a movie being streamed by plex , around an hour and a half in.
I left the pi to see if it would recover overnight, sadly it didn't.
Alexurb commentedon Jan 21, 2019
Happened again mid movie. Attached is another kernel log
kern.log
Alexurb commentedon Jan 23, 2019
I've so far found some advice from https://www.blackmoreops.com/2014/09/22/linux-kernel-panic-issue-fix-hung_task_timeout_secs-blocked-120-seconds-problem/
summary:
sudo sysctl -w vm.dirty_ratio=10
sudo sysctl -w vm.dirty_background_ratio=5
sudo sysctl -p
seems to do the trick so far, still testing (3 movies down)
I'll comment if it occurs again.
To make it permanent(after reboot) read the link
Alexurb commentedon Jan 23, 2019
So far so good.
peabody commentedon Aug 29, 2019
Just going say this thread saved my pi 3b+. Was hanging terrible on any intense IO. The solution by Alexurb fixed the problem for me.
jdrch commentedon Apr 4, 2020
Same problem here on my Pi 3B+ running Raspbian Buster. Gonna try that edit and then reboot. Fingers crossed!
paralin commentedon Sep 22, 2020
Just ran into this with kernel 5.4.51-v8 aarch64 on Pi 4.
Ill try the fix recommended above in this thread:
Here's the dmesg errors:
47 remaining items
JamesH65 commentedon May 24, 2022
I believe you are running out of memory, which is why kswapd is going mad, rather than running out of CPU power.
paralin commentedon May 24, 2022
@JamesH65 is probably right, you're out of memory.
My bad, I assumed that the comment was related to this issue and not some other unrelated thing :)
jdrch commentedon May 24, 2022
All storage devices fail eventually ;) But yes, I have had the best luck with SanDisk, and their warranty (both length and replacement policy) is the best in the business.
Last Friday I retired the 32 GB card I'd been using since I got the Pi in 2018 and replaced it with a 200 GB card. We'll see what happens from there.
For those wondering about the process for doing so:
All3xJ commentedon May 24, 2022
@JamesH65 @paralin
Is there a way to fix this? Or to workaround this?
JamesH65 commentedon May 25, 2022
Use less memory? Use Pi4 with more memory? Use a USB SSD and put a swap file on it, that might be faster than swap on the SD card?
What is the Pi doing that is using all the RAM?
All3xJ commentedon May 25, 2022
I noticed this when I used VS Code's SSH Remote Extension which install and runs a bunch of stuff in the remote server. This cause a HUGE use of memory, and then everything freezes, I couldn't even connect via SSH because the server is freezed.
EDIT: I fixed by increasing the swap partition size!
shakin89 commentedon Oct 21, 2022
I would like to thanks everyone for all the comments i've found on this page.
I've an rpi4 4G memory, and from this summer i've began to have this issue too frequently.
My system is a plain debian 11, with /boot/firmware and / mounted on sdcard; /home, /var and /tmp are mounted on ssd.
I think i'll move my / to ssd to and activate the swap, and first of all i'll replace my sdcard!!! 😄
jdrch commentedon Oct 26, 2022
FWIW replacing the microSD card has fixed the problem. I think I've experienced only 1 crash since.
sirjeannot commentedon May 23, 2023
Hello, just joining the thread on this issue, which also happens to my raspberry pi 3b+ rev1.2.
It had been running fine since ~2018 on raspbian armv7, however this issue has started ever since I migrated to aarch64 raspiOS in march. I'm currently running kernel 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux. It is running docker with HomeAssistant, Nodered, Signal-CLI and mqtt. The raspi locks up every 6 to 8 days.
Also:
I've had to replace the SD card before this migration several times, but the symptoms of a dying SD were different, being random crashes of containers, not a full system lockup.
In this case replacing the SD doesn't change anything. (suing Sandisk 16/32GiB A1 class 10)
I'm currently trying the proposed fix (applied it 3 days ago, currently monitoring):
If it doesn't work, I'll move the swap file to a USB stick and likely the whole system to a USB SSD afterwards.
edit:
the system partly locked up with the fix. the system still runs (replies to pings) but any write will not complete.
now moving swap to a usb key (not ssd, no power budget left)
edit2 (+1month):
it appears the system running low on memory on many occasions mainly due to 2 docker containers requiring more and more ressources (homeassistant and signal-cli in json-rpc mode). Some are now set to restart daily to contain the increasing memory consumption.
the swap on a usb key did work out quite well. However the USB key died in a few weeks : the system crashed within minutes of booting, corrupting docker log files ('\x00' error).
I've "moved" the swap to zram with aggressive values.
It's been a few days, some more time is needed to see if it helps mitigating the issue.
SSD migration still needs to be done, but zram swap doesn't interfere with this upgrade.
edit3 (+1.5months):

so far there are no more hangs with the zram swap. I've graphed the ram and swap usage to get a view of what is happening. it shows there is a major memory consumption after a few days with my workload, with only a few MiB of memory left even in the swap. so the swap increasing slowness on the sd-card was the culprit. no more hangs but I'll have to migrate to a sbc with more memory.
edit4 (+3 months)


still using the raspi3b+ 1GiB of RAM and no hang ups. The memory is heavily occupied but no more crashes.
over the last 1.5months (no reboot)
edit5 (+10 months)
still using raspi3b+ but encountering memory depletion and usb ssd disconnects (other kernel module issue, not power replated).
moved back to armv7l and emmc disk, not a single issue since : 300MiB+ free and no hangups or disconnects.
djr-spectrummfg commentedon Jun 28, 2023
I am able to reproduce this on a CM4 (lite, 1GB ram, no wifi, no heatsink) using the official CM4 IO board and a Sandisk EVO Select 128GB microSD card (which has not seen much abuse). I am using a 64bit kernel, v5.15.34-v8, built using Yocto and meta-raspberrypi.
I can trigger it by compiling a large C++ project (https://github.com/OpenLightingProject/ola using
make -j4) on the RPi. After some time the build will often hang and eventually produce the hung task kernel message. As well as stressing the CPU, this build does seem to consume most of the available RAM as at times I have seenoom-killermessages.Sample of kernel message:
gec75 commentedon Feb 16, 2024
I also found a similar problem in a completely different setup.
https://bugzilla.kernel.org/show_bug.cgi?id=218493
sresam89 commentedon Mar 3, 2024
I finding the same issue on newer kernel
Trying not to cross-post
Issue linked here
djr-spectrummfg commentedon Apr 15, 2024
Observed this again after updating my kernel to 5.15.92 (still on a CM4 with the same uSD card, this time without running anything stressing the CPU/RAM/SD card IO):
jdrch commentedon Apr 15, 2024
Isn't Raspberry Pi OS on v6+ for all devices? I'd think that's where any fixes are most likely to be.
djr-spectrummfg commentedon Apr 15, 2024
I'm not using Raspberry Pi OS, I'm using an image built with Yocto kirkstone and meta-raspberrypi. This kernel update was a result of the update in meta-raspberrypi.