Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have several ubuntu guests inside a Mac OS X virtualbox host. When I start them, about half of the time they correctly boot and get to their login screens/start all their services. The other half of the time, they sit waiting for me to choose an OS. This is fine when I'm sitting in front of them, but I'd like the VMs to automatically boot when the machine starts.

It's worth noting that the same problem doesn't seem to happen if I do a reboot from within the guest OS.

What I've tried:

I've tried uncommenting GRUB_HIDDEN_TIMEOUT and running update-grub, this makes the guest OS boot correctly more often, but doesn't fix the problem. Booting them headlessly doesn't help either.

Where they get stuck:

what I see about half the time

/etc/default/grub:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

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

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

Versions:

Grub 1.99-21ubuntu3.9
Ubuntu Server LTS
Virtualbox 4.2.10
share|improve this question
    
Comment out the init tune and try again. –  schaiba Mar 20 '13 at 21:50
    
I changed that, re-ran update-grub, and same problem. –  Nick ODell Mar 20 '13 at 22:07

4 Answers 4

up vote 2 down vote accepted

So, it turns out this is a documented feature of grub. If your computer shuts down abnormally, it won't boot into an OS automatically. This is why the problem never happened when I rebooted from within the OS.

How to disable

Just in case that link goes dead:

Disable Grub2's recordfail feature

For most people, this new feature of Grub 2 is certainly a good thing. But for those plagued by one of the bugs or who would like to disable it for other reasons:

Open the file /etc/grub.d/00_header via

sudo nano /etc/grub.d/00_header

Look for

if [ ${recordfail} = 1 ]; then
    set timeout=-1
else
    set timeout=${GRUB_TIMEOUT}
fi

Change it to

set timeout=5

Save the file and run

sudo update-grub
share|improve this answer
    
You should shutdown properly your VM's instead ;). –  Braiam Oct 23 '13 at 16:40

To expand on @nick's answer, this is indeed the record failure feature.

However, rather than modifying /etc/grub.d/00_header, you can add the follwing line to /etc/default/grub

GRUB_RECORDFAIL_TIMEOUT=2

(Or however long you want the timeout to be) and then run sudo update-grub

share|improve this answer
    
Thank you. works like charm. –  risyasin Sep 8 at 6:51

Have you tried modifying /boot/grub/menu.lst and setting timeout to 0?

share|improve this answer
    
Nope. I don't have that file on my system. –  Nick ODell Mar 20 '13 at 23:04
    
@NickODell It's probably /boot/grub/grub.conf –  Michael Mrozek Mar 21 '13 at 3:17
    
@MichaelMrozek I don't have that file either. EDIT: I do, however, have grub.cfg –  Nick ODell Mar 25 '13 at 20:30

What you need is to set GRUB_TIMEOUT to zero in /etc/default/grub. For more information run: info -f grub -n "Simple configuration"

vi /etc/default/grub

set GRUB_TIMEOUT=0

sudo update-grub

and now reboot

share|improve this answer
    
I've solved this already. Turns out the problem was grub's recordfail feature. –  Nick ODell Oct 23 '13 at 19:38

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.