EzDevInfo.com

virtualbox interview questions

Top virtualbox frequently asked interview questions

Benchmark: VMware vs Virtualbox [closed]

I tested VirtualBox 2.1.4 and VMware Workstation 6.5.1 for later use as a development VM

Host: Ubuntu64, 4GB RAM, Core2Duo E6600, Samsung HD502IJ
Guest: Windows XP Home, 1GB RAM, 8GB virtual disk
Benchmark Software: SiSoft Sandra Light, HD Tune


What is your experience or suggestion for a VM mostly used for development tools (not as a headless server)?


Source: (StackOverflow)

How do I associate a Vagrant project directory with an existing VirtualBox VM?

Somehow my Vagrant project has disassociated itself from its VirtualBox VM, so that when I vagrant up Vagrant will import the base-box and create a new virtual machine.

Is there a way to re-associate the Vagrant project with the existing VM? How does Vagrant internally associate a Vagrantfile with a VirtualBox VM directory?


Source: (StackOverflow)

Advertisements

Migrating from VMWARE to VirtualBox [closed]

I'm trying to migrate an existing VM from VMWARE to VirtualBox. I've made a copy of the Virtual Machine folder for the VM (so I can experiment and not destroy the original) and have successfully created a VM in VirtualBox. I've got everything booting and running, but the issue is that VM is using the "flat" disk image instead of the correct disk image causing the disk image to be from the past (I know this because all the files on the machine have a timestamp of 2009).

To elaborate, in the VM's folder i have the following vmdk files:

Win2003.vmdk (1 K)
Win2003-flat.vmdk (15 gigs)
Win2003-000002.vmdk (10 gigs)

NOTE: the disk is dynamic.

Looking in the configuration of the VM under VMWARE, it says that it's using the win2003-000002.vmdk as the disk image.

When I import the disk image into VirtualBox (the Win2003.vmdk file), it uses the Win2003-flat.vmdk disk image.

My question is, what can I do to either combine or import the Win2003-000002.vmdk disk image into the Win2003-flat.vmdk disk image so that VirtualBox will use the correct disk image?

I've some instructions on using vmware-vdiskmanager.exe to accomplish this, but I get an error stating "The parent of this virtual disk could not be opened."


Source: (StackOverflow)

How to change Vagrant 'default' machine name?

Where does the name 'default' come from when launching a vagrant box?

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...

Is there a way to set this?


Source: (StackOverflow)

USB devices are not recognized in Virtualbox (Linux host) [closed]

