Monday, 24 May 2010

IT Industry Fights over Internet Video Standards

The fight:
How should online videos be delivered to users over the internet.

The Status Quo:
Currently, Adobe Flash is the defacto standard. However, this is not an ideal situation because users need to download a browser plugin from Adobe, and that plugin is widely considered to be bloated, buggy, a CPU hog and a battery killer. Also, if Adobe cannot or will not provide a plugin for a particular platform then that platform will be unable to access vast amounts of content on the internet. Apple are currently refusing to support Flash on their iProducts which has led to an amusing round of name calling between the two. Of course, there may be other reasons that Apple may not want to let Adobe play in their sandpit though.

The Solution:
What is needed is a native, standardised, open video that can be built into all browsers. This will negate the need for a multitude of proprietary plugins. This standard is intended to be defined in the upcoming specification for HTML 5.

The Fly In The Ointment:
A group of the usual suspects are pushing for their own format, while the open source crowd lead by Google are pushing for another.

The Fighters:
In the Red Corner, we have the MPEG-LA who own a bunch of video codec patents and are pushing their H.264 codec at the W3C. The w3c are the organisation that is responsible for defining standards on the internet. The group includes Apple and Microsoft along with almost every major Consumer Electronics manufacturer on the planet. Between them, this group owns a "patent pool" and license the use of the H.264 codec to every one else. H.264 is currently available under a "free" (gratis) license although this position is to be "reviewed" in a few years. Open sourcers fear that the MPEG-LA are waiting for the time that H.264 becomes an essential part of the internet before they jack up the prices in a classic bait and switch maneuver. They are concerned that once there is a price attached to use of the codec, open source people will no longer be able to use it.

In the Blue Corner is basically everyone who is not a member of the MPEG-LA. This includes Mozilla, Opera and Google. Google has just spent $125 million purchasing a company that makes another video codec called VP8. They then open sourced that codec effectively giving free access to anyone who wants to use it. Of course it is in Googles interests for as many people as possible to access Googles services with as few encumbrances as possible. The Big G are afraid that if MS and Apple were to have effective control over where and how video is delivered on the internet then they could use that to control how users get access to Googles servers and limit that access to only the people who buy their own products along with demanding royalty payments from Google as well.

So, the current situation sees the MPEG-LA making noises about demanding royalties from VP8 users based on alleged "patent violations" in attempt to close it down.

It is a good thing for this all to come to a head and Google is one of the few players in the industry with deep enough pockets to fight a drawn out legal battle with the entrenched industry incumbents.

The sooner this is all brought out in the open and into the courts the sooner we can put all the FUD regarding HTML 5 video codecs behind us.

Ain't corporate greed a wonderful thing?

Friday, 14 May 2010

Physical Disk Access On VirtualBox Guest

See my previous post regarding using Virtualbox on a headless system here.

In vmware-server, mapping a drive to a physical disk is easy.

To do this in virtualbox it is ugly and hackish. The simple solution as described in the manual and repeated all over the interwebs is to use this command;

VBoxManage internalcommands createrawvmdk -filename physicaldisk.vmdk -rawdisk /dev/sdd -register

Unfortunately, this produces "VERR_ACCESS_DENIED" errors amongst other things.

Well, that's OK you might think, in vmware you need to give your user write access to the physical disk by adding it to the "disks" group. Logout, login, try again, same result.


Here is what you have to do;

Run the command as root
sudo VBoxManage internalcommands createrawvmdk -filename physicaldisk.vmdk -rawdisk /dev/sdd -register

Ignore the nasty error
RAW host disk access VMDK file 2TbExt.vmdk created successfully.
ERROR: Could not find file for the medium '/root/.VirtualBox/HardDisks/2TbExt.vmdk' (VERR_FILE_NOT_FOUND)

Change the ownership back to your user
sudo chown brettg:brettg physicaldisk.vmdk

Apply full permissions to all on the physical drive
sudo chmod 777 /dev/sdd*

Attach it to your guest
VBoxManage storageattach ganymede --storagectl IDE0 --port 1 --device 0 --type hdd --medium ~/.VirtualBox/Machines/ganymede/2TbExt.vmdk

