Improving VirtualBox performance

I run VirtualBox on an Ubuntu 64-bit Host with a 32-bit Windows XP guest. I was searching for a way to boost performance and came across this post related to configuring a SATA controller for drive access. Matt includes some great info there, but the step-by-step left something to be desired IMHO. Here are my revised instructions for configuring SATA support on your Win XP guest:
  1. Start VirtualBox, but do not boot your guest.
  2. Open Settings for your Win XP guest and select "Hard Disks"
  3. Check "Enable Additional Controller" and choose "SATA (AHCI)"
  4. Save your Settings changes and boot your guest
  5. Inside your guest, download the appropriate SATA controller software from Intel
  6. Install the Intel software
  7. Shutdown your guest
  8. Go back into VirtualBox Settings for your guest. Select Harddrives again.
  9. Now change the slot associated with your Windows XP attachments/harddisk(s) from IDE to "SATA Port 0"
  10. Save your settings
  11. Start your guest and enjoy the performance boost!
Posted by Eric Simmerman
 

Malfunctioning mouse after upgrade to Ubuntu 8.10

I experienced some intermittent and infuriating mouse malfunctions after my upgrade to Ubuntu 8.10. Single-clicks were interpreted as double-clicks, hilighted selections would lose focus, etc...

The root cause was an incomplete transition to HAL. Upgrade manager attempted but failed to comment out all my pointer and keyboard configuration in xorg.conf and my mouse was thus configured twice (once using the old-school xorg method and a second time by HAL). The fix was simple:

  • Edit /etc/X11/xorg.conf and remove any references to keyboard or mouse devices in the "ServerLayout" section
    • InputDevice "Generic Keyboard"
    • InputDevice "Configured Mouse"
  • Also remove any Keyboard or Mouse sections within the xorg.conf
  • Hit Ctrl+Alt+F1 to drop to a shell and type "sudo xinit -- :2" to test your new config
    • Correct any errors as needed until the above starts a new windows session with a simple command prompt
  • Hit Ctrl+Alt+F1 to switch back to your test session and Ctrl-C to kill the second windows instance
  • Restart your primary GDM with your new config "sudo /etc/init.d/gdm restart"
Posted by Eric Simmerman
 

Connecting to Netscreen Series (NetScreen-5) VPN with Ubuntu 9.04 (Jaunty - AMD64)

I recently struggled through the details of establishing a VPN connection from my Ubuntu 64 desktop to a Juniper Networks Netscreen-5. There are a number of ways to skin the VPN cat in linux and I'm not going to detail them all here. I'll just tell you how I solved it.

My Netscreen-5 was configured with some typical settings:
Phase 1
Pre-shared key "your-pre-shared-key-here"
Encryption "pre-g2-aes128-sha"

Phase 2
Encryption "g2-esp-3des-sha"
To configure the client-side, I decided to use Racoon and KVpnc:
  1. On my Jaunty install (Ubuntu 9.04) I first installed the repository version of racoon:
    apt-get install racoon
  2. Then I downloaded the latest build of KVpnc. They only had an intrepid build when I wrote this (kvpnc_0.9.1_intrepid-1_amd64.deb) and it worked for me, but it's worth checking if a Jaunty build is available.
  3. My Netscreen config translates to the following choices under KVpnc's Racoon options:
    • sha1
    • aes
    • hmac_sha1
    • aes
    • agressive
    • modp1024
    • modp1024
    • Remote Identifier Type: asn1dn
    • Local Identifier Type: user_fqdn
    • Local Identifier Value: (we used email addresses for client ids on the netscreen so the Local Identifier value in KVpnc is an email address)

Your VPN gateway is entered under General and don't forget to complete the Network/General portion of your KVpnc profile as well. That's where your destination network goes (for a Host to Network configuration like mine).

Posted by Eric Simmerman
 

Resolving Synergy mouse issues with Firefox after upgrade to Ubuntu 8.04

My desktop runs Ubuntu (64-bit) and I use Synergy to drive its keyboard and mouse over to various clients like my MacBook Pro. After my upgrade to Ubuntu 8.04 my Synergy-driven mouse exhibited truly bizarre behavior while interacting with Firefox on my Mac. DHTML didn't function normally, dropdown menus were inaccessible, flash interactions were also hit-or-miss...

At first I blamed Firefox since Safari exhibited no such issues, but after a bit of trial and error I decided to compile Synergy server from source on my Ubuntu box. I killed the Ubuntu packaged Synergy server and launched my self-compiled binary. The new server resolved all the issues.

Another win for open source software...

Posted by Eric Simmerman
 

Removing duplicate music files with different names from a large directory free

During a recent Mac migration, I hosed my iTunes library and unintentionally generated hundreds of duplicate songs (the actual media files). The problem was exacerbated by the fact that a numeric was generally appended to the duplicate filenames so that I had directories full of files like the following:
/artist/album/song.mp3
/artist/album/song 1.mp3
/artist/album/song 2.mp3
Apple wasn't doing me any favors by injecting a space in the new names either....what a mess!

I stole a few ideas from this excellent forum thread and cobbled together a script to remove files based on exact byte counts and md5sum signatures. Here's the good stuff:

#!/bin/bash
find . ! -empty -type f -printf "%s " -exec ls -dQ {} \; | sort -n | \
cut -d" " -f2- | \
xargs md5sum | sort | \
uniq -w32 -d | \
cut -c35- | while read filename
do
 echo "Removing $filename\n"
 rm "$filename"
done
Now here's the play-by-play:
  1. Prints out the size and filename of each file found on the path and sorts using the filesize as the key
  2. Trims off the file size in preparation for next stage
  3. Creates the checksum for the files of the same size and then sorts by result
  4. Strip out any checksums that are unique, leaving only the duplicates
  5. Strips out the checksum part, just leaving the duplicate filenames
  6. Loops through the results removing the first duplicate file of each set.
You'll need to run the script multiple times if you've managed to generate more than one copy of any given file. Good luck!
Posted by Eric Simmerman
 

avahi-daemon blocks nfsd on Ubuntu

I just spent a morning attempting to fix a NFS mounting configuration that had been working flawlessly for over 6 months. My daemon log was showing this:
nfssvc: writing fds to kernel failed: errno 98 (Address already in use)

After much angst, I finally stumbled upon this posting that mentioned a conflict between avahi-daemon and NFSd. After a quick "apt-get remove avahi-daemon", all is well with the world.
Posted by Eric Simmerman