Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Reboot into a different kernel after kernel panic
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
mimosinnet
l33t
l33t


Joined: 10 Aug 2006
Posts: 663
Location: Barcelona, Spain

PostPosted: Thu Nov 01, 2018 6:41 pm    Post subject: Reboot into a different kernel after kernel panic Reply with quote

When moving to a new kernel, the Intel Core2 Duo gives a kernel panic at boot. The following kernel parameters reboot the machine after the kernel panic:

Code:
# grep LOCKUP .config
CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y                                                                                                                                                       
CONFIG_LOCKUP_DETECTOR=y                                                                                                                                                                     
CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_HARDLOCKUP_DETECTOR_PERF=y
CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y
CONFIG_HARDLOCKUP_DETECTOR=y
CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=1
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1


After booting, it is possible to select a working kernel manually from grub2. With a server, is it possible to automatically boot from a predefined working kernel after a kernel panic?

Thanks for the hints!
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved.
Take care of the community answering unanswered posts.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7134
Location: almost Mile High in the USA

PostPosted: Fri Nov 02, 2018 2:30 am    Post subject: Reply with quote

This would be tricky to do... if I had to do something like this, I'd probably do:

Create a "boot" kexec kernel that is always used for booting no matter what. Have it have its own custom initramfs that, checks the status of the hard drive.
If the hard drive was not unmounted cleanly, you can assume a panic reboot happened, and go kexec a "safe" kernel.
If the hard drive WAS unmounted cleanly, then we probably didn't panic, and go kexec the "normal" kernel.
I guess this would let one do a lot of fun things in userland to pick a kernel if needed. You could do a lot of other things to determine whether the panic was critical or not. The "safe" kernel and the "boot" kernel could be one and the same, just exec init instead of kexecing.

Another possibility is early on startup scripts, set grub2 to the "safe" kernel, and just before unmounting on shutdowns/reboots, change the grub2 startup script to the "normal" kernel. Again if the kernel pukes and did not go through shutdown properly, grub will be still pointing to the "safe" kernel, and full shutdowns would be point to the experimental one. This method is probably inherently more dangerous as it could change your boot config into an unbootable situation, but does not require a custom boot environment.

Unfortunately these are both potentially dicey and having a LOM/BMS/IPMI/MEI/... is better...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
mimosinnet
l33t
l33t


Joined: 10 Aug 2006
Posts: 663
Location: Barcelona, Spain

PostPosted: Sun Nov 04, 2018 10:52 am    Post subject: Reply with quote

eccerr0r wrote:
Create a "boot" kexec kernel that is always used for booting...


I was not aware of kexec! I have found documentation in the Gentoo Wiki and in the Gentoo forums! :D

Many thanks for the hint!

Cheers!
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved.
Take care of the community answering unanswered posts.
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Sun Nov 04, 2018 11:41 am    Post subject: Reply with quote

Sometimes when things go wrong system is not working properly after kexec boot, have to do hard reset.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7134
Location: almost Mile High in the USA

PostPosted: Sun Nov 04, 2018 4:05 pm    Post subject: Reply with quote

yep, hence the hardware based solutions are still needed and kexec is not a panacea.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum