Tuesday, March 31, 2009

Linux Virtual Machine Roundup

With the inclusion of Ring-0 instructions on most recent processors, virtual machine speed has more or less equalized across the various players, with factors such as OS integration, 3d support, and cost becoming much more of a consideration. Linux users are in relatively good shape when it comes to virtualization software. The progress being made because of Apple’s switch to Intel processors has yielded benefits for all platforms, and the presence of Linux in the data center has made it a well supported platform for running Vmware, who derives the majority of the their business from enterprise customers. There are also fully open source solutions such as Bochs and Qemu, and open source commercial solutions such as Virtual Box that provide for a lot of choice. This article is going to break down those options.

Before going over the various software packages, I’d like to offer an obligatory plea to choose native Linux software over using a virtual machine to run Windows software. Without users it will never make sense for developers to offer Linux versions. http://laptoplogic.com/resources/top-50-linux-alternatives-to-popular-apps has a great list of Linux alternatives to popular software, and http://www.getdeb.net/ has a lot of great Linux software for Ubuntu and Debian users. If all else fails, try searching in the Synaptic Package Manager for something that does what you want. Considers yourselves pleaded with.

Option #1 – Vmware

Current version – 6.5
3d Support – Only with commercial display drivers
OS Integration – Very good
Cost: $200

VMware, being the biggest player in the virtualization market, is the obvious place to start. VMware Workstation 6.5 provides better 3d support, allowing for full DirectX 9 acceleration on Windows Xp guests, and allows for seamless integration between the guest and the host operating systems using its “Unity” feature. Despite its great features, VMware suffers from an extremely high price tag. The lower price VMware Fusion, the company’s main consumer product, is only available for OS X. It also is a relatively large install. Where some of the open source alternatives are less that 10MB, VMware comes in at around 350MB installed. Overall, VMware would be the best choice for anyone who had $200 to spend on virtual machine software. For everyone else, the open source alternatives should be a little more appealing.

Option #2 – Virtual Box

Current version – 2.1.4
3d support – Minimal
OS Integration – Good
Cost: Free, both in a totally open source version or a partially closed source but more capable version

Virtual Box has become the main choice of virtual machine software for the open source crowd. Though it lags slightly behind VMware in features, its development by Sun provides Linux users with an open source enterprise quality virtualization package. Unfortunately for those looking to avoid having to reboot to play games not supported by Wine, the 3d support in Virtual Box is pretty lacking, and the OS integration, while good, is nothing of the level provided by VMware.

Option #3 – Bochs

Current version – 2.3.7
3d integration – None
OS Integration – None
Cost: free, GPL

Bochs, while a great piece of software, is more or less unsuitable for use by a casual end user. With a feature set catering more to developers, Bochs offers accurate emulation of a variety of hardware, and is useful for things such as testing software on various hardware architectures. While Bochs amply provides in versatility, it lacks in speed, relying on traditional re-compilation for its emulation, rather than using native virtualization instructions or even faster JIT methods. Sticking to simple techniques has allowed them to offer stability and accuracy however, again making Bochs more optimal for a developer than an end user.

Option 4 - Qemu

Current version - 0.10.1
3d Integration – N/A
OS Integration – None
Cost: free, GPL

Prior to the recent popularity of Virtual Box, Qemu ruled the world of open source X86 hardware virtualization. Qemu has a variety of front ends that make managing its features easier, and is the only virtualization software to support KVM, or Kernel-based Virtual Machine, a virtual machine infrastructure built straight into the Linux kernel. Qemu has a good range a virtual hardware, much of which was borrowed for use in Virtual Box. Qemu unfortunately does not support hardware based virtualization instructions, but it still yields pretty good performance overall. Support for hardware virtualization is planned, but the time frame is uncertain.

Vmware clearly leads the pack in features. If money is no object, Vmware provides the best OS integration and 3d support to be had on the Linux desktop. Unfortunately, $200 is a little steep. Bochs and Qemu, though fully open source, are a little lacking in end user features. Also, the lack of support for Ring-0 instructions on Bochs and Qemu places the speed of their virtualization far behind Vmware or Virtual Box, even in the best scenarios. The difference may be harder to notice if you’re just using them to run Windows 95, but that difference in speed becomes much more obvious when more demanding applications or operating systems are used.