I tried to use USB devices without any success. It seems they are not detected by Virtualbox itself, since if I select the guest from the Virtualbox home (I'm using a Windows XP 3 guest), choose Settings -> USB -> Add filter from device, no devices is listed, even if an USB pen is attached and recognized by my Lubuntu 13.10. If i run the guest, nothing happens if I attach the device and, as above, no USB device is detected in Devices -> USB devices

I installed the Extensions pack and the Guest additions, so it should work. Please help! I'm using Virtualbox 4.2.16.


Source: (StackOverflow)

Switch android x86 screen resolution

I would like to use Android-x86 2.2 as an emulator on my Windows 7. I have downloaded VirtualBox and the ISO, and I've made a virtual machine with it, but I can't set the resolution to 320x480 or something similar.

The following tutorial "Using the Android-x86 Port as your Emulator" suggests to insert:

<ExtraDataItem name="CustomVideoMode2" value="320x480x16" />

to my .vbox file and I did it. Then I added UVESA_MODE=320x480 and vga=ask to the boot config. When it boots, I have to press Enter to see the available options, but there is no 320x480 among them. How can I get it to work?


Source: (StackOverflow)

Vagrant/VirtualBox/Apache2 Strange Cache Behaviour

I'm using Vagrant to run an Ubuntu powered VirtualBox with Apache2.

The webserver, among others, serves static files from my /vagrant directory.

This works well most of the time. But when I change an image on my shared folder and reload the website, the previous version of the image is served, but it's truncated.

It works if I delete the old picture first from my shared folder, refresh the website so the picture is NOT shown, then save the new file and reload the website again.

Does anyone knew about this problem? I don't have anything special installed, just Apache 2 with mod_rewrite and PHP with Mongo, APC Plugin, MongoDB as well as nodeJS with a bunch of scripts.


Source: (StackOverflow)

Detect virtualized OS from an application?

I need to detect whether my application is running within a virtualized OS instance or not.

I've found an article with some useful information on the topic. The same article appears in multiple places, I'm unsure of the original source. VMware implements a particular invalid x86 instruction to return information about itself, while VirtualPC uses a magic number and I/O port with an IN instruction.

This is workable, but appears to be undocumented behavior in both cases. I suppose a future release of VMWare or VirtualPC might change the mechanism. Is there a better way? Is there a supported mechanism for either product?

Similarly, is there a way to detect Xen or VirtualBox?

I'm not concerned about cases where the platform is deliberately trying to hide itself. For example, honeypots use virtualization but sometimes obscure the mechanisms that malware would use to detect it. I don't care that my app would think it is not virtualized in these honeypots, I'm just looking for a "best effort" solution.

The application is mostly Java, though I'm expecting to use native code plus JNI for this particular function. Windows XP/Vista support is most important, though the mechanisms described in the referenced article are generic features of x86 and don't rely on any particular OS facility.


Source: (StackOverflow)

How to change UUID in virtual box

I am trying to create a new VM in virtual box using an already-existing hard disk, but when I try to select the existing hard disk file (a .vhd file), it displays an error that the virtual hard disk cannot be used because the UUID already exists.

So I tried the command:

VBoxManage internalcommands sethduuid /home/user/VirtualBox VMs/drupal/drupal.vhd

to change the UUID for .vhd file. But then I get this error:

sethduuid <filepath> [<uuid>]
       Assigns a new UUID to the given image file. This way, multiple copies
       of a container can be registered.

WARNING: This is a development tool and shall only be used to analyse
         problems. It is completely unsupported and will change in
         incompatible ways without warning.

Syntax error: Invalid UUID parameter

How can i resolve this?


Source: (StackOverflow)

Genymotion does not start Android virtual device

How to resolve Genymotion/VirtualBox issue, when can't start Android virtual device?

Bellow message is received:

Unable to start the Genymotion virtual device.

The VirtualBox software returned an error: "incompatible state".

Please, run the VirtualBox software to check for issues. Then, try to run the Genymotion virtual device directly from VirtualBox to have a possible explanation.

For more information refer to: https://cloud.genymotion.com/page/faq/#vbox

Unable to start the Genymotion virtual device - "incompatible state"


Source: (StackOverflow)

How can I easily add storage to a VirtualBox machine with XP installed?

When I installed Windows XP on a VirtualBox machine, I made the hard drive only 10 GB since and assumed it would expand in size (as do hard drives in VMWare as far as I can remember, isn't this true?).

In any case, I'm trying to install Visual Studio 2010 beta on this Virtual Box XP image and it has run out of disk space.

Googling for an answer, I'm finding complicated tutorials like this which show you how to increase the size of a VirtualBox hard drive "in just a couple hours".

But I can't imagine it would be that hard to either:

  • increase the size of a virtual disk (after all, it is virtual)
  • create a new hard drive of, say, 20 GB and just attach it in the virtual machine as the D: or E: drive

How can I easily add storage space to a VirtualBox machine with XP installed?


Source: (StackOverflow)

Vagrant ssh authentication failure

The problem with ssh authentication:

==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: bridged
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Authentication failure. Retrying...
    default: Error: Authentication failure. Retrying...
    default: Error: Authentication failure. Retrying...
    default: Error: Authentication failure. Retrying...
    default: Error: Authentication failure. Retrying...

I can Ctrl+C out of the authentication loop and then successfully ssh in manually.

I performed the following steps on the guest box:

  • Enabled Remote Login for All Users.

  • Created the ~/.ssh directory with 0700 permissions.

  • Created the ~/.ssh/authorized_keys file with 0600 permissions.

  • Pasted this public key into ~/.ssh/authorized_keys

I've also tried using a private (hostonly) network instead of the public (bridged) network, using this line in the Vagrantfile:

config.vm.network "private_network", ip: "172.16.177.7"

I get the same output (except Adapter 2: hostonly) but then cannot ssh in manually.

I also tried config.vm.network "private_network", ip: "10.0.0.100".

I also tried setting config.ssh.password in the Vagrantfile. This does output SSH auth method: password but still doesn't authenticate.

And I also tried rebuilding the box and rechecking all the above.

It looks like others have had success with this configuration, so there must be something I'm doing wrong.

I found this thread and enabled the GUI, but that doesn't help.


Source: (StackOverflow)

How to export a Vagrant virtual machine to transfer it

I have a vagrant box up and running (configured with a LAMP stack). I need to transfer it to another PC. How can I export it? I guess that I can get a file (or files) that can be copied to another PC, so there I can run some command to import the vagrant box.


Source: (StackOverflow)

What exactly do the Vagrant commands do?

There is surprisingly no documentation on what the Vagrant commands do, other than references throughout the "getting started" tutorial.

What I've worked out so far:

  • box - manage "boxes"
  • destroy - shut down the VM then delete its stored image?
  • gem
  • halt - shut down the VM
  • init - prepare a directory with a new Vagrantfile
  • package - shut down the VM, then convert it to a 'package' which can be turned into a box? (Or something)
  • provision - run just the provisioning (eg, Chef, Puppet...) stage
  • reload - modify the VM configuration (eg, reapply Vagrantfile), reboot the VM, reprovision
  • resume - un-suspend (ie, unhibernate)
  • ssh - open an SSH shell connection to the VM
  • ssh-config
  • status
  • suspend - hibernate the VM
  • up - some or all of: copy a VM image to create a new VM, apply configuration to it, boot it

Do I have these right? What are the others? I'm still a bit unclear on the exact difference between reload and destroy/up.


Source: (StackOverflow)

Using vagrant to run virtual machines with desktop environment

My company's development environment is based on virtual machines, running on virtualbox. We would like to move one step further, and use the capabilities of Vagrant to have the description of the machine in a text file and then be able to "raise" that machine based on that text file. Combined to puppet, this would solve us the problem that everyone have different software versions installed in the VM.

However, Vagrant seems very focused to develop on the host, letting the machine in the background. We would need to have our development environment within the machine, so we would need a complete GUI, so when typing "vagrant up" a machine with a complete desktop environment (XFCE, KDE...) should appear.

So far, I've managed to create a "base" box from a Xubuntu distribution. But when I type "vagrant up", although the desktop appears, and I am able to login properly, Vagrant freezes at the message "Waiting for machine to boot. This may take a few minutes...". After a while Vagrant crashes due timeout. So shared folders are not created, nor the package provisioner -puppet- is executed.

Anyone knows how to create a virtual machine with a complete GUI using vagrant? Many thanks in advance.


Source: (StackOverflow)