I’ve done 3 upgrades to Debian lenny over the last week or so. I started off with my work desktop, a Dell Optiplex 745, followed by my home desktop AMD64, and finally my MacBook. Apart from some very minor problems, the upgrade went very smoothly, and everything works fine afterwards.

I had no issues upgrading the Optiplex – everything just worked.

On the AMD64, the biggest problem was with the installer for the NVidia binary drivers. It installs the X11 drivers in /usr/X11R6/lib/modules/. For the Xorg version in lenny, these need to reside in /usr/lib/xorg/modules/. The problem was easily found (the Xorg.0.log file pointed to a missing nvidia driver), and easily fixed (dpkg -L xserver-xorg-video-intel showed where the driver files should now reside).

cp /usr/X11R6/lib/modules/drivers/nvidia_drv.so /usr/lib/xorg/modules/drivers/
cp /usr/X11R6/lib/modules/extensions/libglx* /usr/lib/xorg/modules/extensions/

The MacBook upgrade went smoothly aswell, with the usual caveats. My kernel isn’t managed by apt because I apply the mactel patches to it. So, after the dist-upgrade, I got the new kernel sources, applied the latest mactel patches, built the package and installed it. I also built the headers package, and installed that to build and install the madwifi drivers for the atheros wireless card.

apt-get source linux-image-2.6.22-2-686
cd mactel/kernel/mactel-patches-2.6.22
./apply ../../../linux-2.6-2.6.22
cd ../../../linux-2.6-2.6.22
make oldconfig
make-kpkg –initrd linux-image
make-kpkg linux-headers
dpkg -i ../linux-image-*.deb ../linux-headers-*.deb

I rebooted before building and installing the madwifi drivers.

cd /usr/src/modules/madwifi
make -C /lib/modules/2.6.22*/build SUBDIRS=`pwd` modules
make -C /lib/modules/2.6.22*/build SUBDIRS=`pwd` modules_install
modprobe ath_pci

And that’s it. All three machines are running lenny now with no problems.



The latest apt-get update && apt-get upgrade had a kernel update to 2.6.18-5. This kernel is still missing some of the Macbook patches, so I had to get the source, patch and build a package. This took longer than I thought, because a few things had changed. So, here are the bits and pieces that I had to do to get my Macbook back to working the way it had been.

Firstly get the source for this new kernel with apt-get source linux-image-2.6.18-5-686. This downloads the kernel source to a linux-2.6-2.6.21 directory.

If you haven’t already, get the Mactel patches from the Subversion repository at https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk; cd into the kernel/mactel-patches-2.6.21/ directory and run ./apply /path/to/linux/source.

At this point, you should configure the kernel. To do this, I used make oldconfig. You can go with the default on most of the new options you’re prompted on I think. The only ones I changed were some of the Apple specific ones. Watch out for them, and decide yourself if you want to include them. I can’t remember off-hand right now what they were.

After building, installing and booting this new kernel, it looked like the harddrive was renamed from sda to hda. However, using hda only got the system to boot a small bit further (this was using a root=/dev/hda3 kernel boot parameter, and changing sda to hda in /etc/fstab). To fix this, in the kernel configuration (I used make menuconfig), do the following

  • Under Device drivers, turn off ATA/ATAPI/MFM/RLL Support
  • Under Serial ATA (prod) and Parallel ATA (experimental) drivers, set both ATA device support and Intel ESB, ICH, PIIX3, PIIX4, PATA/SATA support to ‘m’ (to build kernel modules instead of compiling support into the kernel)

While you’re configuring the kernel, do the following also, if, like me, you change the order of the F keys and the FN keys.

  • Under HID Devices, set Generic HID support to ‘m’ instead of ‘y’

I like the F keys first, so in previous kernels I set pb_fnmode=2 for the usbhid module. However, this option moved to the hid module at some point, but in the default debian kernel build, hid is built into the kernel. I rebuilt it as a module and put

options hid pb_fnmode=2

into /etc/modprobe.d/options. If you have a similar line for usbhid in there already, comment it out.

At this point, you should compile and install your new kernel. The commands below also create a kernel headers package, as well as the kernel image package, which you can skip if you don’t require it.

make-kpkg clean
make-kpkg –initrd kernel-image
make-kpkg kernel-headers
dpkg -i ../linux-image-2.6.21-mactel*
dpkg -i ../linux-headers-2.6.21-mactel*
lilo

I’m using lilo as the bootloader. If you’re using grub, replace the lilo command above with grub-install to update the MBR with the new kernel image.

You can now reboot to the new kernel.

The last thing I can think of is to install the madwifi drivers for the wireless card.

