Running VirtualBox in Headless Mode
At work I have ReviewBoard running on VirtualBox on one of my development machines. This has been working great but every once in awhile I accidentally close the VirtualBox console because it’s sitting in my taskbar:
I remember reading about a ‘headless’ mode in the VirtualBox documentation. This will setup VirtualBox running as a RDP server – it can run ‘invisibly’ and you can connect via Windows Remote Desktop to intact with the system.
You can either configure the remote settings within the VirtualBox GUI:
Or pass them in through the command line. I went this route and created a batch file called start-reviewboard.bat:
REM Batch script to start VirtualBox instance of ReviewBoard in headless mode REM Connect via RDP (Remote Desktop Protocol) to port 8000 "C:\Program Files\sun\VirtualBox\VBoxHeadless.exe" -startvm ReviewBoard -p 8000
This starts VirtualBox in headless mode (VBoxHeadless.exe), starts my ReviewBoard vm, and sets up RDP (port 8000).
You can run this script and it should start VirtualBox – but you will still be left with a DOS box sitting there in your taskbar. Turns out it is fairly easy to write a small script to run a batch file silently as well. I created start-reviewboard.vbs:
REM 0 = hide window, 1 = show window (useful for debugging)
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "D:\scripts\start-reviewboard.bat" & Chr(34), 0
Set WshShell = Nothing
You use this script to run your batch file and pass in a parameter to hide the window (0). I’d recommend setting that to 1 while you get things setup so you can see what is going on and once you have worked out the kinks set it to 0.
When you run it – you should get a DOS window and a message “Listening on port 8000” (or whatever you set the port to). I changed the port to 8000 as I assume Windows is already using 3389 (default RDP port).
To connect I simply start Remote Desktop Connection and enter localhost:8000.
To stop VirtualBox simply issue the following command:
VBoxManage controlvm YOUR_VM_NAME poweroff
VirtualBox Virtual Directories Explained (screencast)
February 11, 2010 by Jim · Leave a Comment
For More Information on Shared Folders (Virtual Directories):
ColdFusion 9 on VirtualBox
February 8, 2010 by Jim · 7 Comments
I’ve finally posted my instructions for getting ColdFusion 9 up and running on VirtualBox! It took me a few times to work through the process and get everything working (and documented) and at one point I forgot the password on the VM image and had to start over again. Oooops.
Documentation is now on my wiki: VirtualBox and ColdFusion 9
What will you end up with? A ‘virtual’ server running Apache/ColdFusion 9/MySQL. Using VirtualBox’s shared directories you can access your code on the guest system. This seemed to be the most simple and flexible way to configure things. In my example I’m sharing the CFEclipse workspace directory but if you are using something different it should be easy to adjust to your configuration.
You could certainly run a GUI version of Ubuntu and install an IDE so you would have a self-contained development environment but with this example I wanted to create a system I could use at work and at home for various projects but not necessarily share the code and settings between them.
If you try this and run into any issues with the documentation – please contact me with corrections!
Exporting A VirtualBox Image (To Reduce It’s Size)
December 9, 2009 by Jim · Leave a Comment
I needed to move one of my VirtualBox setups to another computer but the disk image was huge and wouldn’t fit on my thumbdrive. Digging around in the VirtualBox settings I noticed an import/export function.

VirtualBox Export/Import
The original disk image was 4.13GB. Exporting it resulted in two files that totalled 1.75GB! That will easily fit on my 2GB thumbdrive (or Dropbox).
Exporting (and importing) is a straighforward process. Select export – you will be given the opportunity to define some configuration values for your machine, then simply define the export filename. Import is the reverse – select import – location you exported file and proceed. Exporting my 4GB disk took about 25-30 minutes.
Alternate VirtualBox Port Forwarding Method
December 8, 2009 by Jim · Leave a Comment
In my Review Board installation on Virtual Box I gave an example of how you could access your guest OS from the host system using port forwarding. In that example you could access an application (Review Board) running on Apache.
In those instructions you had to enter a series of commands in at the command line. I’ve since discovered an easier way to do this.
Read more
Enable Sendfile Off – Apache Config Headache
November 14, 2009 by Jim · Leave a Comment
I’ve been working on setting up a VM running a LAMP stack along with ColdFusion 9 (which I’ll blog about soon). I’ve got everything up and running and was tinkering around making some updates to our TACFUG site but was running into this weird issue that my CSS would not update – I would make a change and it wouldn’t show up in the browser.
I disabled all my browser cache and tried it in Chrome – same issue. I tried adding a UUID to the CSS call to force the browser to reload.
Then I thought it might be a ColdFusion issue so I spent some time in the Administrator turning all the options on/off (lots of new stuff in CF9!). That didn’t work either.
Finally I pinged Twitter and John Mason helped me figure out that it was actually an Apache issue. His first thought was it was some caching module but looking in mods-enabled I didn’t see anything cache related. We were both searching on Google and found a few posts where people had similar issues and mentioned adding a line to their config file:
Enable Sendfile Off
I have no idea what this does – but I opened up my apache2.conf file, scrolled to the bottom and added it. Restarted Apache and my CSS was now refreshing!
The Apache docs mention that in some circumstances you may need to disable this:
This directive controls whether
httpdmay use the sendfile support from the kernel to transmit file contents to the client. By default, when the handling of a request requires no access to the data within a file — for example, when delivering a static file — Apache uses sendfile to deliver the file contents without ever reading the file if the OS supports it.This sendfile mechanism avoids separate read and send operations, and buffer allocations. But on some platforms or within some filesystems, it is better to disable this feature to avoid operational problems:
- Some platforms may have broken sendfile support that the build system did not detect, especially if the binaries were built on another box and moved to such a machine with broken sendfile support.
- On Linux the use of sendfile triggers TCP-checksum offloading bugs on certain networking cards when using IPv6.
- On Linux on Itanium, sendfile may be unable to handle files over 2GB in size.
- With a network-mounted
DocumentRoot(e.g., NFS or SMB), the kernel may be unable to serve the network file through its own cache.For server configurations that are vulnerable to these problems, you should disable this feature.
So hopefully this will prevent someone from going through the same headaches I did. Now I have to get busy now that everything is working!
Developer Toolbox: VirtualBox
January 14, 2009 by Jim · 5 Comments
Today I was on Twitter and someone mentioned installing Xen and I mentioned VirtualBox. I still don’t think a lot of people know about it yet but they tried it and Twitted (?) me back that they had installed it.
Checking out VirtualBox now. Looks like it might be a little easier to configure.
I used to run VMWare but found the install was a bit of a pain (especially on Linux) and while it was nice I was never really blown away. When I got my GPS and needed to run Windows on my Ubuntu machine I went looking around to see what else was available. I tried QEMU and a few others and finally stumbled upon VirtualBox (which has since been bought by Sun).
While I haven’t tried VMWare in quite awhile VirtualBox has lots of great features which I love:
- Simple install. I’ve installed on both Windows (with a Linux guest) and on Linux (with a Windows guest) and never had any issues.
- There are a host of easily downloable images at the VirtualBox VDI Index. Want to try Ubuntu, Solaris or gOS? Grab and image and run it.
- Easily share folders between the guest and host – this makes moving files to and from my GPS a snap.
- Seamlessly run Windows inside your host OS. You can even do this over RDP – a very cool video of that is available on YouTube.
If you haven’t yet checked out VirtualBox I’d certainly recommend giving it a try.




