-fix- Linux and Grub wait forever after a hypervisor ACPI shutdown.

This is a designed-in feature of grub – useful if you’ve got a physical machine in front of you, as the linux box won’t automatically restart if someone kicks the power cable out or hits the off switch – and more importantly it won’t endlessly reboot if there’s a hardware problem, slowly shredding your file systems.

If you’re running Ubuntu as a headless virtual machine in the cloud, it’s not so useful. Disable it like this:

edit /etc/default/grub and add the line:

GRUB_RECORDFAIL_TIMEOUT=3

then sudo update-grub.

Next time you accidentally “sudo ip route flush table all” on your vm and acpi-restart it,¬† it’ll boot properly.

 

 

 

 

Use USB installation media with a Virtualbox VM

So.
You want to create a Windows 7 virtual machine, on virtualbox, on your Mac.
Don’t ask why. The answer might include Visual Studio.
You have a sysprep’d Windows 7 USB drive full of installation extras, custom wim files… But the virtualbox GUI gives you no “boot from USB” option.

The workaround: Create a “stub” virtual disk file somewhere Virtualbox can read it that references the USB drive as a “raw” disk.

First, see what OSX thinks USB drive is called:
:~ username$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1000.1 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS osx 999.7 GB disk0s2
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: NO NAME *26.0 MB disk1
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *8.1 GB disk2

/dev/disk2

then create the vmdk:

VBoxManage internalcommands createrawvmdk -filename ~/test_usb_stub_disk2.vmdk -rawdisk /dev/disk2

Now attach the new stub disk to the same disk controller as the virtual machine’s main hard drive, using the next¬†available SATA port (SATA Port 1 assuming the main drive is on SATA port 0 – if you don’t do this, removing your flash drive will make your VM unbootable and annoying to fix):

Screen shot 2013-07-10 at 18.37.49

…then start the virtual machine, clicking its pre-boot window immediately and using Function+F12 to open the boot menu which will give show you the virtual USB drive.

You should see the usual Windows installation prompts…

“Next >>”.