Version en français

Debian GNU/Linux and Mac OS X on my iBook

My iBook

Introduction

In March 2007, I bought an used iBook G3 on ebay.com. The machine is a iBook G3 (Late 2002). It came with a PowerPC G3 processor running at 800 MHz, 128 MB of RAM, a 30 GB hard drive, a CDROM drive and a AirPort card. I immediately upgraded the memory to 640 MB of RAM. I also replaced the original US (QWERTY) with a Belgian (AZERTY) keyboard. Of course, I also had to buy a 220V / 50 Hz power adapter since obviously the 110 V / 60 Hz power adapter is useless in Europe. So here are the "quick facts" about this machine:

Partitioning

My goal is to dual-boot Mac OS X and Debian GNU/Linux. Therefore I need to create several partitions. Here is a list of the partitions I need to create:

Description Filesystem Size
Mac OS X (1) hfsplus 7 GB
Linux swap swap 750 MB
Linux /var ext3 940 MB
Apple Bootstrap Apple Bootstrap 880 KB
Linux / ext3 4.2 GB
Linux /home ext3 1.4 GB
Mac OS X (2) hfsplus 14 GB

(1): This partition contains the Mac OS X system and program files
(2): This partition is for storing data accessible to both Mac OS X and Debian GNU/Linux

Why am I creating two hfsplus partitions ?

Starting the installation

The first thing to do is to install Mac OS X. Yes, I need to install both Mac OS X and Debian GNU/Linux, but I strongly recommend installing Mac OS X first and Debian GNU/Linux, you will have much less trouble.

Installing Debian GNU/Linux

The next step is to install Debian GNU/Linux 4.0 "etch". Don't panic, it is now much easier to install Debian on a powerpc machine than, say, five years ago

Here is fdisk's output:

[root@ibook] 11:57 /root>fdisk -l
/dev/hda
        #                    type name                 length   base     ( size )  system
/dev/hda1     Apple_partition_map Apple                    63 @ 1        ( 31.5k)  Partition map
/dev/hda2         Apple_UNIX_SVR2 swap                1562501 @ 14680128 (762.9M)  Linux swap
/dev/hda3               Apple_HFS Apple_HFS_Untitled_1 14417920 @ 262208   (  6.9G)  HFS
/dev/hda4         Apple_UNIX_SVR2 untitled            1953126 @ 16242629 (953.7M)  Linux native
/dev/hda5               Apple_HFS Apple_HFS_Untitled_2 29097984 @ 26895976 ( 13.9G)  HFS
/dev/hda6         Apple_Bootstrap untitled               1719 @ 18195755 (859.5k)  NewWorld bootblock
/dev/hda7         Apple_UNIX_SVR2 untitled            8698502 @ 18197474 (  4.1G)  Linux native
/dev/hda8         Apple_UNIX_SVR2 untitled            2611160 @ 55993960 (  1.2G)  Linux native
/dev/hda9              Apple_Free Extra                262144 @ 64       (128.0M)  Free space

Block size=512, Number of Blocks=58605120
DeviceType=0x0, DeviceId=0x0

First boot in Debian GNU/Linux

Congratulations ! Debian GNU/Linux 4.0 "etch" is installed and running :) . But there are still things to do...

Keyboard at the console

At the console, my Belgian keyboard is properly recognized. That is, if you selected the right keyboard in debian-installer :)

Keyboard in X

In X11, my Belgian keyboard works *almost* perfectly. The only problem is the key in the upper left corner, just below the "Esc" key. In X11, when I press this key I get ² and ³ instead of @ and #. The solution is to set Option "XkbModel" "macintosh" in xorg.conf, as told in hack #4, page 15, in the book Debian à 200%. But, it does not work !. See below the detailed xorg.conf file.

Right-clicking in X

Ouch, how do I right-click ? The trackpad on the iBook only has one button !

Indeed. And unlike in Mac OS X, Ctrl-Click does not work ! The first solution is to use a USB mouse with both left and right buttons. But of course that's not very easy when you're using your iBook, say, in the subway, or in bed. The other solution is to define two keys as middle-click and right-click in X. (In my case F10=middle-click, F11=right-click) In order to do so you just need to add the following lines to /etc/sysctl.conf:

