VMWare Player 3 vs Linux 2.6.32

I wanted to test some crap in VMWare, didn’t feel like messing with the entire server thing so went for the player. Unfortunately, this thing doesn’t work against the 2.6.32 kernel.

After installation, you can fix it with as follows (as root):


cd /tmp
tar xf /usr/lib/vmware/modules/source/vmnet.tar
tar xf /usr/lib/vmware/modules/source/vmci.tar

cd vmnet-only
sed -i "/vnetInt.h/ a\#include \"compat_sched.h\"" vnetUserListener.c

cd ../vmci-only/include
sed -i "/compat_page.h/ a\#include \"compat_sched.h\"" pgtbl.h

cd /tmp
tar cf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only
tar cf /usr/lib/vmware/modules/source/vmci.tar vmci-only

and rerun vmplayer.

Using an Alcatel X200 under Linux

I recently purchased an Alcatel Onetouch X200 3G USB modem, to be able to use internet on various locations where there is no wired or wifi available. Works fine under Windows/Mac OS X, bit more of a hassle under Linux.

Here are some hints on how to get it to work:

  • You need to install usb-modeswitch to switch the card from it’s builtin usb-storage mode to the USBModem mode. Configuration is done in /etc/usb_modeswitch.conf
  • Use /dev/ttyUSB2. The other two ports that your modem will give don’t really work well.
  • Also, use atleast kernel 2.6.31. Earlier ones might not work.
  • Disable PIN authentication on your SIMcard! This one thing was what kept it from working decently – I tried tons of things, and when I disabled the PIN, it worked nearly instantaneously.
    The command to do PIN auth is AT+CPIN=1111 (changing 1111 by your actual PIN), but when issuing this command the modem accepts it, but very often freaks out afterwards. Weird.
    You can find a nice list of GSM modem AT codes on gsm-modem.de.

Thats about it!

Autoswitching network interfaces

Since I’m a lazy git, I want my laptop to automatically switch back & forth between my wired and wireless interfaces. Seems that stuff like Network Manager can do that for you, but it’s not really my thing. I don’t like stuff where you need a GUI to configure it, a duplicaton of network configuration, and it also tends to hang my machine. No idea why, though.

After an afternoon of fiddling around with several things, I came up with the recipe:
1 portion ifplugd, a good mix of ifupdown configuration with guessnet mappings, and some home-grown scripts. Mix well, and let simmer over a hot stove for half an hour. ;)

The details (tailored to Debian Sid):

  1. Install ifplugd and guessnet: apt-get install ifplugd guessnet
  2. Configure the interface you want ifplugd to monitor. For me, this is eth0 (wired ethernet). You can do this by editing /etc/default/ifplugd and adding eth0 in the INTERFACES field.
    Restart ifplugd (/etc/init.d/ifplugd restart)
  3. Edit your /etc/network/interfaces file the way you like it. I’m using multiple wireless entries with guessnet:
    mapping ath0
            script guessnet-ifupdown
            map verbose: false
            map debug: false
            map autofilter: true
    
    iface ath0-work inet dhcp
            test wireless essid WORK
            wpa-ssid WORK
            wpa-key-mgmt WPA-PSK
            wpa-proto WPA
            wpa-psk "***"
            wpa-driver wext
    
    iface ath0-home inet dhcp
            test wireless essid HOME
            wpa-ssid HOME
            wpa-key-mgmt WPA-PSK
            wpa-proto WPA
            wpa-psk "***"
            wpa-driver wext
    

    For syntax info, see man guessnet

  4. Replace the script in /etc/ifplugd/action.d with something more usable. The installed script only calls ifup or ifdown depending on what’s happening. What we want is to ifdown the interface, and ifup the other.

    Something like this:

    #!/bin/sh
    set -e
    
    WIRED_INTERFACE="eth0"
    WIFI_INTERFACE="ath0"
    WIFI_MODULE="ath_pci"
    IFUPDOWN_STATE="/etc/network/run/ifstate"
    
    if [ $# -ne 2 ]; then
            echo "Incorrect usage!"
            echo "$0:  "
            exit 1
    fi
    
    case "$2" in
    up)
            if [ "$1" = $WIRED_INTERFACE ]; then
                    # Wired interface is going up, bring wireless down
                    # if it is active.
                    WIFI_MODULE_LOADED=$(lsmod | grep ^$WIFI_MODULE | wc -l)
                    if [ $WIFI_MODULE_LOADED -eq 1 ]; then
                            /sbin/ifdown $WIFI_INTERFACE
                            /sbin/rmmod $WIFI_MODULE
                    fi
                    /sbin/ifup $WIRED_INTERFACE
            else
                    /sbin/ifup $1
            fi
            ;;
    down)
            if [ "$1" = $WIRED_INTERFACE ]; then
                    # Wired interface is going down, bring up the
                    # wireless one.
                    /sbin/ifdown $WIRED_INTERFACE
    
                    /sbin/modprobe $WIFI_MODULE
                    /sbin/ifconfig $WIFI_INTERFACE up
                    sleep 5
                    /sbin/ifup $WIFI_INTERFACE
    
                    WIFI_CONFIGURED=$(grep ^$WIFI_INTERFACE $IFUPDOWN_STATE | wc -l)
                    if [ $WIFI_CONFIGURED -eq 0 ]; then
                            # Interface was not configured, bring it back down
                            # to save power
                            /sbin/rmmod $WIFI_MODULE
                    fi
            else
                    /sbin/ifdown $1
            fi
            ;;
    esac
    

