ABOUT : Debian Lenny on MacBook Core 2 Duo AUTHOR : mike dentifrice 2007-09-03 mike dentifrice * netboot install: I tried to netboot using a working PXE/TFTP server, but it just wouldn't work, and I couldn't afford spending much time digging into the whole thing (especially since Macs seem to require that the boot server speaks Apple's BSDP protocol). Couldn't find anything documenting the process. Would be worth looking into in the future, though. 2007-09-06 mike dentifrice * MacBook C2D reinstall: So I resorted to a good old install from CD, getting the AMD64 daily build for the Debian Installer: wget \ http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/amd64/iso-cd/debian-testing-amd64-netinst.iso The only "tricky" part comes when the d-i wants to install a bootloader: - installing refit - gptsync /dev/sda - selecting lilo, and installing to /dev/sda3 In tasksel, selecting "basic" and "laptop". * ethernet: By default, Debian assigns the FireWire network interface (which I never use) to eth0, and the Ethernet interface to eth1, which can get confusing in practice (since most machines only have one Ethernet interface, thus eth0). Let's tell udev to wire eth0 back to the Ethernet: - edit /etc/udev/rules.d/z25_persistent-net.rules and swap eth0 & eth1 - edit /etc/network/interfaces and %s/eth1/eth0/g - reboot * apt: Adding sid & stable sources to /etc/apt/sources.list Configuring apt-pinning in /etc/apt/preferences as follows: Package: * Pin: release a=stable Pin-Priority: 200 Package: * Pin: release a=testing Pin-Priority: 700 Package: * Pin: release a=unstable Pin-Priority: 650 This way, most packages get pulled out of testing ('lenny') while retaining the possibility to install stuff from unstable when specifying it (apt-get install package/unstable or apt-get -t unstable install package) * adding furniture: It has to quickly feel like home: su - apt-get install vim screen ssh sudo update-alternatives --config editor ..and set vim.basic as the default (nano, go away) * adjusting permissions: visudo for i in adm src staff; do adduser $USER $i; done * keyboard: Let's configure the keyboard for the console: sudo dpkg-reconfigure -p low console-data ..and select Apple USB. Keystrokes now match what's written on the keys, neat! * sound: Let's install the ALSA sound-system: sudo apt-get install alsa alsa-utils * special keys: Let's install pommed to get them working: sudo apt-get install pommed Let's use F1, F2 and set backlight & co. using Fn+Fx fnmode = 2 in /etc/pommed.conf sudo /etc/init.d/pommed restart * graphical environment: Off we go, installing xorg, an unicode aware terminal, and the great 'openbox' window-manager! sudo apt-get install xorg rxvt-unicode openbox obconf Note: obconf is currently broken in lenny, but fetching it from sid does the job It's time to configure X in /etc/X11/xorg.conf: - let's choose the new 'intel' video driver (located in the 'xserver-xorg-video-intel' package), which superseeds the old 'i810' driver and no longer requires '915resolution': Section "Device" Identifier "Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller" Driver "intel" EndSectionSection "Device" - let's configure the keyboard properly: Section "InputDevice" Identifier "Generic Keyboard" Driver "kbd" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "macbook79" Option "XkbLayout" "fr" # the following option enables alt_gr on right apple Option "XkbOptions" "lv3:rwin_switch" EndSectionSection "InputDevice" - let's configure the synaptics touchpad: Section "InputDevice" Identifier "Synaptics Touchpad" Driver "synaptics" Option "SendCoreEvents" "true" Option "Device" "/dev/psaux" Option "Protocol" "auto-dev" Option "HorizScrollDelta" "0" Option "TouchpaddOff" "0" # Allows dynamtic configuration with 'gsynaptics' Option "SHMConfig" "true" # Location of the touchpad edges, somewhat sane values # that I found by testing. Xmin=0, Xmax=1216, Ymin=0,Ymax=387 Option "LeftEdge" "100" Option "RightEdge" "1116" Option "TopEdge" "50" Option "BottomEdge" "310" # Touch and "untouch" thresholds Option "FingerLow" "25" Option "FingerHigh" "50" # We DO NOT want palm triggering middle/right mouse # button events, so a tap has to be quite fast Option "MaxTapTime" "100" Option "MaxTapMove" "100" Option "MaxDoubleTapTime" "200" # How fast the two-finger scrolling scrolls. The lower, the faster. Option "VertScrollDelta" "25" Option "HorizScrollDelta" "25" # Enable vertical (right) edge scrolling with one finger Option "VertEdgeScroll" "1" # Enable horizontal (bottom) edge scrolling with one finger Option "HorizEdgeScroll" "1" # Disable two finger scrolling, # as we have the edge scrolling enabled already Option "VertTwoFingerScroll" "0" Option "HorizTwoFingerScroll" "0" # Right top corner of the touchpad shall be the middle mouse button # Right bottom corner shall be the right mouse button Option "RTCornerButton" "2" Option "RBCornerButton" "3" # Disable left top & left bottom corners Option "LTCornerButton" "0" Option "LBCornerButton" "0" # Fast taps Option "FastTaps" "0" # Disable tapping of the touchpad (excluding the corners, of course) Option "TapButton1" "0" Option "TapButton2" "0" Option "TapButton3" "0" # Movement speed settings Option "MinSpeed" "0.5" Option "MaxSpeed" "0.9" Option "AccelFactor" "0.35" # Palm detection. Does not seem to work on Macbook Option "PalmDetect" "1" Option "PalmMinWidth" "10" #1-15 Option "PalmMinZ" "200" #1-255 # Various other variables Option "UpDownScrolling" "0" Option "LeftRightScrolling" "0" EndSection Let's also install 'gsynaptics' for on-the-fly configuration: sudo apt-get install gsynaptics 2007-09-07 mike dentifrice * multimedia: Adding marillat's repository to /etc/apt/sources.list: sudo -s echo "deb http://www.debian-multimedia.org/ lenny main" \ >> /etc/apt/sources.list exit And installing his gpg key: sudo apt-get update sudo apt-get install debian-multimedia-keyring sudo apt-get update Installing mplayer: sudo apt-get install mplayer mplayer-doc libdvdcss Installing dvd::rip: sudo apt-get install dvdrip xine-ui subtitleripper \ transcode-doc toolame mjpegtools ogmtools \ xvid4conf dvdrip-doc libjpeg-progs Installing ghettoblasters: sudo apt-get install cplay vorbis-tools python-pyvorbis \ python-id3 mikmod mpg123 mpg321 madplay * monitoring: Installing smartmontools: sudo apt-get install smartmontools Configuring it: - activating smartd in /etc/default/smartmontools - commenting the DEVICESCAN directive in /etc/smartd.conf and decomenting the /dev/sda -a -d sat line - restarting: /etc/init.d/smartmontools restart Installing other hardware monitoring bits: sudo apt-get install lm-sensors sudo sensors-detect ..which generates the following output: # Chip drivers # Warning: the required module coretemp is not currently installed # on your system. For status of 2.6 kernel ports check # http://www.lm-sensors.org/wiki/Devices. If driver is built # into the kernel, or unavailable, comment out the following line. coretemp Adding the module to /etc/modules as suggested (but it is still to be compiled in, since it is not shipped with the Debian stock kernel). * energy saving & sleep: sudo apt-get install laptop-mode-tools powertop sudo apt-get -t unstable install uswsusp To put the laptop to sleep: sudo s2ram -f It works! To get it to work automagically when closing the lid, install powersaved: sudo apt-get install powersaved Then configure it: set SUSPEND2RAM_FORCE to 'yes' in '/etc/powersave/sleep'; set EVENT_BUTTON_LID_CLOSED to 'suspend_to_ram' and EVENT_BUTTON_LID_OPEN to 'restore_after_suspend_to_ram' in '/etc/powersave/events' sudo /etc/init.d/powersaved restart * kernel patching & compiling: Most things now work out of the box with Debian kernels, but there's a few things flying around still - like applesmc - that require manual patching, thus kernel recompilation. Let's first install some tools we're gonna need: sudo apt-get install subversion kernel-package \ build-essential fakeroot libncurses5-dev Let's get the latest vanilla sources: cd /usr/src wget \ http://eu.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.6.tar.bz2 tar xvfj linux-2.6.22.6.tar.bz2 ln -s linux-2.6.22.6 linux ..and the mactel patches: svn co \ https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux \ mactel-linux cd mactel-linux/trunk/kernel/mactel-patches-2.6.22 ./apply /usr/src/linux Time to configure & compile the kernel: cd /usr/src/linux copy my old config to .config make oldconfig # to parse new options make-kpkg --revision=$(date +'%Y%m%d') \ --rootcmd fakeroot --initrd kernel_image modules_image sudo dpkg -i ../linux-image-2.6.22.6-mactel*deb * web & flash: Let's install favorite web-browsers: sudo apt-get install lynx-ssl links-ssl dillo iceweasel I know flash is evil, and I do hate it, but I'm also sick of feeling cut from the part of the world that hasn't understood that yet. In short, I *want* working flash! Let's first try the latest development of gnash: sudo apt-get -t unstable install gnash mozilla-plugin-gnash Unfortunately, it fails to read YouTube videos and most current flash animations. Let's install the non-free Macromedia plugin, then, for which an installation wrapper is available from the contrib section of the debian repository: sudo apt-get install flashplugin-nonfree ..which depends upon ia32-libs-gtk & lib32z1, which will hopefully allow to run the 32bit binary within our 64bit environment! Note: this also requires CONFIG_IA32_EMULATION to be set to 'y' in the kernel. Restarting iceweasel to notice that it works! 2007-09-08 mike dentifrice * battery consumption: The huge difference in between OS X and GNU/Linux on that precise issue remains a mystery. Until it is found how to get as good battery performance as OS X, let's tweak the system to save energy as much as possible. Let's install powertop and run it: sudo apt-get install powertop sudo powertop Here are its suggestions: - desactivate bluetooth when unused: sudo hciconfig hci0 down ; sudo rmmod hci_usb - mounting filesystems with the 'noatime' option, to reduce diskwrites; let's edit '/etc/fstab' to do so (note that I just activated it for my root partition, _not_ my home partition, since I use mutt to read my mail, which depends upon atime to detect if a mbox folder contains new messages or not); - activate CONFIG_NO_HZ in the kernel to get longer CPU sleep; cool, but it isn't available for the AMD64 architecture yet; seems like Linux 2.6.23 is gonna change that though; - prevent hal from polling the CD-ROM; good idea, but the command powertop suggests is wrong - using this one instead: sudo hal-disable-polling --device /dev/hda Which outputs: Polling for drive /dev/hda have been disabled. The fdi file written was /etc/hal/fdi/information/media-check-disable-storage_model_MATSHITADVD_R_UJ_857D.fdi 2007-09-09 mike dentifrice * wifi: Though it was not supported at first, the Airport Extreme from the MacBook C2D has been working very well with the svn version of the madwifi drivers for a while. The 'madwifi-source' package from lenny is supposed to ship a version that supports the specific Atheros chipset, but it didn't work for me (as of 1:0.9.3.2-1), so I resorted back to the old method: cd /usr/src/ svn checkout http://svn.madwifi.org/trunk \ madwifi-hal-0.9.30.13 cd madwifi-hal-0.9.30.13/ make make install And then: depmod -a modprobe ath_pci Installing userland tools: sudo apt-get install madwifi-tools wireless-tools \ wavemon kismet aircrack-ng Kismet works by adding the following to '/etc/kismet/kismet.conf': source=madwifi_g,wifi0,airport_extreme I haven't tested aircrack-ng yet, but instructions can be found on http://www.aircrack-ng.org/doku.php?id=madwifi-ng and http://www.grape-info.com/doc/linux/config/aircrack-ng-0.6.html * bluetooth mouse: I have a bluetooth Mighty Mouse I want to be able to "plug in", just like a USB mouse. Let's install necessary programs first: sudo apt-get install bluez-utils ...and set HIDD_ENABLED to 1 in '/etc/default/bluetooth'. Now check that you can see your mouse and find its bdaddr: sudo hcitool scan Let's copy/paste the bdaddr (something like 00:14:51:XX:XX:XX) and add such a line in '/etc/default/bluetooth': HIDD_OPTIONS="--connect 00:14:51:XX:XX:XX" Restarting the daemon: sudo /etc/init.d/bluetooth restart This should show the mouse: sudo hidd --show It does! Let's grab its "Name" from: cat /proc/bus/input/devices ...and add such a section to '/etc/X11/xorg.conf': Section "InputDevice" Identifier "Mighty Mouse" Driver "evdev" Option "SendCoreEvents" "true" Option "Name" "Apple Computer, Inc. Mighty Mouse" Option "HWHEELRelativeAxisButtons" "7 6" Option "WHEELRelativeAxisButtons" "4 5" EndSection Notes: for it to work, any such line from has to be removed from '/etc/X11/xorg.conf': Option "CorePointer" Also, Option "Name" has to be followed by the exact description of the mouse from /proc/bus/input/devices * TODO: - remote control - iSight