Tuesday, June 23, 2009

Laptops are fairly standard nowadays, most of them working in different network environments. Thanks to DHCP, the network settings are happily adapting. Unfortunately, applications are not.
The typical problem are HTTP proxies. Just to enable or disable an HTTP proxy, I need to change the following:

  1. Set the http_proxy environment etc. variables, so that wget and friends are happy.
  2. Change the GNOME preferences. Of course, GNOME is not using the above environment variables.
  3. Edit the YUM configuration. Contrary to what the documents say, the environment variables still seem to be ignored. At least, I never got it working.
  4. Edit the Maven settings. Being a Java program, I find it understandable that environment variables are ignored. However, even if they weren't I'd need to change mirror settings too.
  5. Edit the Eclipse network configuration.
  6. Edit the Subversion proxy settings.

Change all that (and more, did I mention Firefox and Thunderbird?) with any reboot of my Laptop? Heavens, no! But, AFAIK, there is no tool available, which does that for me. So I wrote my own: It's called netprofiles.


The basic idea goes like this: There is a script, called


/etc/sysconfig/netprofiles.d/profile_chooser.sh

(This path and most others are configurable in /etc/sysconfig/netprofiles, I am using the defaults.) The purpose of the script is to detect one of a couple of profiles. In my case, this script is quite simple:


#!/bin/sh
if ping -c 1 -q httpprox.hq.sag >/dev/null 2>&1; then
echo "office"
else
echo "home"
fi

In other words, the script attempts to ping our corporate mailserver. If that works, then I'm in the office. Otherwise, I'm at home. These are my two profiles.

For any of my profiles, I create a directory /etc/sysconfig/netprofiles.d/.dir. In other words, my home profile is in /etc/sysconfig/netprofiles.d/home.dir and my office profile is in /etc/sysconfig/netprofiles.d/office.dir.


Now, take for example #1 in the above list. To set these environment variables, I have a file called /etc/sysconfig/netprofiles.d/office.dir/etc/profile.d/http_proxy.sh with the following contents:


export http_proxy=http://httpprox.hq.sag:8080/
export https_proxy=http://sslprox.hq.sag:443/

The corresponding file in the home profile would be either missing or empty. For any of the above settings, there is a corresponding file in the profile directories. Additionally, I need to add the file names to /etc/sysconfig/netprofiles.d/files. For example, this file list could look like this:


/etc/profile.d/http_proxy.sh
/etc/yum.conf
/home/jwi/.subversion/servers
/home/jwi/.m2/settings.xml
...

You get the idea.

But how are these settings activated? That happens, when the system comes up. The netprofiles script is located in /etc/init.d/netprofiles. Of course, you need links in /etc/rc?.d. On Fedora, these are created by running


/sbin/chkconfig --add netprofiles

And that's it.

What happens in case of changes to my configuration file? For example, my Maven settings are changing frequently. In that case, the system is clever enough to save my current version to the current profile, if the system is shutting down. (That's done by netprofiles stop.) Of course, the system can't update inactive profiles, but at least I only need to do these changes twice, once per profile, and not once per reboot.

Thursday, June 18, 2009

The new kid on the virtualization block

Last week, I happily upgraded my Linux installation to Fedora 11. As usual, this wasn't driven by any requirements, just by the fun to have the latest and greatest. (Do I hear Anjas "MEN!" :-) On the whole, things have improved. For example, my UMTS stick is now working out of the box. Monitor switching at work is now working nicely.

An obvious minus, however, is the integration of VMware. I am using VMware server 1, which is almost unsupported on Fedora in general. In particular, it it unsupported for Fedora 11. As usual, it was no problem to find a matching kernel patch. But, what a surprise, it is no longer sufficient to patch the VMware modules: You need to patch the kernel as well. Ok, I detected the procedure within one hour. But that means, that I will have to compile my own kernel with any kernel upgrade. Given the frequency of kernel updates on Fedora, I'll likely recompile every two weeks or so.

Brings up the question for alternatives. I have tried VMware server 2 in the past, but was definitely disappointed, because it is both a resource hog (for example, more than 400MB on disk!) and the lack of the former vmware-console just adds on. Nevertheless, I tried again. Just to detect that the same problem seems to be present: The kernel modules fail to load with the same error message of a missing symbol.

I never tried VirtualBox before, but this seemed to be a good enough reason to do it now. First impressions have been quite positive, until I tried to start a VM with a windows guest system. Obviously, that's not so easy: To get it work, you have to change some settings, fiddle with the windows registry (of course, before starting Windows ...) and similar niceties. Again, that's not what I'd like to have as a standard procedure. VM's should be easily adoptable from or given to colleagues.

So far, I was sticking to VMware server 1. But today, I detected the announcement of VirtualBox 3 beta. And, hard to believe, it just works, even with Windows guests imported from VMware. I think, VMware lost a user...

Monday, June 8, 2009

Automatically compiling VMWare modules

VMWare does, in general, an excellent job. It runs smoothless on my machine, generally being one of my best work horses. In particular, with VMWare Server coming at no cost.

There's an exception, though: The kernel modules. As usual, the problem doesn't exist on a Windows host (or guest, for that matter), but you've got to know how to deal with it on a Linux host. VMWare depends on a number of kernel modules, for example vmnet.o, which creates the virtual network interfaces. In theory, these modules are delivered as part of the VMWare distribution for a variety of Linux distributions. In practice, I am unaware of any example, where these precompiled modules could been used: I always needed to compile them for myself.

Ok, that's not too much trouble (at least not, if you've been able to obtain the right patch for your system, typically after a lot of Googling), basically all you need to do is to run vmware-config.pl (on the host) or vmware-config-tools.pl. However, one problem is still left: The procedure of recompiling the modules needs to happen after any Kernel upgrade again.

