<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/s9y/templates/default/atom.css" type="text/css" ?>

<feed 
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    
    <link href="http://nerdbynature.de/s9y/feeds/atom.xml" rel="self" title="s9y testdrive" type="application/atom+xml" />
    <link href="http://nerdbynature.de/s9y/"                        rel="alternate"    title="s9y testdrive" type="text/html" />
    <link href="http://nerdbynature.de/s9y/rss.php?version=2.0"     rel="alternate"    title="s9y testdrive" type="application/rss+xml" />
    <title type="html">s9y testdrive</title>
    <subtitle type="html">(who took the 'we' out of weblog?)</subtitle>
    
    <id>http://nerdbynature.de/s9y/</id>
    <updated>2010-08-27T13:49:46Z</updated>
    <generator uri="http://www.s9y.org/" version="1.6-alpha2">Serendipity 1.6-alpha2 - http://www.s9y.org/</generator>
    <dc:language>en</dc:language>

    <entry>
        <link href="http://nerdbynature.de/s9y/?195" rel="alternate" title="Terminal Server Patch" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-08-27T13:49:46Z</published>
        <updated>2010-08-27T13:49:46Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=195</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=195</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?195</id>
        <title type="html">Terminal Server Patch</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                There's a nice <a href="http://www.kood.org/terminal-server-patch/">patch</a> for WindowsXP Pro SP3 to enable concurrent RDP sessions. For your (and my) convenience, <a href="http://nerdbynature.de/s9y/uploads/termsrv.zip">here</a> are the files again:

<pre>
$ ls -lgo termsrv.* 
-rwxr--r-- 1 295424 2010-08-26 15:47 termsrv.dll
-rwxr--r-- 1 295424 2008-04-13 17:12 termsrv.bk1

$ md5sum termsrv.*
56f4867bae6fd78e5365a3a7afa59c82  termsrv.dll
ff3477c03be7201c294c35f684b3479f  termsrv.bk1
</pre>

After patching <code>termsrv.dll</code> (and backing up the original, and escaping <a href="http://support.microsoft.com/kb/222193">Windows File Protection</a>), we still have to add a new registry key:

<pre>
  HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Licensing Core\
  EnableConcurrentSessions=1 (DWORD)
</pre>

Reboot, and we should be done. 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?194" rel="alternate" title="How to remove the popup ads in Avira Antivir" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-08-27T09:21:47Z</published>
        <updated>2010-09-01T01:43:28Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=194</wfw:comment>
    
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=194</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?194</id>
        <title type="html">How to remove the popup ads in Avira Antivir</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                When working with <a href="http://www.microsoft.com/windows/">certain systems</a> one might have to install some <a href="http://en.wikipedia.org/wiki/List_of_antivirus_software">antivirs software</a>. The <a href="http://www.free-av.com/">Personal Edition of Avira Antivir</a> does its job pretty well, I think: at least I <i>feel</i> safer by having some magic virus catcher installed :-) However, every time Antivir gets its (daily) updates, a nag screen pops up. Here's <a href="http://www.wikihow.com/Remove-the-Popup-Ads-in-Avira-Antivir">how to disable this popup ad</a>:
<ol>
<li>Start, Run, secpol.msc</li>
<li>Right click "Software Restriction Policies," choose "New Software Restriction Policies"</li>
<li>Right Click "Additional Rule" folder, click "New Path Rule"</li>
<li>Where it says Path, Type the path of avnotify.exe on your computer</li>
<li>Make sure the "Security Level" Dropdown menu is selected as "Disallowed"</li>
</ol>

This should be it. Thanks, <a href="http://www.wikihow.com/index.php?title=Remove-the-Popup-Ads-in-Avira-Antivir&action=history">Wikihow editors</a> :-) 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?193" rel="alternate" title="Dnsmasq fun" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-07-23T14:06:07Z</published>
        <updated>2010-07-23T14:06:07Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=193</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=193</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?193</id>
        <title type="html">Dnsmasq fun</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Ever wanted to setup a <a href="http://concisionandconcinnity.blogspot.com/2009/01/dns-with-dd-wrt.html">forwarding DNS for just one zone</a> with <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html">Dnsmasq</a> in <a href="http://www.dd-wrt.com/">DD-WRT</a>? Here's how:

<pre>
   server=/example.com/10.0.0.1
</pre>

This will forward requests for <code>*.example.com</code> to <code>10.0.0.1</code>. While we're on it, how about static DNS entries (w/o using DHCP) in DD-WRT? It's <a href="http://www.question-defense.com/2008/12/29/add-static-dns-entries-to-dd-wrt-router-firmware">as easy as</a>:

<pre>
  address=/foo.example.com/f00.example.com/10.0.0.3
  address=/bar.example.com/b4r.example.com/10.0.0.4
</pre> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?192" rel="alternate" title="Encrypted /home with Ubuntu 10.04" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-07-06T22:19:06Z</published>
        <updated>2010-07-06T22:33:45Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=192</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=192</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?192</id>
        <title type="html">Encrypted /home with Ubuntu 10.04</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                This has troubled me for quite some time now:

<pre>
# adduser <a href="https://wiki.ubuntu.com/EncryptedHomeDirectory">--encrypt-home</a> foo
[...]
foo$ cat README.txt 
THIS <a href="https://wiki.ubuntu.com/EncryptedHomeFolder">DIRECTORY</a> HAS BEEN UNMOUNTED TO PROTECT YOUR DATA.

From the graphical desktop, click on:
 "Access Your Private Data"
or
From the command line, run:
 ecryptfs-mount-private

foo$ ecryptfs-mount-private 
ERROR: Encrypted private directory is not setup properly
</pre><br/>

When adding the user via <a href="http://live.gnome.org/UsabilityProject/Whiteboard/ControlCenter">the GUI</a> it did not work either :-\ Turns out, I had to reinstall, <a href="http://nerdbynature.de/s9y/?191">again</a>:

<br/><br/>
<pre>
# apt-get purge ecryptfs-utils libecryptfs0 keyutils \
          libpam-encfs encfs librlog5 libboost-*
# apt-get install libpam-encfs ecryptfs-utils

