Saturday, January 10, 2009

My notes on Virtualbox in Windows xp

I installed Virtualbox 2.1.0 on my Windowz laptop (new office laptop with +3GB the ram) and I will install Debian etch images on it.

The "host" software installation is quite simple and the "guest" installation is straight forward both on Windowz or Debian.

One note, during setup try set the directory where to install the virtualbox images (.vdi files) on a c:\virt_images directory or similar. The reason is that the default is in your %HOMEDRIVE%HOMEPATH%\.VirtualBox\Hardrives directory that works fine but if you try to clone it using the vboxmanage clonehd the name will bring up some errors.

Example:


C:\Program Files\Sun\xVM VirtualBox>vboxmanage clonehd C:\Documents/and/Settings\username\.VirtualBox\HardDisks\debian_1.vdi C:\Documents/and/Settings\username\.VirtualBox\HardDisks\debian_2.vdi
VirtualBox Command Line Management Interface Version 2.1.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

[!] FAILED calling virtualBox->OpenHardDisk2(src, srcDisk.asOutParam()) at line
372!
[!] Primary RC = VBOX_E_IPRT_ERROR (0x80BB0005) - Runtime subsystem error
[!] Full error info present: true , basic error info present: true
[!] Result Code = VBOX_E_IPRT_ERROR (0x80BB0005) - Runtime subsystem error
[!] Text = Could not get the storage format of the hard disk 'C:\Documents\and\Settings\username\.VirtualBox\HardDisks\debian_1.vdi' (VERR_PATH_NOT_FOUND)
[!] Component = HardDisk2, Interface: IHardDisk2, {ed6e2525-c2fd-42a4-917a-7a9045ac9e15}
[!] Callee = IVirtualBox, {339abca2-f47a-4302-87f5-7bc324e6bbde}

C:\Program Files\Sun\xVM VirtualBox>



You can solve this by simple adding "" on the file paths



C:\Program Files\Sun\xVM VirtualBox>vboxmanage clonehd "C:\Documents and Settings\username\.VirtualBox\HardDisks\debian_1.vdi" "C:\Documents and Settings\username\.VirtualBox\HardDisks\debian_2.vdi"
VirtualBox Command Line Management Interface Version 2.1.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: e78ab4e8-5666-4bea-a592-b277265c5b19

C:\Program Files\Sun\xVM VirtualBox>




Moving forward, once Virtualbox is installed you can install Debian as normal on one of the images. It will ask for a name, type (linux, windows, etc), memory amount and hard disk image. As it is a new installation we create a new one.

Debian installation is as normal and you shouldn't have any problem. Note I change the networking settings from "NAT" to "host interface" so I can have an IP from my dhcp server and be able to ssh to the "virtual disk".

Once you have Debian installed you need to install "Virtualbox Guest Additions" on it. This was the tricky part for me, the host box would have an iso that can be mounted "dinamically" by going to the "Devices/Install Guest Addtions" guest window menu and it should mount the iso automatically on /media/cdrom but it my case it didn't work. To solve this I install ssh - apt-get install ssh - and copy the iso image from my windows host to the debian guest.

Next I did a:


apt-get install gcc
apt-get install build-essential module-assistant



Next step is buidling the kernel modules


m-a prepare



Next mount the iso file sftp before to you disk:


debvirt01:~# mount -o loop -t iso9660 /home/ricardo/VBoxGuestAdditions.iso /media/cdrom



And finally run the Virtualbox setup:


debvirt01:~# cd /media/cdrom
debvirt01:/media/cdrom# ls
32Bit VBoxLinuxAdditions-amd64.run VBoxWindowsAdditions-amd64.exe
64Bit VBoxLinuxAdditions-x86.run VBoxWindowsAdditions.exe
AUTORUN.INF VBoxSolarisAdditions.pkg VBoxWindowsAdditions-x86.exe
debvirt01:/media/cdrom# sh /media/cdrom/VBoxLinuxAdditions-x86.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 2.1.0 Guest Additions for Linux installation.......................................................................................................................................................................................................
VirtualBox 2.1.0 Guest Additions installation
Building the VirtualBox Guest Additions kernel module...
Building the shared folder support kernel module...
Installing the VirtualBox Guest Additions...

Could not find X.org or XFree86 on the guest system. The X Window drivers
will not be installed.
debvirt01:/media/cdrom#




Ok, that's it. It should fully work now (The x window drivers message is due the fact I didn't install anything else on my original debian install)

To check the modules are running you can do the following:


debvirt01:~# dmesg | grep vbox
vboxadd: Successfully loaded version 2.1.0 (interface 0x00010004)
vboxvfs: Successfully loaded version 2.1.0 (interface 0x00010004)
debvirt01:~#

user@debvirt01:~$ lsmod
Module Size Used by
vboxvfs 41504 0
vboxadd 62816 2 vboxvfs
user@debvirt01:~$




Last thing, I couldn't boot the the image cloned from the original. Both grub and lilo fails to boot and I don't know who to restore fix it. I am trying to find out how to boot with a rescue disk on the "virtual" box and try to restore grub but couldn't find out how yet. Any notes let me know..

---- out of topic -----

Debian Lenny has packages that helps on the process above but when addng the repository on source.lists and running an apt-get update we get the following error:


debvirt01:/etc/apt# apt-get update
W: GPG error: http://download.virtualbox.org etch Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY DCF9F87B6DFBCBAE
W: You may want to run apt-get update to correct these problems
debvirt01:/etc/apt#




This error is the following: "Those are just letting you know the GPG keys arent saved to the disk. The mastering process for some reason deletes the additional keys.....The problem being the sites change gpg codes constantly.."

To solve it just run the following command:



debvirt01:/etc/apt#
wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc \
-O- | sudo apt-key add -



You will be able to run apt-get update normally and therefore retrieve the necessary virtualbox packages.

Other link with details:

http://johnbokma.com/mexit/2008/11/27/virtualbox-puel-ubuntu.html

Sunday, January 04, 2009

Adding a css to my blog

I noticed that I don't find optimal to find what is commands entry from clear text on my blog so surfing around I found this css entry that I am will start applying whenever I enter a command or code to the page.

On Blogger, on the Layout tab I selected "edit html" and added the following:

/* Added by RB
----------------------------------------------- */

.command{ padding:1em;
border:1px
dashed #2f6fab;
color:black;
background-color:#f9f9f9;
line-height:1.1em;
font-family:Courier New,Courier,mono;
font-size:12px;
font-style:italic
}

Example:

tar -xzvf speex-1.2rc1.tar.gz



:)