Virtual Box offers most of the same features as VMware, but is both open source and supports hardware virtualization. VMware is probably the only virtual machine software on which you’d be able to run any games, but for applications for which there is absolutely no Linux alternative, Virtual Box offers nearly identical performance at a much lower price.

Monday, March 30, 2009

Get Flash Player working once and for all on 64-bit Ubuntu

Flash on Linux until recently has been a vexing problem. Initially, there was no Flash plugin for Linux at all, so in order to use Flash one had to use the plugin via Wine. Since then, Adobe has stepped up to the plate, offering two different versions of Flash for Linux: a 32-bit stable release, and an alpha version of a 64-bit plugin. I’ll cover how to install each of these.

The first step in installing the Flash plugin is figuring out which one you want to use. In my experience, the 64-bit version has been a little unstable, but overall it isn’t bad. I would recommend this version first. If you use Flash a lot and want to avoid browser crashes at all costs, 32-bit Flash is the way to go. If you're looking for a better performance at the potential loss of some stability, 64-bit Flash is the better choice.

First, download Flash from the Adobe website. I’ve included a link to the appropriate page.


The current version as of 3/2009 is version . Therefore, the filename I downloaded is libflashplayer-

Next, you need to unpack this file out the tar.gz so that you’re left with just a .so file. First, switch into the folder to which the file was downloaded. This is most likely either your home folder (open up the terminal type “cd” to switch to it) or your Desktop (go to your home folder then type “cd Desktop”. Make sure to capitalize the D) Next, give the command to decompress the

tar -xvzf libflashplayer-

Replace the libflashplayer bit with the name of the file you’ve downloaded. This command can also be used with an tar.gz file.
Next, we need to move the newly extracted .so file to the appropriate location, in this case /usr/lib/firefox/plugins . As this will affect all users, it must be executed as root, so we throw sudo on the front.

sudo cp libflashplayer.so /usr/lib/firefox/plugins

After enter your password, the command will complete. Next, open Firefox and type “about:plugins” into the address bar and press enter. This will bring up a list of plugins that Firefox is using. Find the section for “Shockwave Flash” and make sure that the file listed is libflashplayer.so . If it is something else, you should use Synaptic to uninstall your previous version of the Flash plugin.

To install the 32-bit plugin, the process is a lot easier. The simplest way to do this is by using Synaptic to install it. This also ensures that receive updates to your plugin as they become available.

Sunday, March 29, 2009

Convert Videos for your iPhone

Despite the fact that I have been dead for 84 years, like many of you I have an iPhone. Frequently I run into the same issue: I want to put the latest movie I’ve legally downloaded onto my iPhone, yet I am unable to. Here are the steps you, my loyal readers, need to follow in order to watch free movies on your iPhone.

First off, I’m not going to tell you how to find free movies. uTorrent and The Pirate Bay can help with that. For this how-to, I am mainly interested in 2 things.

Item #1) How to convert a video file to work on your iPhone / iPod Touch
Item #2) How to convert a DVD to work on your iPhone / iPod Touch

The iPhone and iPod Touch are luckily very friendly about the video files they will support. Both standard MP4 files, as well as those encoded with h.264 are supported. If you’re looking for quick encoding times, MP4 is hard to beat, as it is possible to encode much faster than real time on even a Pentium 4. H.264 requires a little bit more power, but yields quite a bit higher video quality for the same size of file. Choosing a video codec is practically like reading a Choose Your Own Adventure book. Most of the tools I’ll discuss below will have a built in preset for iPhone and the iPod Touch. In the event that they don’t, you should always use the following settings:

MP4/h.264 video codecs
16:9 aspect ratio
720 kbps bit rate
Make sure your file is in an MP4 container. The process
for doing this is different on each program. Check the help file.

