Monday, March 12, 2007

Macbook and Linux

I got the latest Macbook Core 2 duo (Mar 2007) and really liked the new OS with the speed of Intel Core 2 Duo processors. At first I found it hard to use OS X, mainly with the keyboard layout and new shortcuts, but I liked a few things about Mac. Few of the UI things were really mind blowing, but then I was lost trying to find a few things. I am more of a Linux fan, but Mac OS X seems to be a better alternative to the more dominant Windows. I found the Mac experience better compared to Linux, since most of the things work straight out of the box. I know Linux requires a bit more work in that area, but I am sure it will catch up soon.
Being a hard core Linux fan, I thought of installing Linux in my Macbook.
I had used bootcamp to partition the drive, but unfortunately I pressed OK somewhere and created only a 5GB Linux partition :(. I had also installed reFit for dual booting OS X and Linux.
I managed to install Fedora Core 6 64 bit version on this 5GB parition, but I was not able to boot because of some partition synchnozation issues. MacBook uses the new EFI partition. Many of the Linux tools like parted, etc is aware of this partitioning scheme, the Linux installers does not work straight out of the box :(. I had to do a few reboots and do synchronization using reFit.
I was impressed by the new effects in FC6. The cube effect and other desktop effects were really cool.
The new wireless card is not supported yet (Mar 2007) and I had to use the wired network to browse the internet. I saw Flash 9 was available, but could not have it working because of my 64 bit version. I could use ndiswrapper to make the wifi card work, but it required a 32 bit OS. I also had a 5GB linux partition, which was not enough by any means. I wanted to increase the partition and thought about installing different Linux versions in Macbook. Then I had some issues resizing and I had to completely remove the Linux partition and start from scratch. I did not want to install OS X again, so I had a 40GB OS X partition which I did not touch. I wanted to install various Linux versions and with the new EFI partitioning, there was a limitation of the number of partitions you can have. I wish there was something like extended partition to satisfy my ambitious goal of installing multiple Linux distribution. In my previous IBM thinkpad I had 3 Linux distributions and one other OS. (MS Windows which I rarely used). I found that one way I could achieve that in my Macbook is to use LVM and dynamically resize the partitions and create new partitions for new distributions that I want to install. Unfortunately Ubuntu at that time (or maybe even now) did not have support for LVM and Gentoo live CD did not work that well - X did not start and I tried running some install scripts from command line which failed.
I downloaded FC6 32bit version now and I burned a DVD. I booted using the FC6 DVD and created LVM partitions. So I had four partitions now - two of them were the EFI partition and the MAC hfs+ partition which I did not touch. I had to create a boot partition of 100+MB, since boot partition cannot reside on LVMs. I then created few partitions inside LVM - one of them was the / partition and others were partitions like /home and /opt. /home will be shared with all the distributions once I have more distributions installed.
After installing I got the basic rpm's like mplayer, flash which are not there by default. I was forced to use Yum, though I am not a big fan of Yum. I like apt-get and I am aware of the apt-get port for rpm, but recently I have been using the defaults provided by the distribution. With Ubuntu apt-get is the default since its debian based and I really like that command :). I have used Smart with OpenSuse - which was not bad.
I used ndiswrapper with a binary driver for some time and was irritated by the frequent kernel crash. I had no choice but to use this driver or stay near a wired network :(. I was constantly tracking ticket 1001 in madwifi and finally one fine day there was an announcement that support for the card with device id 024 is finally available. I checked out the madwifi branch and everything worked fine with an access point without encryption. But with WEP it did not work and I am now tracking ticket number 1243 and hoping to have WEP support soon! WEP support is finally available (Yay and thanks to all those developers who made this possible) for device id 024 ( the one that comes with Macbook). To compile the madwifi drivers, get the following branch of madwifi:

svn co madwifi-wep
#bash# cd madwifi-wep
#bash# make && make install
#bash# modprobe ath_pci
(also added the following entry in modprobe.conf
alias wifi0 ath_pci
NetworkManager in Fedora did not detect the card even after restarting it several times. May be it was some issue with uninstalling the previous version of madwifi driver that I had installed. I had to reboot (I have never done that in Linux, except for Kernel upgrades) to find that NetworkManager worked perfectly and I was just able to connect to a WEP based network using this new driver.

I do have issues with hibernation and suspend. It does suspend or hibernate properly, but after restoring, X behaves strangely. The mouse pointer sometime vanishes or the mouse pointer gets caught in a small area in the top left corner of the screen. I will have to kill X to get a usable desktop.
Microphone issues: The soundcard works fine, but the microphone does not work. I discovered that when I was trying to call someone in Skype and the other person was not able to hear anything. I am yet to apply the mactel patches to get the microphone working.
Battery Usage: I noticed my battery gets drained very fast in Fedora and so I usually have my power cord connected while using Linux. I tried stopping a few services but that did not help. I think I have to remove some modules and that may increase the battery life.