Posts Tagged ‘virtualbox’

Linux host, Windows guest, shared Dropbox folder

February 16, 2014 Leave a comment

My primary operating system is Linux but since I need to work with Powerpoint too, I installed Windows 7 in VirtualBox. Under Windows I prepare my presentations but I want them synchronized on all my machines. For the synchronization I was using Dropbox.

I had Dropbox on Linux (host machine) and on Windows (guest machine) too. When I edited a file under Windows, Dropbox synced it to the Linux host too (the Windows client uploads it to the cloud; the Linux client downloads it from the cloud). It worked fine, though it was not not optimal. If I didn’t use the Windows guest for a long time, then after a boot I had to wait some time till Dropbox synced everything and I could start working only after that.

However, something happened to the Windows Dropbox client recently. Maybe it’s a bug, I don’t know, but the Dropbox client in my Windows guest became terribly slow. It keeps syncing but it doesn’t upload the changes, or I need to wait an hour or so to upload a file 1 MB of size. This is ridiculous and unacceptable. Note that I dind’t experience similar issues with the Linux client.

How to have a synchronized folder between a Linux host and a Windows guest without a Dropbox client on the guest?

First I made sure that my Dropbox folders were synced between the host and the guest. After this I uninstalled Dropbox on Windows and removed the C:\Dropbox folder entirely. Since it was synced with the Linux host, I had an exact copy of the Dropbox folder on Linux. Then shut down the Windows guest.