There are a few ways one can go about converting video files. For Windows, I recommend using Super (http://www.erightsoft.com/SUPER.html) . It is a freeware front end for a variety of open source encoding tools such as FFMPEG, Meconder, and a number of libraries that each of those use. It has a built in profile just for use with iPhone, and I have used it to great success so far.

To convert a video file to iPhone or iPod Touch on Mac OS X, there are a few different options. If you have Quicktime Pro (the program Serial Box might have a little to add about getting a copy of Quicktime Pro for free). If you select Export, then select the appropriate setting for iPhone, you’re in good shape. imTOO offers a video encoder for Mac as well. If you prefer a free method of doing your encoding, check out FFMPEG (http://ffmpeg.org/). It is a free, open source video encoder/decoder, but it is command line only. One would be advised to find a GUI front end for it, thought such GUIs are somewhat lacking on the Mac. I’ve also included some command line switches that one can execute from terminal.app.

For Linux, there are a huge variety of tools with varying degrees of functionality. The same advice applies for converting video files on the Mac as does on Linux: it would probably be good idea to find a front end for FFMPEG (http://ffmpeg.org/). If all else fails, one can install FFMPEG and use it from the command line. I’ve included some good command line options below for those that would rather copy and paste:

ffmpeg -i inputfile.avi -r 25 -vcodec libxvid -s 480x270 -aspect 16:9 -maxrate 768k -b 512k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 44100 -ab 96k -ac 2 -pass 1 -passlogfile pass1.log outputfile.mp4

followed by

ffmpeg -i inputfile.avi -r 25 -vcodec libxvid -s 480x320 -aspect 16:9 -maxrate 768k -b 512k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 44100 -ab 96k -ac 2 -pass 2 -passlogfile pass1.log outputfile.mp4

where inputfile.avi is the name of the video you are converting. Either be sure to launch this from the folder in which your video is contained, or include a full path to the video you’re planning on converting. This process provides a video file that been encoded at 480x320 resolution (plenty for iPhone), done in 2 passes (takes a little more time but the video file looks a lot better) done with the Xvid codec, a standard derivative of the MP4 video codec.

Luckily for converting DVDs, one tool has come to rule them all for Windows, Linux, and Mac OS X: HandBrake. HandBrake integrates FFMPEG and some other tools into a neat package that is easy for the end user who doesn’t want a lot of control, but offers a wide variety of advanced options for power users. If you are dealing with a commercial DVD as opposed to one that was copied, you’ll have to circumvent copy protection in order to create a video file. On OS X, Handbrake will take care of this for you. On Linux, look for a tool called decss2. In Ubuntu/Debian it may be installed through the Synaptic package manager, or it can be installed with Yum on RPM based distributions. Make sure that you find out the right package name for your distro, as it likely isn’t just called decss2.

On Windows, in order to read copy protected DVD movies, the best tool available is AnyDVD. Once again, uTorrent/The Pirate Bay can lend a helping hand. AnyDVD simply takes any DVD movie with copy protection and makes it appear as if there isn’t any. Run this in conjunction with HandBrake to be able to rip movies.

Until next time.

Saturday, March 28, 2009

Building From Source using Apt-get in Ubuntu

As a reasonably dedicated Debian/Ubuntu user, I often find myself at a disadvantage compared to Gentoo users who compile everything from source. Compiling from source can often yield huge performance gains over just installing binaries provided by your distribution. Luckily, the apt-get system provides users the ability to compile from source just as Gentoo users can.

The first step in compiling from source is issuing
sudo apt-get build-dep package_name
where package_name is the name of whatever package it is you are planning on compiling.

The sudo at the beginning of this step is important, as it gives you the necessary permissions to perform the apt-get part of the command. Issuing the apt-get build-dep command prompts apt-get to install binaries for whatever is required to build the package you specify, from things as simple as basic as the GCC compiler to as complicated as the Gtk developer headers, and any other library the program you are compiling depends on.

After you have installed all of the requirements to build a package, the next step is issuing the

sudo apt-get -b source package_name
where package_name is again the package you are compiling. This is the step that actually does the compiling, so it can take a while. What you are left with after this step is completed is a .deb file in your home directory.

Finally, to install the package you just compiled, there are two options. If you navigate to your home directory in Nautilus and double-click the .deb file you've created, gdebi-gtk will take care of you as far as installing the package is installed. If you prefer to install via the command line, dpkg is the necessary tool.

To install from the command line, first type "cd". Issuing the cd command by itself returns you to your home directory, no matter where you are in the file system. The apt-get -b step places the package in your home directory, so this is where we need to be. Finally, issuing the command "sudo dpkg -i package_name" will install the package that you've just compiled. Once again, the sudo portion of the command is required, as a normal user as is the default in Ubuntu does not have the required permissions to install new software.

If you ever seek to remove the package, you can do so by issuing the "dpkg -r package_name" command. The -r in this case stands for remove.