Purpose: There are some machines on which Linux will freeze, after a restart or a shutdown command is issued, right at the very end of the process forcing you to do a hard reset – press the reset/power button the system or plug the cord which is not good.In this post we will see how you can resolve almost 99% of freeze/hang that occurs during shutdown or reboot.

Why this happens

There are many reasons why this happens – some times it is an BIOS issue or sometimes it’s just that your system has a different kind of hardware setup, for example no keyboard controller, and Linux (the kernel) does not understand how to tackle that situation. Most of the time if it is a BIOS issue it is not very easy to ask your system vendor to give you an immediate BIOS fix that will take care of the issue and hence you have to rely on some kernel parameters that you need to pass to fix the hang/freeze issue.

Let’s say you bought a new machine and you notice that your Linux distribution hangs at the very end of the reboot/shutdown process, upon giving any of the following commands:

# shutdown -r now
# shutdown -h now
# reboot
# halt
# poweroff
# Ctrl+Alt+Del

Solution


In order to fix the issue, you should try one-by-one passing the following parameter to the kernel, in the form of “reboot=<parameter>”, at the time of boot:

warm =  Don’t set the cold reboot flag

cold = Set the cold reboot flag

bios = Reboot by jumping through the BIOS (only for X86_32)

smp = Reboot by executing reset on BSP or other CPU (only for X86_32)

triple = Force a triple fault (init)

kbd = Use the keyboard controller. cold reset (default)

acpi = Use the RESET_REG in the FADT

efi = Use efi reset_system runtime service

pci = Use the so-called “PCI reset register”, CF9

force = Avoid anything that could hang.

As per my experience, one of the parameters (in blue color above) should be able to resolve your hang (or freeze) issue 90% of the time:

reboot=bios
or
reboot=acpi

Once your system boots you can verify whether the parameter was correctly passed or not by issuing the following command:

# cat /proc/cmdline

Output:

root=/dev/sda ro vga=791 quiet reboot=bios

You can find the list of all the above parameters in the reboot.c file in the Linux kernel source.

By default, the Linux kernel uses the reboot=kbd method i.e. it tries to look for a keyboard controller and issue a reset/shutdown command to it. But there are some systems like some of the Intel Atom processor based  machines that don’t have a keyboard controller and the above fixes are required. If you read the reboot.c file carefully there are some major main stream machines from Dell, Sony, HP, etc. that require the above “reboot=” fix. I guess sometime it is easier to fix the issue by using the kernel parameter rather than fixing in the BIOS.

Also you can also use the first letter (as denoted in the “[]” brackets) of each of the parameter:

reboot=b                 # for reboot=[b]ios
reboot= a                 # for reboot=[a]cpi

and you can pass multiple parameter at the same time and Linux kernel will try in order specified:

reboot=a,b,k,c      # for reboot=acpi,bios,kbd,cold

Happy Reboot=’ing!

Be Sociable, Share!