It's not pretty or nice, pretty nasty in fact but it works. It's hasn't done much to convince me to stick with VirtualBox over the long haul though.

Tuesday, 11 May 2010

Thoughts on moving from VMWare-Server to VirtualBox

I am currently looking into whether moving away from VMWare server will be a good thing. It has been quite some time since VMWare updated their server product and it is becoming more and more difficult to manage it without implementing a lot of hacks and workarounds. Currently, I am simply unable to initiate a vmware-remote-console session using Firefox 3.6 and there is no solution in sight.

I initially looked at KVM, which is the "official" ubuntu virtualisation platform but that plan fell by the wayside when I realised that KVM requires hardware VT extensions in the CPU and if they are not found will fall back to full-on cpu emulation using qemu. The Atom processor on my server is already underpowered without trying to run full x86 emulation in software. Therefore, I'm back to trying out VirtualBox.

The problem with VirtualBox is that it does not have a high level management system for the machines on the host. It is all text console based which I normally don't mind, but I do find that it is very convenient to fire up a web browser to take a quick look at which machines are currently running and the details for each one.

You can't do this with VirtualBox.

Then there is the uncertainty surrounding Oracle swallowing up Sun. There is no guarantee that Oracle will keep developing and supporting VirtualBox or indeed whether it will remain free.

Already the Open Source Edition lacks certain features such as headless operation and decent usb support which means we need to use the "full" edition which must be downloaded from the Oracle website. Currently, VirtualBox is free, as in beer but unfortunately Oracle have a long history of charging exorbitantly for everything they possibly can get away with. Most recently this was demonstrated by their insane decison to start charging $90USD for an MS Office ODF plugin that was previously available for free while at Sun.

There is nothing to say that they won't do the same thing to VirtualBox.

However, despite these concerns I am still willing to push on. The only alternative is to replace my hardware with VT capable gear which means spending money and vastly increased power usage. Avoiding these things is the whole reason I went with the Atom board in the first place.

At least until I can find a motherboard that ships with one of the VTx enabled Atoms (Silverthorne Z520, Z520PT, Z530, Z530P, Z540 and Z550) on it anyway.

Converting VMWare .vmdk images to VirtualBox .vdi

First, we need to install the qemu emulator so that we can convert the VMWare image to a generic binary image

sudo aptitude install qemu

Use the qemu-img tool to convert to a generic .bin file;

qemu-img convert /path/to/original.vmdk converted.bin

This binary image can now be converted to Virtualbox's native .vdi format.

VBoxManage convertdd converted.bin converted.vdi

Note: If your .vmdk files are split into multiple 2Gb chunks you will need to create a single file using the following command.

vmware-vdiskmanager -r source_multiples.vmdk -t 2 single_file.vmdk

To convert a vdi back to vmware .vmdk use this command;
VBoxManage internalcommands converthd -srcformat VDI -dstformat VMDK sda.vdi sda.vmdk

HOWTO: VirtualBox "headless" on Lucid Lynx

As of karmic koala, Vbox 3.x is provided via the standard Ubuntu repositories. Unfortunately, this is the OSE version and it does not appear to work headless.

So, we have to download the "free as in beer" version from the Oracle website, which is currently here

At the time of writing the current build for Lucid is virtualbox-3.2_3.2.4-62467~Ubuntu~lucid_i386.deb

Before we can install the deb, we will also need to install some dependencies.
sudo apt-get install libcurl3 dkms libqt4-network libqtgui4 libxslt1.1 libasound2 \
libdirectfb-1.2-0 libgl1-mesa-dri libgl1-mesa-glx libqt4-opengl libsdl1.2debian \
libsdl1.2debian-alsa libsysfs2 libts-0.0-0 libxcursor1 linux-headers-`uname -r` \
libxdamage1 libxfixes3 libxmu6 libxxf86vm1 tsconf libqtcore4 libaudio2 libmng1

Now we can install the virtualbox deb that we downloaded earlier.
sudo dpkg -i virtualbox-3.2_3.2.4-62467~Ubuntu~lucid_i386.deb