Here ( you can find an excellent post on how to set up a shared folder between a Linux host and a Windows guest. On the Linux host I shared my Dropbox folder ($HOME/Dropbox) that appears now as a new drive in the Windows guest (G:\ in my case). Now, if I modify something under Windows, it will be visible immediately in the Linux file system that the Dropbox client on Linux will notice and sync.

With this I could solve two problems. First, when I boot up the Windows guest, I don’t need to wait for the Dropbox client to sync. Second, if I change something under Windows, it is still synced to the Dropbox cloud, though I have no Dropbox client on Windows anymore.

Installing Vagrant on Windows

January 15, 2014 Leave a comment

You have a Windows machine and you want to use Linux (e.g. Ubuntu) in it. That is, you want to install an Ubuntu VM (virtual machine) inside Windows. You want to use the command line only, thus you don’t need any graphical interface. Maybe you have a weak laptop where a graphical VM wouldn’t even run normally. In addition, you want to get it done quickly, you have no time to download an Ubuntu image and go through the installation process. What to do?

Use Vagrant. Vagrant is a tool for building complete development environments. We will use Vagrant with VirtualBox, so we need to install both.

Install VirtualBox
Visit and select Downloads on the left side. Download and install the latest version for Windows hosts. You can also install the Extension Pack. Make sure to install the version that matches with the previously installed VirtualBox version. We won’t work with VirtualBox directly, but Vagrant is built on top of it, so Vagrant will need it.

Install Vagrant
Visit and install the Windows version. For the curious, Vagrant is written in Ruby. It is very likely that you will have to restart your computer after the installation. After the restart, you can use the command “vagrant” in the shell, it is added to the PATH by the installer.

Basic usage of Vagrant
As indicated in the official guide, using vagrant is very easy.

I suggest that you should create a dedicated directory for your first Ubuntu VM, C:\vagrant for instance. Enter this directory, open a terminal (with the command “cmd“) and execute the following commands:

c:\vagrant> vagrant init precise32
c:\vagrant> vagrant up

The first command downloads a basic Ubuntu 12.04 LTS image. The second command starts the VM.

Now it’s time to log in to the running VM:

c:\vagrant> vagrant ssh    # there is a chance that it won't work...

Well, if it doesn’t work for you under Windows, here is alternative solution: use Putty. Details: hostname:, port: 2222, username: vagrant, password: vagrant.

Some other useful commands:

c:\vagrant> vagrant status  # Is the VM running?
c:\vagrant> vagrant halt    # stop the VM; counterpart of "vagrant up"

Use Bash as your shell
The default Windows shell “cmd” is quite lame. If you want to use a better shell, install the Cygwin environment, which is a Unix compatibility layer for Windows. It’s enough to install the default packages, but don’t forget to add the “openssh” package too. In my case, I installed the 64-bit version and added the “c:\cygwin64\bin” directory to my PATH. After this you can launch the command “bash” and execute these commands:

$ cd /cygdrive/c/vagrant
$ vagrant status    # Is it running?
$ vagrant up        # if it was not running
$ vagrant ssh       # thanks to the openssh package, it works now
...                 # work with the VM
$ vagrant halt      # stop it if you don't need it anymore

Using Vagrant under Linux


Create and start VirtualBox VM from command-line

September 28, 2013 Leave a comment
Categories: ubuntu Tags:

Ubuntu: disable Alt to launch HUD

September 26, 2013 Leave a comment

In Ubuntu (with Unity), Alt launches the HUD. Fine. However, if you have a Windows in VirtualBox and you want to switch windows in the guest VM with Alt+TAB, that damn HUD always appears in the host. How to disable it?

I found the solution here.

In short: top right corner, System settings… -> Keyboard -> Shortcuts tab -> Launchers. Assign a new key to “Key to show the HUD“, or disable it completely by pressing the Backspace.

Categories: ubuntu, windows Tags: , , , ,

VirtualBox: accessing the guest from the host

September 23, 2013 Leave a comment

In a VirtualBox guest machine I wanted to set up a web server for testing purposes. How to access the guest’s web server from the host?

In the guest’s network settings, normally you already have a NAT network adapter. This way the guest can access the Internet.

But how to establish a network communication between the host and the guest? In the guest’s network settings, select the tab “Adapter 2″. At home “Bridged Adapter” worked for me.

However, at my workplace “Bridged Adapter” didn’t work. After some research I wanted to try “Host-only Adapter”, but I ran into a difficulty. I couldn’t add a host-only adapter, I got the following error message: “no host-only network adapter selected”. And the GUI didn’t offer anything in the dropdown list :(


Fortunately I found the solution here. The image above was also borrowed from

For future references, I quote the steps here:

Probably, the virtual host-only network wasn’t set up yet. Here’s is how you can fix this:

  1. From the main menu, select File > Preferences (Ctrl+G) – NOT the settings of a single vm
  2. Select Network in the list on the left
  3. You should see an empty white box with “Host-only Networks” at the top. On the right, there are three buttons to manage them. Click the topmost one (with a green plus symbol). A new Host-only network will be created and added to the list.

Normally, the settings of the new network will be ok, but for completeness, I give the default values here. You can access the settings for the host-only network through the screwdriver button on the right.

  • Adapter:
    • IPv4 address:
    • IPv4 Network Mask:
  • DHCP server:
    • Enable server: checked
    • Server Address:
    • Server Mask:
    • Lower Address Bound:
    • Upper Address Bound:

You can change these settings to your liking, as long as they’re consistent.

Thanks to Bert Van Vreckem for this great answer.

Guest’s IP address
Executing “ifconfig” in the guest, you’ll get its IP address. Mine is under “eth1″, next to “inet addr:”. Try to ping the guest from the host and vice versa. They should work :)

Categories: network Tags: , , ,

Start a VirtualBox operating system from the command line

November 9, 2012 Leave a comment

Under Linux I have a Windows 7 system in VirtualBox that I mainly use for Powerpoint. I have some more virtual operating systems too but I almost always launch Windows 7 only. Starting the GUI and clicking on the “Show” button to launch it quickly became a pain in the ass. How to launch my Windows 7 from the command line?


jabba@montreal:~$ VBoxManage list vms
"Windows 7 (old Office XP)" {80ce13dd-8a59-4d0a-94b5-9d8fa1130c62}
"Ubuntu 12.04" {e76ac634-1b73-42fc-85c0-f4f700edbe14}
"Office 2007" {43553e05-55b1-4095-8b66-8dcda275d9e2}
"Ubuntu 12.10 beta" {a22a2b9b-7a64-4345-8fb2-26d766989773}

jabba@montreal:~$ VBoxManage startvm "Office 2007"

I put it in a shell script called “office2007″. Done.

More info

Increase the size of a Virtualbox hard drive (.vdi)

August 3, 2012 Leave a comment

The following entry is based on this post.

I have a Linux host with a Windows 7 guest. The hard disk of the Windows guest was set to 30 GB but it got full. How could I extend its size to 40 GB for instance?

Locate the .vdi file of the virtual system. To be safe, make a backup copy of it. After that you can increase its size:

sudo VBoxManage modifyhd Windows7.vdi --resize 40000

Here Windows7.vdi is the name of my .vdi file and 40000 is given in megabytes, which is roughly 40 GB.

Now, if you boot the system and you verify the size of the C: drive, it will still be the old value. The increased size appears as a new unformatted and unused partition. You can join it with the C: partition the following way:

Go to the Control Panel, then System and Security, then Administrative Tools. Here you will see an icon called Computer Management. Start it. Choose Disk Management on the left side. Right click on drive C: and choose “extend volume“. It will be extended in a second. Done.

Update (20140427)
You can also start the Disk Management tool with the command diskmgmt.msc .

Categories: windows Tags: ,

USB drive not mounted in Virtualbox guest

April 24, 2012 1 comment

I have a Linux host with a Windows 7 guest in Virtualbox. I want to transfer some big files to the Windows guest via a USB stick but the Windows guest doesn’t see the attached USB stick. What to do?

I didn’t find a proper solution but I have a workaround. In Virtualbox, before booting up the guest system, you can specify a CD/DVD image under Settings -> Storage (see this figure). This image will be mounted and will be visible in the guest.

So, collect the stuff you want to transfer in a directory, convert the folder to ISO image format and mount this image file before booting up the Windows guest. Works for me :)