# adduser --debug --encrypt-home foo
Adding user `foo' ...
Selecting UID from range 1000 to 29999 ...
Selecting GID from range 1000 to 29999 ...
Adding new group `foo' (1001) ...
/usr/sbin/groupadd -g 1001 foo
Adding new user `foo' (1001) with group `foo' ...
/usr/sbin/useradd -d /home/foo -g foo -s /bin/bash -u 1001 foo
Creating home directory `/home/foo' ...
Setting up encryption ...
/usr/bin/ecryptfs-setup-private -b -u foo
************************************************************************
YOU SHOULD RECORD YOUR MOUNT PASSPHRASE AND STORE IT IN A SAFE LOCATION.
  ecryptfs-unwrap-passphrase ~/.ecryptfs/wrapped-passphrase
THIS WILL BE REQUIRED IF YOU NEED TO RECOVER YOUR DATA AT A LATER TIME.
************************************************************************
[...]

foo$ mount | tail -1
/home/foo/.Private on /home/foo type ecryptfs (ecryptfs_sig=521cef411f2c84b1, \
ecryptfs_fnek_sig=44158dfbb2100d2f,ecryptfs_cipher=aes,ecryptfs_key_bytes=16)

foo$ df -h .
Filesystem            Size  Used Avail Use% Mounted on
/home/foo/.Private    9.4G  2.9G  6.1G  32% /home/foo
</pre> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?191" rel="alternate" title="rsyslog: imklog: Cannot open proc file system" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-07-06T18:17:33Z</published>
        <updated>2010-07-06T18:17:33Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=191</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=191</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?191</id>
        <title type="html">rsyslog: imklog: Cannot open proc file system</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                For some time now <a href="http://www.rsyslog.com/">rsyslog</a> was not logging <code>kern.*</code> messages any more on this Ubuntu system:

<pre>
Jul  6 18:07:08 len kernel: imklog: Cannot open proc file system, 2.
Jul  6 18:07:08 len rsyslogd: [origin software="rsyslogd" ...] (re)start
</pre>

It has been upgraded from 9.10, and <a href="https://bugs.launchpad.net/ubuntu/+source/rsyslog/+bug/401433">LP#401433</a> seems to suggest that some upgrade broke <code>imklog</code>. The fix suggested there would involve the following commands, but since my <code>/var/run</code> is a <code>tmpfs</cdoe>, I'd have to have this executed after every reboot (and before rsyslog starts):

<pre>
  mkdir -m0700 -p /var/run/rsyslog
  chown syslog:syslog /var/run/rsyslog
  mkfifo -m 600 /var/run/rsyslog/kmsg
  chown syslog:syslog /var/run/rsyslog/kmsg
  start-stop-daemon --start --pidfile /var/run/rsyslog/kmsgpipe.pid \
                    --exec /bin/dd -b -m -- if=/proc/kmsg of=/var/run/rsyslog/kmsg
</pre>

The <i>"real"</i> fix here was to apply a bit of Windows-fu *) to this setup and reinstall <code>rsyslog</code> :-\<br/><br/>

<small>*) The three Rs of Microsoft support: Retry, Reboot, Reinstall</small> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?190" rel="alternate" title="Partition Alignment Linkdump" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-07-05T18:17:00Z</published>
        <updated>2010-07-06T18:17:23Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=190</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=190</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?190</id>
        <title type="html">Partition Alignment Linkdump</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <ul>
<li><a href="http://blogs.sun.com/dlutz/entry/partition_alignment_guidelines_for_unified">
Partition Alignment Guidelines for Unified Storage</a> (July 01, 2010)</li>

<li><a href="http://www.vmware.com/pdf/esx3_partition_align.pdf">Recommendations for Aligning VMFS Partitions</a> (Feb 03, 2004), obsoleted by <a href="http://www.vmware.com/pdf/Perf_Best_Practices_vSphere4.0.pdf">Performance Best Practices for VMware vSphere 4.0</a> (July 30, 2009)</li>

<li><a href="http://www.tcpdump.com/kb/virtualization/vmware-esx-server/vmware-disk-alignment/intro.html">VMware Disk Alignment</a> (April 09, 2009)</li>

<li><a href="http://lonesysadmin.net/2006/05/20/vmware-io-problems/">VMware I/O Problems</a> (May 20, 2006)</li>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?189" rel="alternate" title="Mounting VirtualBox VDI images on a MacOS X host" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-06-25T17:06:15Z</published>
        <updated>2010-06-25T17:06:15Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=189</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=189</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?189</id>
        <title type="html">Mounting VirtualBox VDI images on a MacOS X host</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                During all this VirtualBox hackery stuff I came across an <a href="http://web.ivy.net/carton/rant/virtualbox-macos-hdiutil.html">interesting blogpost</a> on how to mount a VirtualBox VDI in MacOS X. That is, we don't really want to <i>mount</i> it, we merely want to access the VDI file via a blockdevice. In GNU/Linux or Solaris one would use <code>losetup</code> resp. <code>lofiadm</code> to attach <i>any</i> file to a blockdevice.<br/>

In MacOS X there's <a href="http://www.osxterminal.com/hdid.8.html">hdid</a>. By default, <code>hdid</code> not only tries to assign a blockdevice to the file but it tries to <i>mount</i> it too. We don't want this, so we use <code>-nomount</code>:

<pre>
$ hdid -nomount linux.vdi 
hdid: attach failed - not recognized
</pre>

Still, <code>hdid</code> failed. The blogpost above helped, we have to use the magic <code>.img</code> extension for the filename, oh well:

<pre>
$ ln linux.vdi linux.img
$ hdid -nomount linux.img
/dev/disk3
</pre>

However, we're still not entirely satisfied. Our <code>linux.vdi</code> contains a whole virtual disk (partition table + partion), so let's apply the blogpost above to our disk. Read the <a href="http://web.ivy.net/carton/rant/virtualbox-macos-hdiutil.html">post</a> again to understand what we do here:

<pre>
$ hexdump -C linux.vdi | grep -m1 ^00000150
00000150  00 00 00 00 00 02 00 00  00 <font color="red">22 00</font> 00 00 00 00 00  |........."......|
$ echo 'obase=16; 512; ibase=16; <font color="red">2200</font> / <font color="blue">200</font>' | bc
<font color="blue">200</font>
11
</pre>

Now that we have the offset to our <i>disk</i>, we can instruct <code>hdid</code> to just attach this disk (minus the VDI header):

<pre>
$ hdid -section 0x11 -nomount linux.img 
/dev/disk3              FDisk_partition_scheme
/dev/disk3s1            Linux
$ file -s /dev/disk3*
/dev/disk3:   x86 boot sector; partition 1: ID=0x83, starthead 1, startsector 63 [...]
/dev/disk3s1: Linux rev 1.0 ext4 filesystem data (extents) (large files) (huge files)
</pre>

Now we could even <code>fsck</code> our virtual Linux partion from MacOS, hey! :-) 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?187" rel="alternate" title="Virtualbox: How to resize a VDI disk" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-06-21T22:50:39Z</published>
        <updated>2010-06-25T17:06:07Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=187</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=187</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?187</id>
        <title type="html">Virtualbox: How to resize a VDI disk</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Resizing virtual disks (VDI, Virtual Disk Image) in Virtualbox is <a href="http://www.virtualbox.org/ticket/28">still not possible</a><small>*)</small>. There are several <a href="http://forums.virtualbox.org/viewtopic.php?f=3&t=17512">rather long tutorials</a> out there how to do this, that's the short version of it:

<ul>
<li>Create a new VDI disk of desired size. We've created a 2GB <code>deb02.vdi</code>, as our 1GB <code>deb01.vdi</code> was too small.</li><br/>
<li>Create a new VM, attach both the old (too small) and new (bigger, but still empty) disk to the VM, boot from a bootable CD, e.g. <a href="http://grml.org/">grml</a>.</li><br/>
<li>Once booted, we transfer the old disk (sda) to the new, bigger one (sdb):
  <pre>
  $ dd if=/dev/sda of=/dev/sdb bs=1M
  $ sfdisk -R /dev/sdb
  </pre>
Yes, that's right. We're just copying the whole disk (<i>with</i> its partition table!) to the new disk. I tried to just copy the partition and make it larger with <a href="http://www.gnu.org/software/parted/">GNU/parted</a>, but it kept barking about unsupported flags on the ext4 partiton (sdb1) and whatnot and I gave up quickly. Anyway, now we have a 2GB <code>sdb</code> with the partitiontable from <code>sda</code>, that is: <code>sdb1</code> is still 1GB in size, 1GB is unallocated space.</li><br/>
<li>Luckily our disklayout was easy enough (and we had a simple <a href="http://support.microsoft.com/kb/69912">MS-DOS partition-table</a>). Thus, we just started <a href="http://www.gnu.org/software/fdisk">cfdisk</a>, deleted <code>sdb1</code> and created a new <code>sdb1</code>, but filling out the whole disk (2GB).</li><br/>
<li><code>$ sfdisk -R /dev/sdb</code> again to re-read the partition-table.</li><br/>
<li>Now that our partition is in good shape, we need to enlarge the peni^W filesystem as well:
  <pre>
   $ e2fsck -vf /dev/sdb1
   $ resize2fs -p /dev/sdb1
  </pre>
We might have to mount <code>/dev/sdb1</code> for this, I don't remember.</li><br/>
</ul>

If all goes well, we should now have a perfectly good <code>sdb</code>, so we could go on and replace the small <code>deb0.vdi</code> VDI disk with the bigger one, <code>deb1.vdi</code>.

I've done this a few days ago and I already forgot wether I had to re-install the bootloader. But I'm sure you'll find out if you have to :-)<br/><br/><br/>

<small>*) as opposed to e.g. VMware, where it  <a href="http://communities.vmware.com/message/690626">should be possible</a> to <a href="http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&externalId=1004047">resize a virtual disk</a>. I've even done it <a href="http://nerdbynature.de/s9y/?89">once</a> :-)</small> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?188" rel="alternate" title="Migrating from VMware Server via OVF" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-06-08T22:08:00Z</published>
        <updated>2010-06-23T13:43:01Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=188</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=188</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?188</id>
        <title type="html">Migrating from VMware Server via OVF</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                After <a href="http://nerdbynature.de/s9y/?186">manually migrating a VMware VM to Virtualbox</a> and all the hackery involved (although it was fun to learn), we need to remember that we should be able to accomplish the same with the help of <a href="http://www.dmtf.org/newsroom/pr/view?item_key=3b542cbc5e6fc9ede97b9336c29f4c342c02c4e9">OVF</a>, the Open Virtual Machine Format. With that, things are a lot easier. Let's export that WindowsXP VMware-Server VM again, so that I can deploy it in a VMware-ESX Server later on:

<pre>
# ls -lgho *vmx* *vmdk
-rwxr-xr-x 1 2.0K 2010-06-22 21:54 winxp.vmx
-rw-r--r-- 1  278 2010-05-15 00:32 winxp.vmxf
-rw-r--r-- 1 6.0G 2010-06-08 00:22 winxp-flat.vmdk
-rw-r--r-- 1  435 2010-06-07 23:44 winxp.vmdk

# time <a href="http://communities.vmware.com/community/vmtn/vsphere/automationtools/ovf">ovftool</a> winxp.vmx winxp.ovf
Opening VMX source: winxp.vmx
Opening OVF target: winxp.ovf
Target: winxp.ovf
Disk Transfer Completed         
Completed successfully

real    13m25.328s
user    7m56.998s
sys     1m32.942s

# ls -lgho *vmx* *vmdk
[...]
-rw-r--r-- 1 3.1G 2010-06-22 22:07 winxp-disk1.vmdk
-rw-r--r-- 1 4.4K 2010-06-22 22:07 winxp.ovf
-rw-r--r-- 1  123 2010-06-22 22:07 winxp.mf
</pre>

Note that our 6GB <code>winxp-flat.vmdk</code> has been converted to a 3.1GB <code>winxp-disk1.vmdk</code>:

<pre>
# file winxp-flat.vmdk winxp-disk1.vmdk
winxp-flat.vmdk:      x86 boot sector, Microsoft Windows XP MBR
winxp-disk1.vmdk:     VMware4 disk image
</pre>

Now we can logon to our ESX Server an <i>deploy</i> the <code>winxp.ovf</code>. We <i>should</i> be able to import the same VM into VirtualBox (supported since <a href="http://www.virtualbox.org/wiki/Changelog-2.2">v2.2.0</a>), I did not try it though. So yeah, OVF FTW, hm? :) 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?186" rel="alternate" title="Migrating from VMware Server to VirtualBox" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-06-05T23:37:15Z</published>
        <updated>2010-06-18T16:37:10Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=186</wfw:comment>
    
        <slash:comments>3</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=186</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?186</id>
        <title type="html">Migrating from VMware Server to VirtualBox</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Even though <a href="http://communities.vmware.com/message/1536954">VMware Server was working fine with Ubuntu 10.04</a> (apart from random lockups without a backtrace in sight to debug with), I was kinda unhappy with all the hoops one has to go through just to get a virtual machine going. The kernel modules might break on the next upgrade and are <a href="http://www.kernel.org/pub/linux/docs/lkml/#s1-18">tainting</a> the kernel unnecessarily. Fortunately today we have a few virtualization options to pick from and I chose <a href="http://www.virtualbox.org/">VirtualBox</a> for this particular setup, as it seemed to be the easiest migration path. Let's begin with installing the prerequisites:<br/><br/>

<pre>
# apt-get install virtualbox-ose virtualbox-ose-dkms qemu
</pre>

Then we had to <a href="http://tuxnetworks.blogspot.com/2010/05/converting-vmware-vmdk-images-to.html">convert our 2GB-split VMware VMDK files</a> into a single <code>VMDK</code> file, otherwise <a href="http://www.ubuntugeek.com/howto-convert-vmware-image-to-virtualbox-image.html">qemu-bin</a> would produce empty <code>raw</code> files in the 2nd step:<br/><br/>

<pre>
# vmware-vdiskmanager -r orig/test.vmdk -t 2 test.vmdk
# qemu-img convert -O raw test-<font color="red">flat</font>.vmdk test.raw

# VBoxManage convertfromraw test.raw test.vdi
Converting from raw image file="test.raw" to file="test.vdi"...
Creating dynamic image with size 2147483648 bytes (2048MB)...

# ls -lgo *vmdk *raw *vdi
-rw------- 1 2147483648 2010-06-05 18:17 test-flat.vmdk
-rw-r--r-- 1 2147483648 2010-06-05 18:28 test.raw
-rw------- 1 1676681728 2010-06-06 12:50 test.vdi
-rw------- 1        432 2010-06-05 18:17 test.vmdk
</pre>

Somehow <a href="http://blogs.sun.com/VirtualGuru/entry/convert_amp_import_vm_virtual">VBoxManage cannot convert VMDK images directly</a>, hence the <code>qemu-img</code> step. All these conversions will take a while, depending on image-size and diskspeed. There's no progress-bar, so just be patient.

With our <code>VDI</code> image now in place, we can register it to VirtualBox:

<pre>
# VBoxManage openmedium disk test.vdi
# VBoxManage list hdds
UUID:       ddaaf826-3d25-48d6-9b2a-1afefdd3350f
Format:     VDI
Location:   /data/vbox-vm/test/test.vdi
Accessible: yes
Type:       normal
</pre>

Now for the actual virtual machine creation. It's important to create the new machine with the same/similar hardware as the initial VMware instance was configured with, so that the guest OS won't be too suprised about the "new" hardware, i.e. storage- or network-controllers.

<pre>
# <a href="http://www.virtualbox.org/manual/ch08.html">VBoxManage</a> createvm --ostype Debian --register --name "test" \
   --basefolder `pwd`
# VBoxManage modifyvm test --memory 128 --audio none \
   --boot1 disk --clipboard disabled
# VBoxManage modifyvm test --pae off --hwvirtex off \
  --hwvirtexexcl off --nestedpaging off --vtxvpid off
# VBoxManage modifyvm test --nic1 <a href="http://tuxnetworks.blogspot.com/2009/08/virtualbox3-headless-with-bridged.html">bridged</a> --bridgeadapter1 eth1 \
  --nictype1 Am79C970A --macaddress1 000c291ac243
</pre>

I've disabled any kind of hardware virtualization features, as the host-CPU is too old and doesn't support it anyway. Also, I used the MAC address of the VMware VM, so that the guest-OS will (hopefully) receive its known DHCP address.

Now for the storage devices. Again, try to use the same controller as configured in the VMware server (see the <code>.vmx</code> file of the old VMware instance). Also, we're attaching the virtual harddisk from above to our virtual machine.

<pre>
# VBoxManage storagectl test --name "SCSI Controller" \
   --add scsi --controller LsiLogic
# VBoxManage storageattach test --storagectl "SCSI Controller" \
   --port 0 --device 0 --type hdd --medium ddaaf826-3d25-48d6-9b2a-1afefdd3350f
</pre>

Having done that, it should look like this:

<pre>
# VBoxManage list -l vms | egrep 'Control|MAC'
Storage Controller Name (0):            SCSI Controller
Storage Controller Type (0):            LsiLogic
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  16
Storage Controller Port Count (0):      16
SCSI Controller (0, 0): /data/vbox-vm/test/test.vdi 
        (UUID: ddaaf826-3d25-48d6-9b2a-1afefdd3350f)
NIC 1:           MAC: 000C291AC243, Attachment: Bridged Interface \
                    'eth1', Cable connected: on, Trace: off (file: none), \
                    Type: Am79C970A, Reported speed: 0 Mbps
</pre>

Now our virtual machine should be able to start just fine:

<pre>
# VBoxHeadless -s test
</pre>

You probably want to remove the VMware tools from the guest (<code>vmware-uninstall-tools.pl<code>) and tweak your startscripts to start your VM during bootup.

Oh, and if the machine just won't start up, we can still cheat and install the VirtualBox GUI:

<pre>
# apt-get install virtualbox-ose-qt tightvncserver <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=484503">xfonts-base</a> wm2
</pre>

<b>Update:</b> Migrating a WindowsXM VM from VMware to Virtualbox was equally straightforward, but I could not get the NIC type right. Neither <code>Am79C970A</code> (PCnet-PCI II) nor <code>Am79C973</code> (PCnet-FAST III) seemed equal to the <code>VMware Accelerated AMD PCNet</code> Adapter in VMware. So I had to use the VirtualBox GUI again, as <a href="http://www.virtualbox.org/wiki/Editions">VirtualBox OSE does not ship with RDP</a> support to connect to. Also, the Ubuntu/Lucid version <a href="https://bugs.launchpad.net/ubuntu/+source/virtualbox-ose/+bug/588501">does not ship with VNC support</a>, yet. Here are the commands for the WindowsXP VM again:

<pre>
# VBoxManage createvm --ostype WindowsXP --register --name winxp --basefolder `pwd`
# qemu-img convert -O raw ../../vmware-vm/winxp/winxp-static-flat.vmdk winxp.raw
# VBoxManage convertfromraw winxp.raw winxp.vdi
# VBoxManage openmedium disk winxp.vdi
# VBoxManage modifyvm winxp --memory 256 --audio none --boot1 disk \
                     --clipboard disabled --pae off --hwvirtex off --hwvirtexexcl off \
                     --nestedpaging off --vtxvpid off --nic1 bridged \
                     --bridgeadapter1 eth1 --nictype1 Am79C970A \
                     --macaddress1 000c11b9c19c
# VBoxManage storagectl winxp --name "IDE Controller" --add ide --controller PIIX4
# VBoxManage storageattach winxp --storagectl "IDE Controller" --port 0 --device 0 \
                       --type hdd --medium a6723e4d-2caa-433d-91ec-f67238ff36a9
</pre> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?185" rel="alternate" title="iStat Menus alternative?" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-05-22T16:44:59Z</published>
        <updated>2010-05-24T01:22:00Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=185</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=185</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?185</id>
        <title type="html">iStat Menus alternative?</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                For quite some time now I'm using <a href="http://www.islayer.com/apps/istatmenus/">iStat Menus</a> (now by <a href="http://bjango.com/apps/istatmenus/">Bjango</a>). With its latest version 3, it's now a <a href="http://www.tuaw.com/2010/04/27/a-hands-on-look-at-istat-menus-3/">paid app</a> and one is <a href="http://forums.macrumors.com/showthread.php?t=913048">urged to upgrade</a> for $16. I don't mind the price so much, but the only reason (for me!) to upgrade would be a fix to <a href="http://getsatisfaction.com/bjango/topics/istat_date_menu_not_in_sync_with_system_time">one particular bug</a>, the rest is just <a href="http://www.joelonsoftware.com/articles/fog0000000020.html">bloat</a> I won't need anyway. With that being the case, I'm now looking for alternative programs for the features I'm currently using:

<ul>
<li><a href="http://www.eidac.de/?p=134">smcFanControl</a> - displays temperature and fanspeed in the menubar. It even offers to tweak the fanspeed (why would I want to do this??) but it doesn't display <a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man8/ioreg.8.html">all the other sensors</a> available. However it's <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">opensource</a>, so a big plus here!</li><br/>

<li><a href="http://www.ragingmenace.com/software/menumeters/">MenuMeters</a> - displays CPU and network load (also disk and memory, but I don't need that). Seems clean and simple enough. And it's <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">free</a> (not only as in "beer") too!</li></ul><br/>

The only feature left is the clock from iStat Menus where you can have different timezones displayed and a calendar on top. But maybe I finally have to make friends with the <a href="http://www.apple.com/downloads/dashboard/">dashboard</a> now. Oh well... 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?184" rel="alternate" title="Exim4 with clamd" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-05-18T23:02:04Z</published>
        <updated>2010-05-24T01:21:03Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=184</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=184</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?184</id>
        <title type="html">Exim4 with clamd</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Either my Xen DomU gets slower or my <a href="http://exim.org/">MTA</a> keeps getting busier. But when looking at the stats I could see that a lot of <a href="http://www.clamav.net/">clamscan</a> have been spawned on every <a href="http://fetchmail.berlios.de/">fetchmail</a>. Nothing unusual, this is how it always worked. But to be honest, the setup was rather inefficient, to say the least: for every incoming mail, <a href="http://www.courier-mta.org/maildrop/">maildrop</a> spawns a <code>clamscan</code> process, sometimes more than one in parallel. ps(1) shows, for just one process:

<pre>
 PID  %MEM    RSS    SZ    VSZ  COMMAND
 8749 12.8 164500 49081 196324 clamscan
</pre>

So, one process needs 12.8% of the systems memory, with just 5 process we're at 64% - and the box was indeed swapping heavily. So I finally got around *) to move the virus-scanning to Exim and let it speak to <code>clamd</code> instead:

<ul>
<li><code>/etc/exim4/conf.d/main/02_exim4-config_options</code></li>
<pre>
     +av_scanner = clamd:/var/run/clamav/clamd.ctl
</pre>

<li><code>/etc/exim4/conf.d/acl/40_exim4-config_check_data</code></li>
<pre>
     +  warn
     +    message = X-Virus-Status: Infected
     +    demime  = *
     +    malware = *
</pre>

<b>Note</b>: I chose <i>warn</i> over <i>deny</i> here - I still want to have those viruses, 
I just want to have it annotated&#160;:-)<br/><br/>

<li><code>/etc/clamav/clamd.conf</code></li>
<pre>
     User clamav
     AllowSupplementaryGroups true
     LocalSocketGroup Debian-exim
     LocalSocketMode 0660
</pre>
</ul>

For <a href="http://www.debian.org/releases/lenny/">Debian/5.0</a>, I also had to:

<pre>
# usermod -G Debian-exim clamav
# mkdir -m0770 /var/spool/exim4/scan
# chown Debian-exim:Debian-exim /var/spool/exim4/scan
</pre>

With all this in place (plus disabling the clamscan directives in <code>.mailfilter</code>), the box is far less loaded now. According to <code>ps(1)</code>, our single <code>clamd</code> now goes sometimes up to 16%, but that's still just one process and better than those >60% before.<br/><br/>

Btw, if you want to test your email AV setup and your mailprovider doesn't even allow the sending of the <a href="http://www.eicar.org/anti_virus_test_file.htm">Eicar Test File</a>, try <a href="http://www.aleph-tec.com/eicar/">this</a> instead.<br/><br/>

<b>Update:</b> And it helped indeed, see the <a href="/bits/misc/sar-20100524.txt">loadavg going down</a> after changing the configuration to use <code>clamd</code> now. Phew, now I wonder why I haven't done this earlier....<br/><br/>

<small>*) I hate MTA configurations, I really do :-\</small> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?183" rel="alternate" title="Notice of Claim of Copyright Infringement, pt. II" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-05-16T03:52:00Z</published>
        <updated>2010-05-16T20:53:12Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=183</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=183</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?183</id>
        <title type="html">Notice of Claim of Copyright Infringement, pt. II</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Almost to the hour two months after <a href="http://nerdbynature.de/s9y/?164">the last email</a> ("Harry Potter Audio Books", yeah...right) I got contacted again. This time someone thinks I'm distributing "Iron Man 2" (again, <a href="http://www.urbandictionary.com/define.php?term=srsly">srsly</a>?). The <a href="http://www.torproject.org/eff/tor-legal-faq.html.en">Tor legal FAQ</a> was helpful as always, so...let's see how this one pans out - if it does anything at all, I haven't gotten any reply to the first letter yet (apart from a Zimbra-mangled auto-reply). Is this a good sign? No? 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?182" rel="alternate" title="svn: Repository moved permanently; please relocate" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-05-13T18:48:19Z</published>
        <updated>2010-05-13T18:58:36Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=182</wfw:comment>
    
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=182</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?182</id>
        <title type="html">svn: Repository moved permanently; please relocate</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Apparently, <a href="http://isp-control.net/ispcp/wiki/releases_svn?action=diff&version=17&old_version=16">ispCP has changed its repository URL</a> (why :800? Think of the children^Wfirewalls!), leading to:

<pre>
$ svn update
svn: Repository moved permanently to 'http://isp-control.net/ispcp_svn/trunk' ; \
please relocate
</pre>

Luckily, <a href="http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.switch.html">svn switch</a> is here to help, the magic command to resolve this one was:

<pre>
$ svn switch --relocate \
  http://www.isp-control.net/ispcp_svn http://isp-control.net:800/ispcp_svn .

$ svn info | grep -A1 ^URL
URL: http://isp-control.net:800/ispcp_svn/trunk
Repository Root: http://isp-control.net:800/ispcp_svn
</pre> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://nerdbynature.de/s9y/?181" rel="alternate" title="That's When I Reach For My Resolver" />
        <author>
            <name>Christian</name>
                    </author>
    
        <published>2010-05-11T18:24:03Z</published>
        <updated>2010-05-11T18:53:32Z</updated>
        <wfw:comment>http://nerdbynature.de/s9y/wfwcomment.php?cid=181</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://nerdbynature.de/s9y/rss.php?version=atom1.0&amp;type=comments&amp;cid=181</wfw:commentRss>
    
            <category scheme="http://nerdbynature.de/s9y/categories/3-bits" label="bits" term="bits" />
    
        <id>http://nerdbynature.de/s9y/?181</id>
        <title type="html">That's When I Reach For My Resolver</title>
        <content type="xhtml" xml:base="http://nerdbynature.de/s9y/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                So, the primary nameserver is down but luckily <code>/etc/resolv.conf</code> has been equipped with a secodary nameserver entry - great! And <code>nslookup</code> works like a charm too, heh! But all the other <i>useful</i> tools are waiting for ages until they'll get a response from the backup server - why is that?

<pre>
$ time ping eve
eve is alive

real    0m30.045s
user    0m0.007s
sys     0m0.018s
</pre>

Other than e.g. <code>nslookup</code>, the <i>normal</i> applications have to use the the <a href="http://www.youtube.com/watch?v=R0v9a-x45gw">resolver(4)</a> to get their name requests answered. Now, we could cheat and put our backup server <i>before</i> the faulty one, but let's see if we can tackle this from a different angle. <a href="http://docs.sun.com/app/docs/doc/816-1058/6m7gjuj5k?a=view">resolv.conf(4)</a> was most helpful, of course:

<pre>
options
   Allows certain internal resolver variables to be modified.

timeout:n / retrans:n
   Sets the amount of time the resolver will wait for a response from a remote 
   name server before retrying the query by means of a different name server.
   Measured in seconds, the default is RES_TIMEOUT. See <resolv.h>

attempts:n / retry:n

   Sets the number of times the resolver will send a query to its name 
   servers before giving up and returning an error to the calling application.
   The default is RES_DFLRETRY. See <resolv.h>.
</pre>

In our <code>resolv.h</code> (Solaris 10) we have :

<pre>
$ egrep 'RES_TIMEOUT|RES_MAXRETRANS|RES_DFLRETRY' /usr/include/resolv.h
#define RES_TIMEOUT         5      /* min. seconds between retries */
#define RES_MAXRETRANS     30      /* only for resolv.conf/RES_OPTIONS */
#define RES_DFLRETRY        2      /* Default #/tries. */

</pre>

So, let's tweak those <code>options</code>:

<pre>
$ grep options /etc/resolv.conf 
options timeout:1 retry:<font color="red">1</font>

$ time ping trent
trent is alive

real    0m7.794s
user    0m0.007s
sys     0m0.018s
</pre>

Whooha, not bad. 

<pre>
$ grep options /etc/resolv.conf 
options timeout:1 retry:<font color="red">0</font>

$ time ping mallory
mallory is alive

real    0m2.100s
user    0m0.007s
sys     0m0.018s
</pre>

Even better. Of course, one has to realize that with <i>zero</i> retries the resolver will jump to the next nameserver on the first failure - so, if our backup server is a bit sleepy we won't get a reply at all.

If you enable <a href="http://docs.sun.com/app/docs/doc/816-5166/nscd-1m?a=view">nscd</a>, subsequent requests to the same name will be answered instantly:

<pre>
$ sudo svcadm enable svc:/system/name-service-cache
$ time ping mallory
mallory is alive

real    0m3.218s
user    0m0.007s
sys     0m0.018s

$ time ping mallory
mallory is alive

real    0m0.198s
user    0m0.007s
sys     0m0.017s
</pre> 
            </div>
        </content>
        
    </entry>

</feed>