Now, every time ifplugd configures up eth0, ath0 is automatically deconfigured, and vice versa.
The actual configuration of the interfaces is still in /etc/network/interfaces, so you can still handle it by hand if you want to.

As always, it works fine for me, but YMMV, and TIMTOWTDI!

Linux on the Apple Macbook

I was bored recently, and decided to install Linux on my Macbook. I opted for the distribution I like best – Debian (unstable/Sid).

After some twiddling it all works rather well, I’m amazed how well ;) Even suspend to ram works flawlessly! (that was a different case a year ago, when I last had linux on a laptop). The only things I still have to get working is the framebuffer console (so I get something better than 80×25), and the infrared. Nothing very high on the agenda, though :)

I’ve detailed the installation instructions in this post.

VMWare server 2.0 with kernel 2.6.28

I just finished updating my machine to the latest Linux kernel, 2.6.28. All worked, except for VMWare Server (which was still at 1.0.8). Since 2.0 has been released, time for an upgrade!

Downloaded, installed, configuration didn’t work for the vsock module. Actually, it built, but failed to load due to some missing symbols. After some digging I came across the following patch that modifies the vmware-config.pl script:

(note: very bad wordwrapping here, download the file below and use that!)

--- /usr/bin/vmware-config.pl.orig 2008-11-28 12:06:35.641054086 +0100
+++ /usr/bin/vmware-config.pl 2008-11-28 12:30:38.593304082 +0100
@@ -4121,6 +4121,11 @@
return 'no';
}

+ if ($name eq 'vsock') {
+ print wrap("VMWare config patch VSOCK!\n");
+ system(shell_string($gHelper{'mv'}) . ' -vi ' . shell_string($build_dir . '/../Module.symvers') . ' ' . shell_string($build_dir . '/vsock-only/' ));
+ }
+
print wrap('Building the ' . $name . ' module.' . "\n\n", 0);
if (system(shell_string($gHelper{'make'}) . ' -C '
. shell_string($build_dir . '/' . $name . '-only')
@@ -4143,6 +4148,10 @@
if (try_module($name, $build_dir . '/' . $name . '.o', 0, 1)) {
print wrap('The ' . $name . ' module loads perfectly into the running kernel.'
. "\n\n", 0);
+ if ($name eq 'vmci') {
+ print wrap("VMWare config patch VMCI!\n");
+ system(shell_string($gHelper{'cp'}) . ' -vi ' . shell_string($build_dir.'/vmci-only/Module.symvers') . ' ' . shell_string($build_dir . '/../'));
+ }
remove_tmp_dir($build_dir);
return 'yes';
}

To use it, download vmware-configplpatch.txt, and run
cat vmware-configplpatch.txt | patch -p0, and rerun the VMWare configuration script.

Thanks to this post on the Ubuntu Forums for the solution!

Cadaver and proxy auth

At work we regularly have to send over files to $vendor. $Vendor has two ways of accepting files: FTP, and Webdav (over https). Since our company’s policy is to not send things out unencrypted, we have to go the webdav way. It’s also the policy to send things over our internetproxy if possible.

After some searching for a console-based webdav client we ran across cadaver, a lightweight client that seemed to do the trick. It has proxy support, so great ;)

What isn’t so great is that it doesn’t have any way to supply the proxy authentication in a non-interactive way, which is crucial to allow us to script this file transfer.

Today I took the time to create a patch that allows just that – setting the proxy info in advance. It also includes a parameter to trust the server certificate implicitly, otherwise it was yet another step where cadaver would come and ask for user input.

Now it works like a charm! :)

