As the old saying “If necessity is the mother of all invention, the frustration is the father of all”. In my case, necessity and frustration is the motivation behind this article. There are two things which I have struggled while setting up Ubuntu 6.10 on my Thinkpad T22 laptop. The first and most frustrating thing is setting up wifi using 2Wire 802.11g PC Card and it is the subject of this article. This should apply to any laptop, using 2Wire PC card or PC Cards belonging to the same chipset (Intersil ISL3886). The second thing is the intermittent blank screen (freezing issue) while boot up with Thinkpad T22 after installing Ubuntu 6.10. I am going to cover that in my next article.

Before going on to the actual How-to’s and instructions, let me give a brief history on where I was, before getting here. As you might know, Think T22 model is more than 4 years old and some of the current tools & softwares I work with, doesn’t run on this laptop. For the cost of upgrading this laptop, I might as well go for a new laptop. So, I planned on making this laptop a linux workstation. Initially, I installed Kubuntu 6.06 and played around a bit, everything worked perfectly fine expect the wireless access. I tried KNetworkManager,Wifi radar and every other tool I can get, to make this laptop wifi enabled. Instead of making it to work, I ended up getting more and more frustrated. I posted my questions in linux forums, talked to linux experts, but, nothing seem to work. I struggled on & off for almost 6 months before making this happen.

After getting lost in the twilight zone, struggling to get my wireless card to work, I decided to take a step back and start everything from the scratch. I planned to install Ubuntu 6.10, which was a stable release at that time. Incase, if you haven’t installed Ubuntu on your PC or laptop, believe me it’s a no-brainer. Even if you are a hardcore Windows user, it’s almost as easy as installing Windows XP or Vista. Burn the installation CD, boot it and follow the prompts, Ubuntu will install as easy as 1, 2 & 3

Alright, enough of stories, lets get down to the meat of this article. For some reason, the pre-bundled Ubuntu 6.10 PCI drivers that was getting loaded for 2Wire 802.11g card doesn’t work properly. So, we need to install Windows native driver available for 2Wire 802.11g on Ubuntu using NDiswrapper. Before following the steps described below, make sure you have a wired internet connection, because, we need to download some additional software packages from web. Here are the steps…

  1. Disable the currently loaded wrong drivers for the PC Card by blacklisting them

    		sudo gedit /etc/modprobe.d/blacklist
    	

    Add the following lines in the end

    		# blacklist the wrongly loaded drivers for 2Wire 802.11g wireless PC Card 
    		blacklist islsm
    		blacklist islsm_pci
    		blacklist islsm_device
    		blacklist prism54
    	
  2. Install NDiswrapper 1.42 by building it yourself
    Note: I did “sudo apt-get install ndiswrapper”, for some reason, it was not installing properly.

    Inorder to compile the packages from source, make sure you have all the necessary development tools (i.e. libraries, compilers, headers).

    		sudo aptitude install build-essential
    		sudo aptitude install linux-headers-`uname -r`
    	
    		Download NDiswrapper 1.42  tar
    		tar -zxvf ndiswrapper-1.42.tar.gz
    		cd ndiswrapper-1.42
    		sudo make install
    	

    Note: Incase, if you messed something in the above step, don’t worry, you can uninstall and re-install it again as explained in NDiswrapper instructions

  3. Install windows driver
    Note: The downloaded driver from 2Wire’s website didn’t work for me. So, I have to download it from Fujitsu Siemens

    		#Goto the folder, wherever you extracted the driver zip file 
    		sudo ndiswrapper -i prismA00.inf (this is the windows .inf driver information file)
    		sudo ndiswrapper -l (shows if the driver is installed properly)
    		sudo modprobe ndiswrapper (make sure if ndiswrapper is loading properly)
    		sudo ndiswrapper -m (add entry for ndiswrapper in /etc/modprobe.d/)
    		
    		#For some strange reasons, NDiswrapper was not automatically loading for me during start-up. So, I had to add it to /etc/rc.local.
    		sudo gedit /etc/rc.local
    		#before the line "exit 0", add the following line
    		modprobe ndiswrapper
    	
  4. Install Network Manager applet
    sudo apt-get install networkmanager
  5. Restart the machine

    If all of the above steps went well, you should be able to see an icon on the top right. If you right click on it, you should be able to see the list of wireless lan within the range. Incase, if you are installing network manager for the first time, you might need to create a password keyring. This is a password for network manager applet, not a passphrase for your wireless network.

After all the struggle I went through, I could really feel the moment of satisfaction. It was such a relief and really worth it. I do feel, I mastered linux more than I knew before. And now, the IntelliJ 6.0.5 running on my Thinkpad T22(Ubuntu 6.10) is performing much better than my new Thinkpad T44 (Windows XP)

References

I was working on a technical presentation with the topic “Performance Engineering in Java platform”. This presentation is to emphasize on various techniques and tools used for performance optimization and tuning. While I was working on this presentation, I googled for examples showing memory leak in Java application. I couldn’t find any convincing examples and moreover, the discussions in Java forums are touting “there is no such thing as memory leak in Java”, due to its automatic memory management. That kept me wondering… Is it true ? May be memory leak is impossible in Java ?

I have worked on various profiling tools like JProfiler, Introscope, Rational Quantify etc. etc. But, lately, I am hooked on to JConsole, a JMX compliant performance monitoring tool available since JDK 5. The good thing about this tool is, it doesn’t need any license, very simple to setup and straight to the point. It would let you monitor memory pools, class loading status, thread status and also manage MBeans.

I picked one of my current project which is running on Tomcat 5.0.28 and using Spring IOC & XStream serialization library as case study for this presentation. I started monitoring this app using JConsole and captured the memory usage & statistics on various scenarios and use cases. During this course, I had to re-deploy this app to Tomcat so many times. And, to my surprise, Voila… Tomcat was broken and it spitted out the most dreadful “OutOfMemoryError” permGen space in its console. Initially, I didn’t know who to blame, but, I listed out the usual suspects. May be the application code has some memory leaks or may be Spring is unnecessarily instantiating all the beans, or may be XStream which does xml serialization using reflection is the culprit. I started analyzing carefully from all those angles. I wrote a simple stress/load test using ANT script, which would just un-deploy and deploy the app to Tomcat for 25 times. While the script is running, I monitored the “Perm Gen” memory pool usage. Theoretically when the app is un-deployed the “Perm Gen” memory pool usage should come down, but, it wasn’t coming down, and the memory usage was climbing higher and higher for every un-deploy & deploy cycle. Same is the case with number of classes being unloaded. Only trivial amount of classes were getting unloaded for the whole test run. PermGen pool is used by JVM to store the metadata information about classes and methods. This obviously proved that there is something wrong in Tomcat class loaders, it was not releasing or unloading the classes.

So, what’s the solution, I could increase the maximum perm size by setting -XXMaxPermSize JVM option. Is that going to be a permanent fix? Obviously not, If Tomcat dies in 24 successive deployments now, after I increase the max perm size, it might break at 24+nth deployment. I started doing some research online regarding this issue. There are some recommendations like using JDK 1.6 instead of JDK 1.5 (I was using jdk1.5.0_06 for this exercise). I tried that, but it was the same. Then, I thought, lets try the latest version of Tomcat (At the time of this writing v6.0.10 is the latest stable release). I ran my test script with the same application code against the new version of Tomcat. Wow… the test passed, the memory pool usage & no. of classes getting loaded was going up & down as it is supposed to and there was NO “OutOfMemoryError”. Tomcat 5.0.28 supposedly had a bug in “WebAppClassLoader”, which was unnecessarily holding references to the classes being loaded dynamically.


Here are the lessons learned… No software is 100% bug free. I have been using Tomcat for long time and it’s one of the very strong and stable open-source product I have ever used. But, still, you can find things like this.
Garbage Collection is just a “Machine Intelligence” process. Never underestimate “Human Intelligence” over “Machine Intelligence”.