From VDI to VMX – From VirtualBox to VMware

Export the vm in VirtualBox, thereby you create a .VMDK file, which basically is a virtual harddisk. Although, VMplayer works with .VDMK files you have to configure a .VMX file in order to run it.

If you own a VM Workstation edition you just create a new virtual machine and select your .VDMK when you are ask to create a new or select an existing virtual machine disk.

In case you set the option “dynamically resizeable” in VirtualBox you might want to try these instructions. Here are the main steps to undertake this mission:

  1. Convert your .VDI to a .raw image by the vboxmanage shell command:

    vboxmanage internalcommands converttoraw .VirtualBox/HardDisks/myvm.vdi vmware/myvm.raw
  2. Convert the .raw image to a .VMDK file:

    qemu-img convert -O vmdk myvm.raw myvm.vmdk
  3. Create a VM with VMplayer and exchange the .VMDK with your own, either by renaming or changing the config in the .vmx file.

Make sure your user has read rights to the .VMDK or is owner.

Problems running VirtualBox and VM software

Running VirtualBox and VMplayer or the like in parallel leads to problems, e.g.

VirtualBox can’t operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_VMX_IN_VMX_ROOT_MODE).

If you execute the VM software and then want to start a vm out of VirtualBox you will have to disable your KVM like this:

sudo rmmod kvm-intel   # for intel processors
sudo rmmod kvm-amd     # similar for amd

To enable the KVM module again just type

modprobe kvm-intel
modprobe kvm-amd

in your shell.


Shell Scripting

Error Handling

There are several ways to save the output of a shell script. The easiest way doing so is by simply appending the output to a textfile via ‘>’: > logfile.log

The problem with this solution is that not every output is saved to the log file. If a program like ‘curl’ is called, it’s outputs are not appended to the logfile.

This has to do with the types of information a program is sending to the screen/terminal. One type regarding standard output information is called ‘STDOUT’ the other regarding standard error information is called ‘STDERR’. There are three ways in getting this information and writing it into a log file. The script function to do so is called ‘exec’ and has three output options

  1. Standard Output Information: The logfile output of ‘exec 1’ looks basically the same as appending a logfile to a script.

    exec 1>> logfile.log
    # script
    # ...
  2. Standard Error Information: By calling ‘exec 2’ just error messages are written to the log file.

    exec 2>> logfile.log
    # script
    # ...
  3. Combined Output and Error Information: Writing both output and error information to the logfile, call ‘exec &’.

    exec &>> logfile.log
    # script
    # ...

Link to script

just make a symbolic link in /bin to the custom script you want to launch…


Remember The Milk as a Ubuntu Widget

RTM is a nice task managing tool. Here is one solution to integrate it with your Ubuntu desktop as a widget.

If not already done install the Compiz Config Settings Manager as follows:

sudo apt-get install compizconfig-settings-manager

In the compiz settings by activating the “Widget Layer” (under category “Desktop”) it is possible to show by shortcut F9 any desired information or small tools like a calendar, weather information, a calculator, your tomboy notes, etc. right on top of your desktop. In other words it’s handy for all the small tools You need during a hard working day.

First of all you need to install the screenlets package:

sudo apt-get install screenlets

After that, start the screenlets daemon and click “install” on the left pane. Select “Convert Web Widget” from the drop box and proceed. If not selected, chose “Google Gadgets” and paste following HTML code into the field below:

<script src=";synd=open&amp;w=320&amp;h=300&amp;title=Remember+The+Milk&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>

If it doesen’t work, get the code directly from the Google Gadgets Webpage.

Name the screenlet the way you want to and confirm the settings. Now Your new screenlet should now be listed in the Screenlets Manager. Select it, go to the options in the left pane and check “Widget”.

Start it by double-clicking. Press F9 to show your Widgets. In Your RTM Widget You now should be able to log in and manage your tasks.


  • More solutions for desktop integration

Re-installing Ubuntu

Since re-installing an OS in general is not exactly an event you wanna spent your whole weekend on here are some practical hints to speed up the process.

Preparation & Backup

  1. Backup your home directory
  2. Backup software in /opt
  3. Backup essential files
    • /etc/apt/sources.list
    • /etc/hosts
    • .bashrc or another bash profile file
  4. Make and backup a list of installed applications

     dpkg --get-selections > installed-software


  1. Re-install your Ubuntu
  2. Copy essential files
  3. Copy software profiles from your home folder
  4. Install dselect and start installing your applications

     sudo apt-get install dselect
  5. In parallel you already can copy your data back on your machine, as dselect will take a while.
  6. Copy software to /opt and add it to your menu

Open Problems

  • Transfer of keyrings
  • Application menu

ODBC Setup on Ubuntu for PostgreSQL

Install the basic config tools for the UNIX ODBC:

sudo apt-get install unixodbc-bin unixodbc

ODBC drivers for PostgreSQL:

sudo apt-get install odbc-postgresql

Apply the template file provided to setup driver entries:

sudo odbcinst -i -d -f /usr/share/psqlodbc/odbcinst.ini.template