Reading DRM’ed Adobe Ebooks on Linux

Sade linked me to this nice ebook by Neil Gaiman, Neverwhere. Unfortunately, you need Adobe Digital Editions for it, which only exists for Windows and Mac. Since she’s a Linux user, that one didn’t really fly with her.

So, to get that thing to work, here’s a very low-tech way of doing it:

  1. Install Digital Editions on a supported OS (I used Mac OS)
  2. Download/open the ebook’s ebx.etd file
  3. Let Digital Editions open, download and authenticate the file
  4. Print to PDF 40 pages (the damn thing won’t let you print more)
  5. Close the digital Editions app
  6. Delete (in my case) the ~/Documents/Digital Editions directory
  7. Reload the webpage
  8. Goto step 2

Repeating this until you have the entire ebook in PDF’s for easy reading at home, under your favourite OS / device! ;)

Iodine (dns tunnel) on your Mac (to escape those evil firewalls)

Here’s a short how-to to get the iodine dns tunnel working on your Mac.

In this short howto, I’ll assume you’ll be using a linux server to act as your gateway to the world. I’ll also assume you’ve read the iodine documentation and setup your DNS accordingly. For my example, I’ll be using a (nonexistant) DynDNS.org static DNS entry, iodine.rulestheworld.tld. I’ll also assume that you’ll be using a public internet address of 1.2.3.4, and a private subnet of 10.0.0.1.

  1. Install the tun/tap driver for Mac OS X. Easy as doing *click* *click* done! :p
  2. Next, install iodine on your Mac. Easy as download, extract, and typing make; make install
  3. Now, install iodine on your linux box. It’s included in the package repositories of the usual suspects, for instance debian: apt-get install iodine.

    Start it (or configure it to use) with:
    iodined -P <password> <unused private IP> <dns name>
    or in our example:
    iodined -P mypass 10.0.0.1 iodine.rulestheworld.tld

    This should return the following:

    Opened dns0
    Setting IP of dns0 to 10.0.0.1
    Setting MTU of dns0 to 1024
    Opened UDP socket
    Listening to dns for domain iodine.rulestheworld.tld

  4. Configure your linux box for IP forwarding: sysctl -e net.ipv4.ip_forward=1
    (and add this to your /etc/sysctl.conf file), and configuring your firewall (iptables) for masquerading:
    iptables -t nat -A POSTROUTING -s 10.0.0.0/255.255.255.0 -o eth0 -j MASQUERADE
  5. Next, download NStun.sh, a very handy script that does all the hard work of changing the routes and so on :p

    You’ll want to change the script: change the first lines as the script reads, and lower, change the

    NS=`grep nameserver /etc/resolv.conf|head -1|awk ‘{print $2}’`

    line to read

    NS=”62.213.207.197″

Now, start NStun.sh on your Mac, and surf away! (well, slowly, but freely, atleast!)

CoRD and xrdp

I was trying to get xrdp running on my Linux box, so I could takeover the screen from the outside world. The rdp protocol is a (huge) bit more performant than VNC, which is why I wanted to use it.

Today I was trying for the 3rd time to get it to work, using CoRD as an RDP client, but I never got any image back – the client started, I saw the connection being built up, but I never got any image over. Starting rdesktop locally gave me the output I expected.

This gave me the idea of using Microsoft Remote Desktop Connection Client for Mac 2 Public Beta, to see if it might be a problem with the client… and yup, it is.

Seems CoRD 0.4.3 (the current stable) is unable to handle the output of xrdp. I now installed the 0.5 beta 1 which works without any problems.