Next, add your user account to the vboxusers group
sudo adduser brettg vboxusers

Virtualbox machines that you create will by default go in your home directory

Ensure vboxusers have appropriate permissions to the kernel, create the file;
sudo vi /etc/udev/rules.d/40-permissions.rules

KERNEL=="vboxdrv", GROUP="vboxusers", MODE="0660"

That's it, Virtualbox should be installed and ready to go.
Now we can move on to creating a virtual machine
Create a machine named "io"
VBoxManage createvm -name io --ostype Ubuntu -register

Configure it with a nic bridged to eth0, 256Mb RAM, enable acpi and set to boot from DVD
VBoxManage modifyvm io --memory 256 --pae on --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0

Create a virtual IDE controller
VBoxManage storagectl io --name IDE0 --add ide

Create a virtual HDD
VBoxManage createvdi -filename ~/.VirtualBox/Machines/io/sda.vdi -size 48000 -register

Attach the virtual HDD
VBoxManage storageattach io --storagectl IDE0 --port 0 --device 0 --type hdd --medium ~/.VirtualBox/Machines/io/sda.vdi

Create and attach a virtual DVD drive to the controller and insert the DVD image
VBoxManage storageattach io --storagectl IDE0 --port 1 --device 0 --type dvddrive --medium /store/archive/ISO/ubuntu-10.04-server-i386.iso

The default vrdp port for machines is 3389, however, if you intend to run more than one guest then each one will need to listen on a different port. I use the 3xxx range with the xxx being the last octet of the machines IP address. For example, would be 3001.
VBoxManage modifyvm io --vrdpport 3001

And thats it, your machine has been created. Time to start it up and give it a test drive!

Using the virtual machine

Start the machine
nohup VBoxHeadless -startvm io &

On a GUI workstation, establish a remote desktop connection to the machine. In my case, the host server is called "jupiter" so I type;
rdesktop -a 8 jupiter:3001

After you have installed the OS, you need to tell the machine to boot from the hdd.
VBoxManage modifyvm io --boot1 disk

You can also deregister the dvd image if you don't intend to use it again.
VBoxManage unregisterimage dvd /store/archive/ISO/ubuntu-10.04-server-i386.iso

Here are some other useful commands;
VBoxManage showvminfo io
VBoxManage list hdds
VBoxManage list runningvms
VBoxManage controlvm io poweroff
VBoxManage unregistervm io --delete
VBoxManage controlvm io savestate
VBoxManage closemedium disk UUID
VBoxManage modifyhd UUID --type immutable

Wednesday, 5 May 2010

Arrow keys in vmware

This applies to every ubuntu since Hardy Heron.

Symptom: Only the arrow keys on the numpad work in vmware-remote-console sessions. Other strange behaviours with alt, ctrl and most of the "special" keys.

Solution: Create a file ~/.vmware/config
vi ~/.vmware/config
Add the following contents;
xkeymap.keycode.108 = 0x138 # Alt_R
xkeymap.keycode.106 = 0x135 # KP_Divide
xkeymap.keycode.104 = 0x11c # KP_Enter
xkeymap.keycode.111 = 0x148 # Up
xkeymap.keycode.116 = 0x150 # Down
xkeymap.keycode.113 = 0x14b # Left
xkeymap.keycode.114 = 0x14d # Right
xkeymap.keycode.105 = 0x11d # Control_R
xkeymap.keycode.118 = 0x152 # Insert
xkeymap.keycode.119 = 0x153 # Delete
xkeymap.keycode.110 = 0x147 # Home
xkeymap.keycode.115 = 0x14f # End
xkeymap.keycode.112 = 0x149 # Prior
xkeymap.keycode.117 = 0x151 # Next
xkeymap.keycode.78 = 0x46 # Scroll_Lock
xkeymap.keycode.127 = 0x100 # Pause
xkeymap.keycode.133 = 0x15b # Meta_L
xkeymap.keycode.134 = 0x15c # Meta_R
xkeymap.keycode.135 = 0x15d # Menu

You will need to close and reopen any sessions you have open.