Setup the a sample DSN

sudo odbcinst -i -s -l  -n adyoung-pg -f /usr/share/doc/odbc-postgresql/examples/odbc.ini.template

Now modify /etc/odbc.ini according to your DB:

sudo nano /etc/odbc.ini

To configure the ODBC for MSSQL and Sybase look up the references.

Performance – JDBC vs. ODBC

In a quick performance test the ODBC Interface proved to be way faster than the JDBC (postgresql-8.4-701.jdbc4.jar)! A table fetch for data of dimension 45,800 x 13 the ODBC required 5.05 sec, where the JDBC interface took 10 min 21 sec.


MPD and Alsa

I faced a problem with addressing the right alsa card with mpd. the logfile showed me:

ALSA lib pcm_hw.c:1401:(_snd_pcm_hw_open) Invalid value for card
May 20 18:28 : output: Failed to open "USB Behringer" [alsa]: Failed to open AL$
May 20 18:28 : player_thread: problems opening audio device while playing "rapp$
Audio File Library: WAVE MPEG layer 3 data format is not supported [error 0]

after running:

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I found out my card to be hw:1,0 … and the

aplay -D hw:1,0 test.wav


speaker-test -D hw:0,3 -c 2
speaker-test -D hw:1,0

was successful

but mpd didnt like it in its mpd.conf… the alias finally did the trick. running

aplay -L

provides you with the aliases.

    Discard all samples (playback) or generate zero samples (capture)
    PulseAudio Sound Server
    HDMI Audio Output
    Direct sample mixing device
    Direct sample snooping device
    Direct hardware device without any conversions
    Hardware device with all software conversions
    USB Audio CODEC, USB Audio
    Default Audio Device
    USB Audio CODEC, USB Audio
    Default Audio Device
    USB Audio CODEC, USB Audio
    Front speakers
    USB Audio CODEC, USB Audio
    4.0 Surround output to Front and Rear speakers
    USB Audio CODEC, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
    USB Audio CODEC, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
    USB Audio CODEC, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
    USB Audio CODEC, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
    USB Audio CODEC, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
    USB Audio CODEC, USB Audio
    Direct sample mixing device
    USB Audio CODEC, USB Audio
    Direct sample snooping device
    USB Audio CODEC, USB Audio
    Direct hardware device without any conversions
    USB Audio CODEC, USB Audio
    Hardware device with all software conversions

the alias is the sysdefault:CARD=CODEC part of this output. my mpd.conf finally looks like:

audio_output {
        type            "alsa"
        name            "USB Behringer"
        device          "sysdefault:CARD=CODEC"
#       device          "hw:0,0"        # optional
        format          "44100:16:2"    # optional
        mixer_device    "default"       # optional
        mixer_control   "PCM"           # optional
        mixer_index     "0"             # optional

the help is documented here:

Music Player Daemon – MPD


There are many good music players for Linux, but just one, which conquered my heart: the Music Player Daemon (MPD). Its delicious features are:

  • extremely low cpu consumption (around 1% for me)
  • stays in the background as a daemon without annyoing windows or tray icons
  • network control
  • highly customizable keyboard shortcuts via xbindkeys & mpc
  • gapless playback (essential for live music)
  • many clients available, see the corresponding section
  • does not need a running client
  • full Zeroconf/Avahi integration

The following configurations were done in Ubuntu.

Installation and Configuration

Installation in Ubuntu is easier than saying “Blunzengröstl”:

sudo apt-get install mpd

Music Directories

The default location for the music directory is /var/lib/mpd/music. Not the place I want to store my music collection! If you think the same, I suggest to fix this by making symbolic links to the actual directories with your music. Set symbolic links by (needless to say, adjust the paths to your needs):

sudo ln -s /home/stefan/Music/01\ musik /var/lib/mpd/music
sudo ln -s /home/stefan/Music/02\ musik\ mampf /var/lib/mpd/music
sudo ln -s /home/stefan/Downloads /var/lib/mpd/music

Configuration File

The main configuration of MPD is done in the file /etc/mpd.conf, which is well documented and explained. Open the file with your favorite text editor, for instance:

gksu gedit /etc/mpd.conf

Network access

If you want to control the MPD on remote clients comment out the following line (put a # sign in front of the line):

# For network
#bind_to_address		"localhost"

Replay Gain

I personally like Replay Gain, so I turn it on by uncommenting the corresponding line. Replay Gain uses volume metadata to maintain a constant sound level of multiple songs. You can also choose the track mode.

replaygain			"album"

Pulse Audio

MPD is not very Pulse Audio friendly, so we need to apply some configurations. This drastically lowered the cpu load in my case. Activate these lines to the configuration file in the section Audio Output:

  • audio_output {
    	type		"pulse"
    	name		"My Pulse Output"
    #	server		"remote_server"		# optional
    #	sink		"remote_server_sink"	# optional
  • Comment out the entry for alsa in the file.
  • The next step is to install the package paprefs (pulse audio preferences)
  • go to System > Preferences > Pulse Audio Preferences and activate under Network Server
    • Enable network access to local sound devices
    • Don’t require authentication

After a restart with

 sudo /etc/init.d/mpd restart

Pulse Audio now allows you to choose other sound cards available on your LAN, during sound output. Have a look what Pulse Audio can do for you: Wiki article

LAN Streaming

If you need the music stored on one machine in another room, streaming the content could be a convenient solution. Your choice is either using Icecast or a simpler http stream. I prefer the easier one. Activate those lines as in the example below:

# An example of a httpd output (built-in HTTP streaming server):
audio_output {
	type		"httpd"
	name		"My HTTP Stream"
	encoder		"vorbis"		# optional, vorbis or lame
	port		"8000"
	quality		"5.0"			# do not define if bitrate is defined
#	bitrate		"128"			# do not define if quality is defined
#	format		"44100:16:1"

Just beware not to define quality and bitrate settings at the same time.


Keep in mind that mpd stores its music database in text files. Each time your music directories are filled with fresh music the database needs to be updated. Most clients are capable of doing this, for instance automatically on startup. However, here is the command line solution with mpc installed:

mpc update



My favorite client is the ncmpc as it is lightweight, beautiful and simple. The terminal is just enough for it.

sudo apt-get install ncmpc

Ncmpc is started with a single ncmpc in the terminal. Browse the different menues, playlist etc. with the number keys 1-8. You can browse through the list of shortcuts by pressing 1. The most important ones for me are:

  • Ctrl+u – update your music database
  • Space Bar – add to playlist
  • Del – you guessed it
  • c – clear the playlist


Some people may like something more pleasing to the eye or something mouse-friendly. You can try a small, neat player called Sonata (package sonata).

Gnome Music Player Client

Or even something bigger, the Gnome Music Player Client. This client looks really nice and powerful and offers a convenient way to search your database (meta data, genre and artist browser). Its universe package is called gmpc.

Minion – Firefox Extension

This is really nice. You can run a mpd client completely in Firefox with the extension Music Player Minion. This is ideal if you want to control your Linux mpd server with a Windows or Mac machine.

See the list of clients for further alternatives.


The absolute marvelousness turns up with a combination of mpc and xbindkeys in the form of global keyboard shortcuts. Whatever you are doing on your system you can fully control your mpd server with global keystrokes. See my article about xbindkeys for further info.

References – excellent Wikipedia article about MPD – ubuntuusers MPD – ubuntusers configure MPD server – ubuntuusers Gnome Music Player Client – HTTP streaming – Listening to streams

A simple menu driven script

Combining several scripts into one. tput

  • System Update
  • rsync

Packages needed

  • libnotify-send
  • pmount
  • whitelist
# -----------------------------------------------
# Copyright (c) 2005 nixCraft project <>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit for more information.
# -------------------------------------------------------------------------

#3. Backup to Riesengarnele
## excluded directories
riesengarnele_exclude="--exclude .local/share/Trash"

# 4. Backup Frobisher 
## IP of Frobisher
## excluded directories
frobe_exclude="--exclude Backups --exclude Downloads --exclude Music --exclude Videos --exclude .local/share/Trash --exclude .phoronix-test-suite --exclude .wine"

while :
# clear the screen
tput clear
tput setaf 3
 echo "H Y D R A"
tput setaf 3
tput cup 5 17
tput rev
echo "Please choose"
tput sgr0
tput cup 7 15
 echo "1. Update"
tput cup 8 15
 echo "2. Trigger Event"
tput cup 9 15
 echo "3. Backup to Riesengarnele"
tput cup 10 15
 echo "4. Backup to Frobisher (via SSH)"
tput cup 11 15
 echo "5. Exit"
tput bold
tput cup 12 15
 echo -n "Please enter option [1 - 5]"
 read opt
tput clear
tput sgr0
tput rc
 case $opt in
  1) echo "************ System Update Initialized *************";
     sudo apt-get update;
     sudo apt-get dist-upgrade;
     echo "Press [Enter] key to continue. . .";
     read enterKey;;
  2) echo "*********** Event Triggered **********";
     notify-send "fett geile Scheiße!!";;
  3) echo "************* Backup to Riesengarnele initialized *************";
     pmount /dev/sdb1;
     rsync -avc --progress --delete $riesengarnele_exclude /home/$USER/ /media/sdb1/backup_totoro_sync;
     pumount /dev/sdb1;   
     notify-send "Backup to Riesengarnele Done";
     echo "************* done! Press [Enter] key...  *************";
     read enterKey;;
  4) echo "************* Backup to Frobisher initialized *************";
     rsync -avc --progress --delete $frobe_exclude /home/$USER/ -e ssh $frobe_ip:/home/stefan/Backups/totoro_sync;
     notify-send "Backup to Frobisher Done";
     echo "************* done! Press [Enter] key...  *************";
     read enterKey;;
  5) echo "Servas $USER";
     sleep 1;
     exit 1;;
  *) echo "$opt is an invaild option. Please select option between 1-5 only";
     echo "Press [enter] key to continue. . .";
     read enterKey;;