Archive

Posts Tagged ‘virtualbox’

Linux host, Windows guest, shared Dropbox folder

February 16, 2014 Leave a comment

Problem
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?

Solution
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 (http://www.maketecheasier.com/share-files-in-virtualbox-between-vista-guest-ubuntu-host) 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

Problem
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?

Solution
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 https://www.virtualbox.org/ 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 http://www.vagrantup.com/downloads 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 http://files.vagrantup.com/precise32.box
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: 127.0.0.1, 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

vagrant

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

Problem
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?

Solution
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

Problem
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?

Solution
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 :(

FeBc6

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

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: 192.168.56.1
    • IPv4 Network Mask: 255.255.255.0
  • DHCP server:
    • Enable server: checked
    • Server Address: 192.168.56.100
    • Server Mask: 255.255.255.0
    • Lower Address Bound: 192.168.56.101
    • Upper Address Bound: 192.168.56.254

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

Problem
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?

Solution

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.

Problem
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?

Solution
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: ,
Follow

Get every new post delivered to your Inbox.

Join 72 other followers