3

Im running ubuntu 14.04 with vbox . In this machine I compiled and run kernel 3.14 which I choose from the grub menu when ubuntu load on vbox. The host also run on ubuntu 14.04.

I wanted to ask - is there a way to load the guest ubuntu into specific kernel with a command on shell?

I can start running a vm on vbox trough command line with this command :

VBoxManage startvm ubuservloc --type headless

but its not quite exactly what I need.

nadavgam
  • 2,014
  • 5
  • 20
  • 48

1 Answers1

0

I don't know of any way to directly communicate from the host to the guest's GRUB, but there are several indirect ways you could go:

  1. mount the /boot filesystem from the host and drop a file there that is read by the guest's grub.cfg.
  2. VBoxManage controlvm keyboardputscancode to type a hotkey which is assigned to the correct kernel in GRUB (shortly after starting the VM)
  3. Configure GRUB to listen to a (virtual) serial port and select the kernel by writing to that file

In case a second reboot is acceptable (first boot into default kernel and then reboot into desired kernel) there are also several ways (you can use the grub-set-default command from guest to choose your desired kernel and issue a reboot). Some I can think of here:

  1. VBoxManage guestcontrol run to call a shell script from host in the guest (after guest additions have been loaded)
  2. VBoxManage guestproperty to set a property from host and VBoxControl guestproperty to read it from an init script and decide from there
  3. Just SSH into the guest and reboot from there :D

Obviously, if you always want to boot that kernel, why not make it default? And in case always you want to alternately boot two different kernels, you can also set the default for next boot to another one direclty from grub.cfg.

mihi
  • 6,507
  • 1
  • 38
  • 48