My Ubuntu had always a timeout of 30 seconds either I would have set a value or not. Here after is how I have found out that recordfail was the missing value.
1. Verify the actual grub script /boot/grub/grub.cfg
IMHO, the best way to verify what Grub will do, is to open /boot/grub/grub.cfg
. It is the script automatically generated by grub-mkconfig
using templates from /etc/grub.d
and settings from /etc/default/grub
.
Around the line 109, you will see see something like:
108 if [ "${recordfail}" = 1 ] ; then
109 set timeout=30 # Note here this value
110 else
111 if [ x$feature_timeout_style = xy ] ; then
112 set timeout_style=hidden
113 set timeout=3
114 # Fallback hidden-timeout code in case the timeout_style feature is
115 # unavailable.
116 elif sleep --interruptible 3 ; then
117 set timeout=0
118 fi
119 fi
In my case with the help of that generated script, I could find out that the recordfail
variable was unset.
2. If the recordfail
variable is unset, set it
Open /etc/default/grub
in your favourite text editor (e.g. vim) and then set the variable GRUB_RECORDFAIL_TIMEOUT
to a given value, for example 5 seconds.
Your config file should look like:
GRUB_DEFAULT=0
GRUB_TIMEOUT=3
GRUB_TIMEOUT_STYLE=hidden
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_RECORDFAIL_TIMEOUT=5
3. Update the configuration to run with update-grub
Last step, update the configuration to run with update-grub
. For now on, GRUB2 will use the set timeout. This command will regenerate the /boot/grub.cfg
file.
4. Verify the generated script result
Again, open /boot/grub.cfg
and check the result around the line 109:
108 if [ "${recordfail}" = 1 ] ; then
109 set timeout=5 # Note here this value
110 else
111 if [ x$feature_timeout_style = xy ] ; then
112 set timeout_style=hidden
113 set timeout=3
114 # Fallback hidden-timeout code in case the timeout_style feature is
115 # unavailable.
116 elif sleep --interruptible 3 ; then
117 set timeout=0
118 fi
119 fi
Note that the value at line 109 is now 5 instead of 30 as before.
sudo update-grub
andsudo update-grub2
runs the same command. So, don't worry about that part. – saji89 Oct 18 '12 at 06:01cat /boot/grub/grub.cfg
via pastebin and share the link here. This is to see the actualgrub.cfg
generated. – saji89 Oct 18 '12 at 06:03