Another solution is to set up a shared folder but I haven’t figured out yet how to do that.

Virtualbox shared folder: Ubuntu host, Windows 7 guest

April 6, 2012 Leave a comment

See Although it explains Vista, it works the same way with Windows 7.

Categories: ubuntu, windows Tags: ,

Create a shared folder in Virtualbox

March 22, 2012 Leave a comment

You have a guest operating system in Virtualbox and you want to exchange some data between the host and the guest. For this purpose you want to use a shared folder. The shared folder should be writeable in the guest too.

In my case I had two Ubuntu systems as host and guest.

There are several guides for setting up a shared folder (one, two). In short:

  • create a shared folder on the host (e.g. /opt/shared.folder.vbox)
  • create a shared folder on the guest (it can have the same path, e.g. /opt/shared.folder.vbox)
  • install guest additions under the guest (Devices -> Install Guest Additions…), then restart the guest
  • under the guest, go to Devices -> Shared Folders… Under Shared Folders, add the path of your shared folder (here /opt/shared.folder.vbox). You can tick Auto-mount and Make Permanent if you want. Note that in my case, although I selected these two options, the shared folder was not mounted automatically.

Make the shared folder writeable
On the guest, you can manually mount the shared folder with the following command:

sudo mount -t vboxsf shared.folder.vbox /opt/shared.folder.vbox

As I figured out, only root can mount a shared folder.

However, it mounts the folder in read-only mode! To make it writeable, I had to add the following line(s) to /etc/fstab under the guest:

# shared folder
shared.folder.vbox /opt/shared.folder.vbox vboxsf defaults,rw,auto,uid=1000,gid=1000 0 0

I use the system as a normal user called jabba, and 1000 is its user id and group id. It can be found in /etc/passwd (columns 3 and 4):

$ cat /etc/passwd | grep jabba
jabba:x:1000:1000:Jabba Laci,,,:/home/jabba:/bin/bash

After a reboot, this folder is still not auto-mounted :( You can mount it with:

sudo mount /opt/shared.folder.vbox

But now it should be writeable…

Auto-mount shared folder at each boot
Now let’s put the dot on the “i” :) If you want your shared folder auto-mounted at each boot, add this line to /etc/rc.local on the guest:

mount /opt/shared.folder.vbox

Make sure that it comes before the line “exit 0“.


Get every new post delivered to your Inbox.

Join 71 other followers