My ongoing experiences with Ubuntu, and later Mythbuntu, as a media center with MythTV. I'm also using the system for a virtual machine server, a mediawiki server and a general all around home infrastructure base.

Showing posts with label virtualbox. Show all posts
Showing posts with label virtualbox. Show all posts

Sunday, November 29, 2009

Virtualbox USB devices greyed out

Running WinXP inside of VirtualBox and wanting to re-program my Harmony Remote, but all the USB devices were grey out. I followed these directions to fix.

First I added myself to vboxusers group:
# grep vbox /etc/group
vboxusers:x:128:
# usermod -G vboxusers -a von
In order to get this group change to take effect in my login session, I had to logout and back in again.

Then I edited /etc/fstab to add /proc/bus/usb. I had an old entry I had to comment out.
# vi /etc/fstab
# tail -2 /etc/fstab
#/dev/bus/usb /proc/bus/usb usbfs auto 0 0
none /proc/bus/usb usbfs devgid=128,devmod=644 0 0
I had to unmount the old /proc/bus/usb and then remount it:
# umount /proc/bus/usb
# mount -a
At this point I restarted VirtualBox and was able to mount USB devices.

Thursday, July 30, 2009

Networking didn't work after kernel upgrade: br0?

I did an 'apt-get dist-upgrade' and there was a kernel upgrade, so I rebooted. When the system came back there was no functional networking. Everything looked fine, I couldn't reach anything besides loopback.

On a hunch, I commented out br0 interface from /etc/network/interfaces and bounced networking (/etc/init.d/network restart) and all OK.

Then for grins I added br0 interface back and bounced networking again and, huh, all now seemed OK.

So I tried rebooted and all was still OK.

Chalking it up to a mystery for now unless problem returns.

Sunday, July 5, 2009

Upgraded to Virtualbox 3.0

I notiec that Virtualbox 3.0 was released, so I upgraded my previous install using the directions from www.virtualbox.org. This time I went the route of editing /etc/apt/sources.list by adding the following line:

deb http://download.virtualbox.org/virtualbox/debian jaunty non-free


Then adding the Sun VBox key:

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


Then did the install:

apt-get install virtualbox-3.0


Then I also downloaded and installed the new 3.0 version of the SDK from the Virtualbox download page (which seems to have been updated to work with Python 2.6 btw).

Monday, June 8, 2009

Installing Virtualbox and creating Ubuntu VMs on headless Ubuntu 9.04 server

Here's my situation: Ubuntu 9.04 server, headless and I want to install Virtualbox on it and get Ubuntu 8.04 LTS servers running as root.

Step 1: Install Virtualbox

Following the directions at the Virtualbox Linux download page I did the following:

1a) Edited /etc/apt/sources.list and add the virtual box repository:
deb http://download.virtualbox.org/virtualbox/debian jaunty non-free

1b) Add the virtualbox key to the apt keyring:
wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -

1c) And install:
apt-get install virtualbox-2.2

Step2: Configured bridged networking

I basically followed the directions on the help.ubuntu.com wiki.:

2a) Install bridge-utils:

apt-get install bridge-utils

2b) Now edit /etc/network/interfaces and add the br0 interface with the same address as your primary interface (eth0 in my case). Note that these directions assume you are using a static IP, if not you are on your own. My /etc/network/interfaces now looks like this:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

# Configured per https://help.ubuntu.com/community/VirtualBox/Networking
# Address of br0 should be the same as eth0
auto br0
iface br0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
bridge_ports eth0 vbox0 vbox1


2c) Now restart the networking:

/etc/init.d/networking restart

...wait a couple minutes for the network to come back - my SSH session survived the restart YMMV...

Now I have a br0 interface:

# ifconfig br0
br0 Link encap:Ethernet HWaddr 00:18:8b:76:32:11
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::218:8bff:fe76:3211/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:87 errors:0 dropped:0 overruns:0 frame:0
TX packets:74 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6130 (6.1 KB) TX bytes:11447 (11.4 KB)

2d) Create /etc/vbox/interfaces:
vi /etc/vbox/interfaces

So that it looks like:
vbox root br0

2e) Restart virtualbox networking, but hmmm, I don't have /etc/init.d/vboxnet, but I do have /etc/init.d/vboxdrv so I restarted that instead:
/etc/init.d/vboxdrv restart

2f) I skipped setting permissions on /dev/net/tun since I'm running VMs as root.

Step 3: Create a VM

I basically followed these directions, updated as I went. Also kudos to Sasquatch for the nic1 and bridgeadapter1 options.

