Wednesday, December 30, 2009

Creating a VirtualBox Virtual Machine Using CrunchBang Linux

This tutorial assumes that you already have VirtualBox installed and that you have a CrunchBang Linux ISO downloaded.  You may choose a 32-bit or 64-bit version of CrunchBang depending if your target system supports a 64-bit system.

In VirtualBox:

1. Click on "New..."

2. VM Name and OS Type
  a) Enter a name for your new virtual machine
  b) Select an operating system.  In this case, select "Linux" and for the version select "Other Linux"
  c) Click "Next"

3. Memory
  a) Choose the amount of memory. The default is 256MB of memory.  Depending on the what you are going to do with the virtual machine you may need more memory.
  b) Click "Next"

4. Virtual Hard Disk
  a) You'll need to create a new hard disk for this virtual image.  Don't worry! You're not going to delete the contents of your current hard drive but create a virtual disk for your new virtual machine to use.
  b) Click "Next" and the New Virtual Disk Wizard will appear.

4a. Virtual Hard Disk Wizard
  a) Click "Next" on the welcome screen.
  b) I prefer a "dynamically expanding storage" type of hard disk so it doesn't eat up all the allocated space right away (i.e. the size of the "virtual" hard disk grows as you put things on it in your virtual machine).
  c) Click "Next"
  d) Select a location to put the virtual hard disk file.  Yes, the virtual disk is just a file on your host hard drive. I used the default 8GB size.  You may want to make it bigger depending on what you are going to do with the virtual machine.
  e) Click "Next"

5. Summary
  a).  Now you ready to create the virtual machine so click "Finish" to continue.

6. Start your new virtual machine.

Inside the Virtual Machine:

1. Since this is the first time you're starting your new virtual machine.  You'll need to mount the CrunchBang ISO as the CD-ROM so you can install the OS in your new virtual machine.  Select the "live" option when the machine boots into the ISO start menu.

N.B.  Once VirtualBox takes focus of your keyboard and mouse inside of your virtual machine you might be wondering how you can defocus the keyboard and mouse so you can use programs in your host OS.  The default option to deactivate focus is to simply press the right CTRL key on your keyboard.  The deactivate shortcut key in noted in on the bottom right on the virtual machine window.

2. Right click on the desktop or press super+space (super key is the "Windows" key) to get the CrunchBang menu.  Select "Install CrunchBang".  Follow the options for timezone, language, etc.  You'll be prompted on the hard drive to install CrunchBang.  When you setup the administrator user name and password make note of what you selected as you'll need this information later.  Also, the default option (and only option) to install CrunchBang should be virtual drive you created.  After it has finished installing, be sure to reboot.

3. Press super+u to do a system update.  We'll want to be sure that the OS is up to date.  You'll be prompted for the administrator user password that you created when you installed CrunchBang.  Follow the prompts on the screen.

4.  At this point, you'll only have maximum screen resolutions of 800x600 in CrunchBang.  In order to increase this, we'll need to install the VirtualBox Guest Additions.  We'll need to install the GNU C Compiler first in order to accomplish this.
  a) Go to the CrunchBang menu (super+space) -> System -> Package Manager.  You'll be prompted for the password of the administration user and since this is the first time that the Package Manager has been run, it will take a few moments to build an index of packages.
  b) Type "gcc" (without the quotes) into the Quick Search box.  Find "The GNU C Compiler" in the list and click on the checkbox on that line.  Select "Mark for Installation".  Click "Apply" at the top of the Package Manager and follow the prompts to install the package.
  c) Quit the Package Manager.

5. Now, at the top of the virtual machine goto Devices -> Install Guest Additions...  Unless you've downloaded the Guest Additions ISO follow the prompts to have VirtualBox download the ISO for you.  At the end, mount that ISO to the virtual machine's CD-ROM.  VirtualBox should ask if you want to mount the ISO to the CD-ROM for you.

6. Back in CrunchBang, press super+f to bring up the file manager.  We need root privileges to install the Guest Additions so goto the Tools menu -> Open Current Folder as Root.  You'll be prompted again for the root password.  Then navigate to the CD-ROM/DVD-ROM Drive (you should see it listed on the left side.  Run the "" package.  After it finishes compiling and installing the Guest Additions then reboot the virtual machine (super+space -> Exit - Reboot).

7.  Once you've rebooted, you'll probably have higher screen resolutions automatically.  However, if you want to change them just use GrandR or LXrandR (super+space -> System -> Display Settings) to change the screen resolution.

Congratulations! You have a new CrunchBang virtual machine!


  1. Thanx alot! Info about screen resolution really helped!

  2. Thanks a lot too!

    I would like to make you a question: my laptop has a resolution of 1366x768. grandr only offers a resolution of 1024x768 after vbox addons. I have tried to change to max resolution with % xrandr --fb 1366x768 and with % xrandr --fbmm 1024x768, but without results

    any hint would be really appreciated

  3. I have learned how to use xrandr in order to achieve any desired resolution for a vbox0 display. If you want to include it in this post, just drop me a line

  4. The VirtualBox Guest Additions were included in my install of VirtualBox (4.0.10), so "Install Guest Additions..." just forced the VM to mount the ISO.

    However, the script I had to run was called "", and it wasn't executable by itself (even as root). I had to run it as:


    Just an fyi for the other crunchbangers out there.

  5. doug v, thanks a lot for that - it did the trick for me

  6. Thanks op and especially doug v, this was exactly what I needed.