Kernel panic after hibernation

My laptop started crashing into kernel panic while I waking up it after hibernation.

I use this option not so often so I can’t say exactly since what time it has been broken.

I hibernated my laptop a few months ago and everything worked well.

Last weekend I had to hibernate the laptop and once I tried to wake it up, it showed a purple screen with a message:

KERNEL PANIC!
Please reboot your computer.
Fatal exception in interrupt

and also there was a blinking LED on CapsLock.

I have ThinkPad T14 Gen 4.

did rebooting bring back the system?

did you move your drive or change anything about the drive where the hibernation image is stored?

seems like was expecting to find and image and could not find it.

1 Like
  1. yes, the system works fine after reboot. i also tried to hibernate the laptop earlier today, and it failed to boot again.
  2. no, it’s a laptop, i’m afraid the storage chips are soldered to the main board.
  3. i haven’t changed disk layout since the os was installed.
$ sudo lsblk
NAME               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
nvme0n1            259:0    0 953.9G  0 disk
├─nvme0n1p1        259:1    0     1G  0 part  /boot/efi
├─nvme0n1p2        259:2    0    10G  0 part  /boot
└─nvme0n1p3        259:3    0 942.8G  0 part
  └─dm_crypt-0     252:0    0 942.8G  0 crypt
    ├─disk0-root   252:1    0   100G  0 lvm   /
    ├─disk0-swap   252:2    0    42G  0 lvm   [SWAP]
    ├─disk0-home   252:3    0   100G  0 lvm   /home
    ├─disk0-var    252:4    0   100G  0 lvm   /var
    ├─disk0-opt    252:5    0    50G  0 lvm   /opt
    └─disk0-docker 252:6    0   100G  0 lvm   /var/lib/docker
1 Like

hibernation is stored on the SSD, not in RAM

when the kernel boots it looks to see if there is a resume image stored on disk, and if there is then it loads that.

if loading that doesn’t work, or if the file is corrupted you can get all manner of unexpected results, which is why enabling Secure Boot will generally prevent hibernation (at least it does on my system).

what does swapon say?

by the looks of the output above you should have 42G of swap which would be enough for a 32GB RAM machine… if you have more ram that that, you are going to need a larger swap.

hibernation is stored on the SSD, not in RAM

Yes, that’s the reason why I have 42GB of swap. I checked the laptop’s specs, it says there is M.2 slot for SSD.

I also have configured a partition for resume after hibernation:

$ sudo cat /etc/default/grub | grep -i resume
GRUB_CMDLINE_LINUX_DEFAULT="mitigations=off fsck.repair=yes resume=UUID=09240e4a-644f-4e15-b52f-1cd73c2367fa"

which is why enabling Secure Boot will generally prevent hibernation

I did not change laptop’s configuration for ages, but updates. And it worked fine until I needed to turn off electricity at my flat for a few hours. I hibernated the laptop as usual, but once I turned it on again, it successfully restored saved image and failed with panic. It’s a laptop. Nobody disassembled it, change its configuration (including adding, removing or replacing hardware) or even move it away from my work table. I only had connected an external power supply and a usb mouse (that has been connected to the same usb port for at least last 3 years).

what does swapon say?

$ sudo swapon
NAME      TYPE      SIZE USED PRIO
/dev/dm-2 partition  42G   0B   -2
1 Like

if you do

blkid | grep swap

does the UUID match what is shown in GRUB

and i use the GRUB_CMDLINE_LINUX= instead of the GRUB_CMDLINE_LINUX_DEFAULT=

fwiw.

if you do

blkid | grep swap

does the UUID match what is shown in GRUB

Yes, it does:

$ sudo blkid | grep 'TYPE="swap"' | sed -e 's/^.* UUID="\([0-9a-f-]\+\)" .*$/\1/'
09240e4a-644f-4e15-b52f-1cd73c2367fa
$ sudo grep $(sudo blkid | grep 'TYPE="swap"' | sed -e 's/^.* UUID="\([0-9a-f-]\+\)" .*$/\1/') /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="mitigations=off fsck.repair=yes resume=UUID=09240e4a-644f-4e15-b52f-1cd73c2367fa"

and i use the GRUB_CMDLINE_LINUX= instead of the GRUB_CMDLINE_LINUX_DEFAULT=

Yes, it’s also possible, but in this case it does not matter.

the next thing i would try is remaking the connection but that requires removing the SSD… no idea how easy that is on this device.

how old is the connection between the SSD and the M.2 slot?

how old is the connection between the SSD and the M.2 slot?

The ssd has been installed on a factory. I did not change it.

There are no any other issues and there are no issues with the ssd.

I think, i just wait for the next update rather than disassemble my laptop.

$ sudo smartctl -A /dev/nvme0n1
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.17.0-19-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF SMART DATA SECTION ===
SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        38 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    3%
Data Units Read:                    75,948,074 [38.8 TB]
Data Units Written:                 64,001,458 [32.7 TB]
Host Read Commands:                 3,885,317,198
Host Write Commands:                2,973,134,918
Controller Busy Time:               7,037
Power Cycles:                       175
Power On Hours:                     625
Unsafe Shutdowns:                   26
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               38 Celsius
Temperature Sensor 2:               38 Celsius

FYI, electrical connections get tired and can begin to throw intermittent errors when resistances start to creep out of spec.

reseating the connection—or what is known as percussive maintenance—can often clear up these random issues.

1 Like

M.2 slot has 67 pines. It’s much less than number of bits that the storage can handle.

It means, if there were “bad” lines, the laptop would suffer from constant disk i/o errors. But there is no r/w errors.

Excluding hardware errors, the most probably reason that i have no errors during normal usage and 100% crash during recovery from standby - it’s a software bug.

you can rule out your config as the culprit by trying a new user acct and setting up hibernation on that user.

if that fails too then you have something borked about your install

if not then it’s something in your configs

I had a similar issue with one of my laptops when I was on Fedora 42. For some reason everytime I updated through Discover, once the updates were installed and rebooted the new Grub entry would throw up a kernel panic error - but the previous version on Grub would boot. And so it would go after ever update if I used Discover.

What I ended up doing was removing the latest kernel update in the terminal and then re-do the update in terminal. Which seemed to fix it as long as I continued doing updates in terminal. And it was only this particular laptop (ASUS Vivobook).

To upgrade to 43 it makes a bigger boot partition (2GB) so just did a fresh re-install of the OS and everything worked again. It may have been something weird with one of the updates or maybe something to do with when I hibernated the laptop.

Maybe you might need to do the same and re-install?

to go with this, when i was using the offline updates option in discover, my machine would reboot and the grub countdown timer would change from my usual 5 sec to 30 sec every time.

this leads me to think something about the offline updates auto reboot cycle is injecting a kernel parameter that for me just changes the timer, but for you causes the panic.

Yep, i know that, but it seems that it’s not my case:

$ df -h | grep -i boot
/dev/nvme0n1p2            9.8G  332M  9.0G   4% /boot
/dev/nvme0n1p1            1.1G   11M  1.1G   1% /boot/efi

Just in case, i have no any partitions with utilization more than 50%.