But here's a solution: An init-script, which is invoked before VMWare starts upon every reboot. The script checks, whether there are modules matching the running kernel. If not, vmware-config.pl is invoked with the necessary options for batch mode.

To install it, download the script here. Store it as /etc/init.d/vmware-kernel-modules. On Fedora-Linux, create the necessary links by running /sbin/chkconfig --add vmware-kernel-modules. On other distributions, this must be done manually.

Monday, May 11, 2009

Mobile Internet with Fedora 10 and Simply (T-Mobile)

I think, any experienced Linux user knows that feeling: Even while you generally feel fine with your OS, there are these moments when you ask yourself whether you should switch to Windows. Typically, these moments come whenever you've got some new hardware gadget.

In my case, this has been a so-called web'n'walk Stick from Germany's T-Mobile, which I intend to use for connecting to the Internet on travel. Unfortunately, I am quite frequently on the road, or visiting customers, where I cannot connect my Laptop to the network, so this thing will come in quite handy.

Would I be a Windows user (or perhaps a Mac fanatic), this wouldn't be worth posting: Of course, the device is neatly trimmed for Windows, making almost everything automatic. Basically, you plug it in, enter your PIN, and that's it. Not so with Linux, or (to be fair), at least not with Fedora Linux. I've got it running now (in fact, this post is written with the Ethernet disconnected), but that's after several hours of recherche, postings in mailing lists and in the Fedora Forum (not that these had any results). As usual, you need to understand what's going on, making yourself known to technical concepts, command line utilities and configuration files, which you never intended to know. And that's the reason for writing this: Perhaps I can save some other persons time.

The first thing to understand is this: In order to make life easier for Windows and Mac users, the device is running in one of two quite different operation modes. The first mode is the default mode: The stick acts as a very small USB drive. On Windows, this allows to automatically install software from it. Needless to say, there are no Linux drivers. (The good news: All drivers came as part of Fedora. :-) Also needless to say: This default mode is not what you want. You must deactivate it and switch to the other mode, where you can actually use the stick. (I assume that the installed software does that automatically on Windows.)

There are several tools and utilities for doing this switch: usb_modeswitch (which I choosed, because it comes with Fedora), rezero, ozerocdoff, and perhaps a multitude of others. (My guess is, it would help, if distributions could agree on a common choice here.) These tools typically need some configuration. To obtain this configuration, start looking at the output of


[jwi@mcjwi ~]$ /sbin/lsusb
Bus 001 Device 005: ID 413c:8103 Dell Computer Corp. Wireless 350 Bluetooth
Bus 001 Device 006: ID 0b97:7762 O2 Micro, Inc. Oz776 SmartCard Reader
Bus 001 Device 004: ID 0b97:7761 O2 Micro, Inc. Oz776 1.1 Hub
Bus 001 Device 002: ID 413c:a005 Dell Computer Corp. Internal 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 004: ID 0af0:6971 Option
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

If you don't know, which line belongs to your stick: Just remove it, run the program again, and see what changes. In my case, the interesting part is

  Bus 003 Device 004: ID 0af0:6971 Option

The ID consists of two parts: The so-called vendor ID (0af0) and the product ID (6971).

If you have usb_modeswitch, you might inspect a file called usb_modeswitch.conf (in my case /etc/usb_modeswitch.conf) and search for the above ID's. There's a good chance that you find them there. If not, enter them into Google, together with usb_modeswitch as an additional search term. Again, there's a good chance to find something. If not: Bad luck. I don't know what to do in that case, but I guess consulting the above tools mailing lists, forums, or whatever.

In my case, I've learned from the configuration file and some Internet pages that I've got to enter the command


sudo usb_modeswitch -v 0af0 -p 6971 -P 6971 -m 0x05 -M 55534243785634120100000080000601000000000000000000000000000000

to change the mode. First step done. If everything's fine, the following command should now provide some meaningful output:

  [jwi@mcjwi ~]$ hal-find-by-capability --capability=modem
/org/freedesktop/Hal/devices/usb_device_af0_6971_Serial_Number_if0_serial_unknown_1
/org/freedesktop/Hal/devices/usb_device_af0_6971_Serial_Number_if0_serial_unknown_0