3a) Create the new VM. You should be able to set the memory as you see fit. Other options you probably don't want to mess with.

VBoxManage -q createvm -name Ubuntu-Server -register
VBoxManage -q modifyvm Ubuntu-Server -memory 384MB -acpi on -ostype ubuntu -pae on -nic1 bridged -bridgeadapter1 br0

Note that if you have other VMs using vrdp you probably want to add "-vrdpport #" to use an available port (default port is 3389).

3b) Create disk for the new VM and attach it. I created an 8GB disk based on my experiences trying to use smaller disks.
VBoxManage -q createhd -filename "Ubuntu-Server.dvi" -size 8192 -register
VBoxManage -q modifyvm Ubuntu-Server -hda Ubuntu-Server.dvi

3c) Download the iso for 8.04 server from Ubuntu. Note I use 8.04 since it has long-term support and hence I won't have to worry about upgraded the OS on the VM as often. Note that while the Ubuntu page tried to get me to use the 64 bit version, I found it did not work for me (I got the following error trying to boot with it: "This kernel requires an x86-64 CPU, but only detected an i686 CPU. Unable to boot - please use a kernel appropriate for your CPU.") so I used the 32 bit version instead. You should also choose a copy from a local mirror.

wget http://osmirrors.cerias.purdue.edu/pub/ubuntu-releases/hardy/ubuntu-8.04.2-server-i386.iso


3d) Register the iso image and attach it to the VM:
VBoxManage -q registerimage dvd /path/to/ubuntu-8.04.2-server-i386.iso
VBoxManage -q modifyvm Ubuntu-Server -dvd /path/to/ubuntu-8.04.2-server-i386.iso

Ok, we now have a VM that's ready to boot and install Ubuntu...

Step 4: Start the VM and Connect to it via vrdp

4a) Start the VM in vrdp mode:
VBoxManage -q startvm Ubuntu-Server --type vrdp

4b) Connect using a remote desktop client. What I found worked for me from my Ubuntu 9.04 laptop was 'rdesktop' from the commandline:
rdesktop server-name

Or from my Mac, Remote Desktop Connection, though it does give a warning about "Remote Desktop Connection cannot verify the identity of the computer that you want to connect to."

Step 5: Do a standard Ubuntu Install
Ok, you should now be looking at the console on the VM which has booted from the CD. Go ahead and do your standard Ubuntu install.

When the install completed, I found the system automatically rebooted from the hard drive without me having to do anything to unmount iso image.

Step 6: Clean up

The only thing to do is detact the iso from the VM. After powering off the VM, do the following:
VBoxManage -q modifyvm Ubuntu-Server -dvd none

Saturday, June 6, 2009

Making a SSH connection to a NAT'ed Virtualbox VM

I found myself wanting to SSH to a NAT'ed virtualbox VM. I discovered this post which nicely described how to use VBoxManage to accomplish this. The only change I had to make on my Ubuntu box was to use 'pcnet' instead of 'e1000'.

Thursday, May 28, 2009

Installing Virtual Box

I recently upgraded to VMServer 2.0.1 on my Ubuntu laptop and I'm very unhappy. The new console is very slow and it hangs often. I'm tried of watching "loading" message. Certainly my laptop is a little old (1.5GHz Celeron M processor) and maybe that is a contributor. On the other hand if you google the net, you'll find no shortage of other people with the same opinion.

I installed VirtualBox on my Mac laptop and found I really liked it. So I figured I'd give it a try on my Ubuntu laptop as well.

First you need to choose between the Open vs Closed Source editions. Despite being a fan of open source I went with the closed source, mainly because the Remote Display Protocol server sounded like useful functionality I might want.

Install was fairly straight forward, I went to the VirtualBox Linux Downloads page and clicked on the Ubuntu .deb link.

One annoyance is that it didn't install an entry in the Applications menu, so I had to start it from the command line:
% /usr/X11R6/bin/VirtualBox
I did add an icon on the panel using the following steps:
  1. Right Click on Application Panel
  2. Select "Add to Panel"
  3. Select "Custom Application Launcher" and "Add"
  4. Type is "Application"
  5. Name is "VirtualBox"
  6. Command is "/usr/X11R6/bin/VirtualBox"
  7. Click OK.
This will create an icon with the default "spring" image. If anyone knows where I can find a stash of images for applications, please let me know.

That's it. If I like it on my laptop, next step will be installing it on my server which will be more interesting since I'll want to have unattended, automatically starting VMs and I'll also want to re-use my existing VMWare images (the images on my laptop don't have enough state for me to worry about).