Ubuntu Boot Automatically After Failed Shutdown – Stuck at Bootloader

by on September 15, 2014

Ubuntu

Hi
This is going to be a very short post about a Ubuntu boot issues (I know, very sexy topic). Many of the robots I work on are running Ubuntu and this is a very annoying “feature” that you might want to disable.

The problem with versions of Ubuntu from the past few years is that if the computer is not shut down properly it will not want to boot the next time you use it. Instead of rebooting the next time you try starting your computer it will just get stuck at the bootloader screen and wait for you to press a key.

There are 3 fixes for this:
1. Always shut down properly (if you did this you would not be reading this article).
2. Have a keyboard so you can press enter whenever the computer does not get past the boot screen (this requires you to always drag a keyboard along with you, (which might be a good thing)).
3. Change the bootloader settings.
– This will be the focus of this post.

There are 2 ways to make the change in software so that the computer will boot properly and not hang at the bootloader.
1. In /etc/grub.d/00_header find the make_timeout() function.
There is an if statement that checks if recordfail is equal to 1.
This is the area we will need to change. You should change “set timeout” to something greater than 0. The default of “-1” or “${GRUB_RECORDFAIL_TIMEOUT:–1}” means to wait for user input.

For example you can see the set timeout in the function below:

make_timeout ()
{
cat << EOF if [ "\${recordfail}" = 1 ] ; then set timeout=3 # should be greater than 0 else ...

2.The other way is to edit /etc/default/grub.
Add the lines below to set a new timeout :

GRUB_TIMEOUT=3 # should be greater than 0
GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT

After either option you will need to run the command: sudo update-grub2

Enjoy and happy booting!

Liked it? Take a second to support David Kohanbash on Patreon!
Become a patron at Patreon!

Comments

Leave a Reply