Now enter NetworkManager (aka nm-connection-editor) and switch to "Mobile Broadband". Press "Add" to create a new connection. If you're lucky, you will find a popup like the following:


The second and third entry are default entries. The presence of the first entry shows you that NetworkManager recognized your stick. Needless to say: In my case, it didn't. After consulting the home page of usb_modeswitch I found out, that I need to load some other driver explicitly:

/sbin/modprobe option

In your case, this might be usbserial, rather than option. Sorry, can't help you here.

But if you can choose your "modem": Almost there! (Not yet, of course.) NetworkManager will open a window like the following:



(In the US, or to be precise, with CDMA this might look quite different.) The PIN and the PUK are what you get from your mobile broadband provider. If you're even luckier, the provider will tell you the other data as well, in the written data sheet, or at least on the hotline. Perhaps, you already guessed it: My provider didn't. ("We aren't supporting Linux.")

To find the remaining data, use Google again. In my case, the relevant search terms have been "T-Mobile APN PIN". (Simply is a reseller of T-Mobile) Another choice might be to consult the list of operators on the Gnome site. I've found the following entry there:

        
147
T-mobile
de
D1
internet.t-d1.de
t-d1

193.254.160.1
193.254.160.130



Tells me the APN (might be some servers host name?), and the password. (You should be able to ignore the DNS servers, as they are configured automatically.) In my case the user name was missing, but some more googling revealed the user name "Internet".

Believe it or not, but now it's working! (Might be, that you need to click on the NetworkManager's applet, if you didn't choose "Automatic Connect" and activate the connection.)

And now you know, why I clearly prefer a lot of Linux experience in profiles or curriculum vitae, when my employer hires: People who deal with that stuff should be ready for the problems we provide them with...

  

Monday, April 27, 2009

Awesome Coldplay video

A video I find myself watching over and over again is Live in Technicolor ii from Coldplay. Not only is it good music, it is also hilariously funny. I can so imagine standing with the other parents at Marie's Kindergarden party, looking absolutely blank at what's going on while the kids are celebrating. (I gather it's better to get used to that feeling.) My personal highlights are the crew members and the bikers crossing the stage.

Apache XML-RPC 3.1.2

Glad to announce the new version of Apache XML-RPC, available from the Apache Mirrors. As usual with this project, the bad olds are that the developers (including myself, of course) are almost gone. The project would be ready for archiving, unless (and that is the good news) it were for the contributors: This release was completely driven by users of Apache XML-RPC. Not a single bug fix or patch was created by the committers: Everything came from contributors through Jira or the mailing list. You can view it for yourself by looking on the changes. (And that list doesn't even include XMLRPC-163.) Imagine that with a closed source product.

Monday, April 20, 2009

NonApache.Org

It is now more than 5 years that I enjoy my status as an Apache committer. I still believe it is something to enjoy, although I am getting older and less active. I have learned to live with the realities that must be accepted: This applies, in particular, to the legal straitjacket, but also to the considerations that a community applies. A community? There are plenty of them, each of which very different: For example, the Webservices project tends to take things rather easy, whereas Commons, or Incubator can be quite formal: Javadoc jar file with or without META-INF/NOTICE.TXT? Good enough reason for hours and hours of discussion. Then, legal-discuss can be quite interesting. And the infrastructure mailing list is always a good place for listening what's going on. Sadly, it never paid for me to listen to jobs@apache.org. :-)

That said, there always are cases when I am not sure whether it's worth the hazzle. Running a project (effectively) on your own within the ASF basically means that you have the actual project work plus ASF related burdens. For example, pushing a Apache projects release can be quite some work: I honestly marvel at people like John Casey who has the patience to deliver 10 release candidates in a row. (I feel exhausted after three or four release candidates.) Compare that to the times of JaxMe 1 when I published a new release after almost any commit. Of course, that won't be possible for projects like Maven, or Axis. But there's something to the "Release early, release often" mantra.

I always thought that this uneasiness with the ASF procedures and the responsibility to the community would be my personal problem, (Let's face it: I'm much more of a Maverick than a team player.) until I read Robert Burell Donkin express similar feelings as the reason for starting RAT at Google Code. But what made me think even more was the recent discussion on a proposed Commons Incubator project: Obviously, there are a lot of projects, which are small and expect to remain small, would like to enter the ASF, but don't manage to overcome hurdles like the rule of at least three committers. Are they doing themselves something good?

The FSF is hosting a server called nongnu.org: It contains a lot of (mostly smaller) projects which manage themselves, which most likely feel attracted by or even close to the FSF and it's ideals. These projects don't have the FSF's holy endorsement (sorry, Incubator members, but that's what "endorse" reads to me sometimes), but they are able to work, to publish releases, to attract a community, almost everything an Apache project does.

I'd like to ask you to think whether it wouldn't it be a good idea to have something similar in the grey area of the ASF. For example, Apache Labs could almost immediately move - and finally start publishing releases. The sandbox projects - what could be a better place for living? I have no suggestions for the organizational details, but I think it's worth considering.