Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a dual boot (Ubuntu/Ubuntu) system and have configured GRUB2 to hide the boot menu unless I press the shift key (or another key). Here is my configuration in /etc/default/grub:

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=3
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

However, no matter what I do, or what key I press, or when I press it, it boots up into the default OS choice and I never see the GRUB menu. I always do a sudo update-grub after changing these options.

I've tried extending the hidden timeout to 15 seconds and my system didn't change...its like that value is just not being honored -- the system just boots up right away.

I do have a software RAID 1 configuration, but each drive is mirrored and they both have Grub, so that can't be it.

Any ideas?

share|improve this question
add comment

1 Answer

Change GRUB_TIMEOUT to some value e.g 10, update grub and your problem will be solved. Reboot and Press the Shift key.

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=3
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

refer to Grub2 Files and Options

If this didn't work for you then there is another way to do this which involves changing the /etc/grub.d/30_os-prober file. After backing up the file I did the following steps and it worked fine for me.

So, open terminal and write

sudo gedit /etc/grub.d/30_os-prober

A file will open. Change the following Code:

make_timeout () {
  if [ "x${found_other_os}" = "x" ] ; then
    if [ "x${1}" != "x" ] ; then
      if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
    verbose=
      else
    verbose=" --verbose"
      fi

      if [ "x${1}" = "x0" ] ; then
    cat <<EOF
if [ "x\${timeout}" != "x-1" ]; then
  if keystatus; then
    if keystatus --shift; then
      set timeout=-1
    else
      set timeout=0
    fi
  else
    if sleep$verbose --interruptible 3 ; then
      set timeout=0
    fi
  fi
fi
EOF
      else
    cat << EOF
if [ "x\${timeout}" != "x-1" ]; then
  if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
    set timeout=0
  fi
fi
EOF
      fi
    fi
  fi
}

adjust_timeout () {
  if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
    cat <<EOF
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
EOF
    make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
    echo else
    make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
    echo fi
  else
    make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
  fi
}

Into this:

adjust_timeout () {
        cat <<EOF
        if keystatus --shift; then
          set timeout=-1
        else
          set timeout=0
        fi
EOF
}

And save the file.

After running sudo update-grub shutdown the system.

Now when you start your system again, you'll have to press and hold the shift key immediately after pressing the power button. This will lead you to Grub. If you do not press the shift key, you will be booted into your default operating system automatically. Best of luck!

Note: If anything goes wrong or some unexpected behavior occurs, change the code back to original using the backup file and everything will be back to normal again.

share|improve this answer
    
Doing that just enabled the normal GRUB menu with the countdown specified in GRUB_TIMEOUT. However, I'd like to not see the GRUB menu unless I press a key. –  HDave Jul 20 '12 at 1:05
    
You are right. It should work but because of some reason it neither worked for me. But I have found an alternate method to achieve that. I have improved the answer. Follow the steps and see if it works. –  Laphanga Jul 20 '12 at 3:27
    
@HDave did you get the desired results? –  Laphanga Jul 20 '12 at 9:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.