apt-get install madwifi-source
cd /usr/src
tar xjvf madwifi.tar.bz2
cd modules/madwifi
make
make install

This depends on the kernel headers package being installed. If you didn’t create one, or didn’t install it, you can build the modules with

make -C /path/to/linux/source SUBDIRS=`pwd` modules
make -C /path/to/linux/source SUBDIRS=`pwd` modules_install

I think that covers most of what I had to do to get 2.6.21 running.



So, I had a problem with my MacBook – the harddrive failed twice (or, at least, that’s what all the symptoms pointed to). After it failed the second time and I brought it back, the nice Apple tech support guy messed around with it a bit more, and replaced both the drive and the logic board (as he called it). It’s been working fine since, so kudos to them.

Of course, this meant that I had to install Linux on it again. This time, I decided I’d go with Debian, instead of Ubuntu. You’d think there wouldn’t be much difference, but there is.
Macbook
Last time, I installed Ubuntu from a Dapper CD I had lying around, and upgraded to Feisty in one fell apt-get dist-upgrade. And, of course, this horribly messed up lots. Simple things like icons for certain things went missing, and never came back. Sometimes, when I logged into Gnome, it wouldn’t run my .xmodmaprc and I’d have to do it manually. I swap the ` and \ keys, as they are by default on the MacBook, so that they’re in the usual position. Another minor annoyance, but it’s those types of things that grate on me. The last one which really annoyed me was the Fn key functionality. Basically, I like to have F-keys first and require pressing Fn to get that functionality. So, I passed the necessary option to the necessary kernel module to get this. This enabled Home, End, Pgup and Pgdn on the arrow keys aswell, using the Fn key. But, if I held Fn, Alt and Left Arrow (Home) in Firefox, it didn’t recognise the key as Home, and instead went back a page instead of to the home page.

So, I decided to try Debian on it and see if it fared any better. And it did. I installed from an Etch CD, and nearly everything worked out of the box. The few things that I needed to do were :

  • Get the kernel source and apply the mactel kernel patches, build it and install it
  • Make sure the appletouch kernel module is loaded before usbhid for the touchpad
  • Install madwifi-source and madwifi-tools, and build and install the modules to support the wireless card
  • Set up the touchpad for 2-tap right click, and 3-tap middle click, instead of the opposite (which is the default)
  • Edit /etc/default/acpi-support and set ACPI_SLEEP_MODE to standby. This works around an issue I had (have) where, when the power cable is plugged out and the lid is closed and reopened, the computer doesn’t return from its sleep
  • Edit /etc/acpi/events/powerbtn and comment out the action line, so that the script isn’t run. When I press the power button, the Gnome logout dialogue pops up, offering me the choice to logout, power down or reboot. The acpi script shuts the machine down immediately.

All this stuff is explained on the MacBook – Debian Wiki page, so I won’t go into the details of it here. I haven’t even tried getting the iSight camera working yet, because I don’t really have any need for it.

So, I’ve noticed from my web logs that people do end up here on quests for information about Linux, particularly Ubuntu, on MacBook. Well, here’s my advice if you’re here on one of those quests – install Debian Etch! It’s easier, quicker and works perfectly.



I decided to put some work into getting the advanced features of the touchpad on my MacBook working. These include double and triple tap for middle and right clicking and scrolling using the touchpad.
Macbook
I started with the instructions on Simon van der Linden’s “MacBook: emulate a Synaptics touchpad with Ubuntu GNU/Linux” page. The patch on the Ubuntu forums is required to support the touchpad. However, even though this supports the touchpad, it’s fairly jittery and difficult to use.

So, next step was to apply another patch from Jason Parekh which helps fix that jitter and improves the multi-tap recognition.

Finally, I tweaked Jason’s patch a small bit, and I find it improved the jitter a bit more. Here’s the complete patch to appletouch.c that I’m using at the moment. With this, I load the appletouch.ko module with

modprobe appletouch tap_threshold=5 track_threshold=1

To do this automatically on boot, put the following into /etc/modprobe.d/options (you may have already put in a similar line from Simon van der Linden’s howto, so just edit it in that case)

install usbhid /sbin/modprobe appletouch tap_threshold=5 track_threshold=1 && sleep 2 && /sbin/modprobe –ignore-install usbhid $CMDLINE_OPTS

I have noticed some issues with slight jitters and when using the scrolling in Firefox. While using Firefox, I’ve noticed phantom clicks, which can get annoying when in the middle of a blog post and the browser’s back button gets mysteriously clicked! What I suspect is that I hit the touchpad and bring up the right-click menu, and I end up hitting the “Back” option there. Other than that, it works well, and I’m sure once I get used to it, I’ll wonder how I ever did without it!