# /etc/sysctl.conf
# Pierre Bauduin le 7 avril 2007
# Sur mon iBook
# J'utilise les touches F10 et F11 pour click milieu et click droit
dev/mac_hid/mouse_button_emulation = 1
# F10
dev/mac_hid/mouse_button2_keycode = 68
# F11
dev/mac_hid/mouse_button3_keycode = 87

Special keys in X11

So you've got these F1 to F12 keys that also have special functions: brightness control, sound volume, and F12 to eject the cdrom. How do you get these to work in Debian GNU/Linux ? Easy as π:
[root@ibook] /root>apt-get install pbbuttonsd 

Power management

Mac OS X on the iBook does a very good job of managing power. This means, changing the speed of the CPU on the fly (making the CPU run at 400 MHz instead of 800 MHz), turning off the brightness of the LCD screen, and putting the iBook in sleep mode after some time. Can you do that in Debian GNU/Linux ? Of course you can ! And it works very well, you can close the lid, and open it a few hours later, it will come back in the state it was. You'll just need to:
[root@ibook] /root>apt-get install powernowd powerprefs

Do you like Exposé ?

One of my most favourite features of Mac OS X is exposé. It is very useful when you've got like a dozen windows open. Would be cool if there was exposé for Debian GNU/Linux. Well, there is, more or less ! It's a KDE tool called komposé. It will show you all your windows as thumbnails. Alas, it will not do a graphical zoom out. To install it, you'll just need to
[root@ibook] /root>apt-get install kompose
... you'll then just need to configure my keys. In my case I chose F9 for a komposé of the current virtual desktop and F10 for a komposé of all virtual desktops.

Why is the data partition formatted in hfsplus ?

Well, I want to have a partition for data. And I want to be able to write to that partition from Mac OS X and from Debian GNU/Linux. And... it's not that easy to find a filesystem which can be mounted read/write in both Mac OS X and Debian GNU/Linux. I've got the following possibilities:

My first idea was to use fat32 on the data partition. I could set the partition's filesystem flag to fat32 from Debian GNU/Linux (cfdisk), format it from Debian GNU/Linux (mkfs.vfat), and mount it in Debian GNU/Linux. But, the fat32 formatted never appeared on the desktop in Mac OS X ! I tried formatting from Mac OS X (newfs_msdos), and even after that, I could mount it in Debian GNU/Linux, but still not in Mac OS X ! This is puzzling ! And when I connect an external FireWire drive formatted in fat32, it appears on the Mac OS X desktop !

After this failure (*sigh*) I thought of another solution: hfsplus. I formatted the data partition as hfsplus in MacOSX. Then I added a line to my /etc/fstab in Debian GNU/Linux (see the last line):

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda7       /               ext3    defaults,errors=remount-ro 0       1
/dev/hda8       /home           ext3    defaults        0       2
/dev/hda4       /var            ext3    defaults        0       2
/dev/hda2       none            swap    sw              0       0
/dev/hdb        /media/cdrom0   udf,iso9660 user,noauto         0       0
/dev/hda3       /mnt/macosx     hfsplus         defaults,ro     0       0
/dev/hda5       /mnt/data       hfsplus         defaults,uid=501,gid=80         0       0
With this setup, the /mnt/data filesystem will always mount as read-only in Debian GNU/Linux. When mounted, the kernel will always say:
hfs: write access to a jounaled filesystem is not supported, use the force option at your own risk, mounting read-only.
Forcing write access is NOT a good idea ! Don't do that ! There is another solution: disabling journaling on the hfsplus filesystem in Mac OS X.

Just boot into Mac OS X and type the following command:

sudo /usr/sbin/diskutil disableJournal /Volumes/Data
(where /Volumes/Data is the volume name of your hfsplus filesystem). For more information about disabling journaling on a HFS volume, take a look at this article from apple.com

After this little change, the Linux kernel with automatically mount that partition in read-write.

WARNING: Never disable journaling on the hfsplus Mac OS X system partition ! You will never be able to boot Mac OS X ! Again: Disabling hfsplus journaling on the partition which contains the Mac OS X system folder will render your system unbootable ! You have been warned :)

Résultat des couses: Finally, the best solution (to me) is to use a hfsplus partition where journaling is disabled. You will be able to mount it read-write from both Mac OS X and Debian GNU/Linux. Now I guess you understand why I created two hfsplus partitions, one for Mac OS X and programs, and the other one for data. I could disable journaling on the data partition without problems, but I for sure did not disable journaling on the Mac OS X + programs partitions, it would have killed my system !

Getting the external VGA output to work

I sometimes have to give presentations. So I've got a Mini-VGA to VGA adapter, and I connect my iBook to the beamer. In Mac OS X, I do get output on the external VGA port.
But in Debian GNU/Linux, it does not work ! I get zero output on the beamer !
Now it works ! See below the detailed xorg.conf file.

Networking

The iBook G3 has three network devices: onboard Ethernet, FireWire, and AirPort (if installed). @
All of them work of out of the box on Debian GNU/Linux ! There's nothing to do ! For completeness, I'll just say the onboard Ethernet uses module sungem AirPort uses modules airport, orinoco, hermes and FireWire uses ieee1394, eth1394.
I like to have Ethernet as eth0 and AirPort as wlan0. Here's how to achieve this with file /etc/udev/rules.d/z25_persistent-net.rules:
# This file was automatically generated by the /lib/udev/write_net_rules
# program, probably run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
# MAC addresses must be written in lowercase.

# Mis en ordre par Pierre Bauduin le 7 avril 2007

# PCI device 0x106b:0x0024 (gem)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:0a:95:c0:ff:ee", NAME="eth0"

# Firewire device 000a95fffea2e8d4 (ohci1394)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:0a:95:ff:fe:c0:ff:ee", NAME="eth1"

# PCI device 0x106b:0x0025 (airport)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:30:65:c0:ff:ee", NAME="wlan0"

Detailed xorg.conf file

     1	# /etc/X11/xorg.conf (xorg X Window System server configuration file)
     2	#
     3	# Dernière modification: Pierre Bauduin, le 5 juin 2007 à 14h14
     4	#
     5	# This file was generated by dexconf, the Debian X Configuration tool, using
     6	# values from the debconf database.
     7	#
     8	# Edit this file with caution, and see the /etc/X11/xorg.conf manual page.
     9	# (Type "man /etc/X11/xorg.conf" at the shell prompt.)
    10	#
    11	# This file is automatically updated on xserver-xorg package upgrades *only*
    12	# if it has not been modified since the last upgrade of the xserver-xorg
    13	# package.
    14	#
    15	# If you have edited this file but would like it to be automatically updated
    16	# again, run the following command:
    17	#   sudo dpkg-reconfigure -phigh xserver-xorg
       
    18	Section "Files"
    19		FontPath	"/usr/share/fonts/X11/misc"
    20		FontPath	"/usr/X11R6/lib/X11/fonts/misc"
    21		FontPath	"/usr/share/fonts/X11/cyrillic"
    22		FontPath	"/usr/X11R6/lib/X11/fonts/cyrillic"
    23		FontPath	"/usr/share/fonts/X11/100dpi/:unscaled"
    24		FontPath	"/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
    25		FontPath	"/usr/share/fonts/X11/75dpi/:unscaled"
    26		FontPath	"/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
    27		FontPath	"/usr/share/fonts/X11/Type1"
    28		FontPath	"/usr/X11R6/lib/X11/fonts/Type1"
    29		FontPath	"/usr/share/fonts/X11/100dpi"
    30		FontPath	"/usr/X11R6/lib/X11/fonts/100dpi"
    31		FontPath	"/usr/share/fonts/X11/75dpi"
    32		FontPath	"/usr/X11R6/lib/X11/fonts/75dpi"
    33		# path to defoma fonts
    34		FontPath	"/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
    35	EndSection
       
    36	Section "Module"
    37		Load	"i2c"
    38		Load	"bitmap"
    39		Load	"ddc"
    40		Load	"dri"
    41		Load	"extmod"
    42		Load	"freetype"
    43		Load	"glx"
    44		Load	"int10"
    45		Load	"vbe"
    46	EndSection
       
    47	# Repris du xorg.conf de Frédéric Aupépin
    48	# Le 3 juin 2007
    49	Section "InputDevice"
    50		Identifier	"Generic Keyboard"
    51		Driver		"kbd"
    52		Option		"CoreKeyboard"
    53		Option		"XkbRules"	"xorg"
    54		Option		"XkbModel"	"macintosh"
    55		Option		"XkbLayout"	"fr"
    56		Option		"XkbOptions"	"lv3:lwin_switch"
    57	EndSection
       
    58	Section "InputDevice"
    59		Identifier	"Configured Mouse"
    60		Driver		"mouse"
    61		Option		"CorePointer"
    62		Option		"Device"		"/dev/input/mice"
    63		Option		"Protocol"		"ImPS/2"
    64		Option		"Emulate3Buttons"	"true"
    65	EndSection
       
    66	Section "InputDevice"
    67		Identifier	"Synaptics Touchpad"
    68		Driver		"synaptics"
    69		Option		"SendCoreEvents"	"true"
    70		Option		"Device"		"/dev/psaux"
    71		Option		"Protocol"		"auto-dev"
    72		Option		"HorizScrollDelta"	"0"
    73	EndSection
       
    74	Section "Device"
    75		Identifier	"ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]"
    76		Driver		"ati"
    77		BusID		"PCI:0:16:0"
    78		# Options below suggested by Zhengpeng Hou <zhengpeng-hou@ubuntu.com>
    79		Option          "MergedFB" "true"
    80		Option          "backingStore"           "true"
    81		Option          "DynamicClocks"          "on"
    82		Option          "MonitorLayout" "LCD, CRT"
    83		# Désactivé par Pierre Bauduin le 5 juin 2007
    84		#Option 		"CRT2HSync" 		"30 - 83"
    85		#Option 		"CRT2VRefresh" 		"56 - 75"
    86		# Desactivé par Pierre Bauduin le 2 juin 2007
    87		#Option		"UseFBDev"		"true"
    88	EndSection
       
    89	Section "Monitor"
    90		Identifier	"iBook Color LCD"
    91		Option		"DPMS"
    92	EndSection
       
    93	# Modifié par Pierre Bauduin
    94	Section "Monitor"
    95		identifier "External Monitor"
    96		vendorname "Plug 'n' Play"
    97		modelname "Plug 'n' Play"
    98		modeline "640x480@60" 25.2 640 656 752 800 480 490 492 525 -vsync -hsync
    99		modeline "800x600@72" 50.0 800 856 976 1040 600 637 643 666 +hsync +vsync
   100		modeline "1024x768@70" 75.0 1024 1048 1184 1328 768 771 777 806 -vsync -hsync
   101		gamma 1.0
   102	        Option "VGA"
   103		#HorizSync 30-82
   104		#VertRefresh 56-75
   105	EndSection
   106	#
       
       
   107	Section "Screen"
   108		Identifier	"iBook Screen"
   109		Device		"ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]"
   110		Monitor		"iBook Color LCD"
   111		DefaultDepth	24
   112		SubSection "Display"
   113			Depth		1
   114			Modes		"1024x768"
   115		EndSubSection
   116		SubSection "Display"
   117			Depth		4
   118			Modes		"1024x768"
   119		EndSubSection
   120		SubSection "Display"
   121			Depth		8
   122			Modes		"1024x768"
   123		EndSubSection
   124		SubSection "Display"
   125			Depth		15
   126			Modes		"1024x768"
   127		EndSubSection
   128		SubSection "Display"
   129			Depth		16
   130			Modes		"1024x768"
   131		EndSubSection
   132		SubSection "Display"
   133			Depth		24
   134			Modes		"1024x768"
   135		EndSubSection
   136	EndSection
       
   137	Section "Screen"
   138		Identifier "Default Screen"
   139		Device	"ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]"
   140		Monitor "External Monitor"
   141		DefaultDepth 24
   142	SubSection "Display"
   143		depth 24
   144		virtual 1024 768
   145		# modes "640x480@60"
   146		# modes "800x600@72"
   147		Modes "1024x768@70"
   148		EndSubSection
   149	EndSection
   150	#
       
   151	Section "ServerLayout"
   152		Identifier	"Default Layout"
   153		Screen		"Default Screen"
   154		InputDevice	"Generic Keyboard"
   155		InputDevice	"Configured Mouse"
   156		InputDevice	"Synaptics Touchpad"
   157	EndSection
       
   158	Section "DRI"
   159		Mode	0666
   160	EndSection

You can also take a look at my other hacks.

This page has been visited Visitor Counter by Digits times since its creation on May 24th 2007.

Last update: Sun Jun 24 12:00:07 CEST 2007

Valid HTML 4.0 Transitional Locations of visitors to this page Powered by Debian