Revision 136 as of 2007-11-03 18:03:15

Clear message

How to install Ubuntu Gutsy on a MacBook

This guide will help you through all the steps necessary for installing Ubuntu on a MacBook. This guide is currently aimed at Ubuntu 7.10 (Gutsy Gibbon).

-> If you own a Macbook Pro see this guide: https://wiki.ubuntu.com/MacBookPro

For further discussion of this topic, see: http://ubuntuforums.org/showthread.php?p=1699961

For a guide to Triple Booting, see: http://wiki.onmac.net/index.php/Triple_Boot_via_BootCamp_Ubuntu

  • The instructions below refer to Apple's BootCamp application which is no longer publicly available unless you use / upgrade to OSX 10.5 Leopard. Another option is to re-install OSX from scratch and use Disk Utility to make a smaller Mac OS X partition, leaving free space for Ubuntu.

Basic instructions

  1. Update the [http://www.apple.com/support/downloads/ firmware] to the latest version. If you prefer, you may use the standard "Software Update".

  2. Get your Ubuntu [http://www.ubuntu.com/getubuntu/download Live CD] ready. For older MacBooks you must select i386; for Core 2 Duo MacBooks (post 2006) you can select amd64.

  3. Install [http://refit.sourceforge.net/ rEFIt]] if you want a boot menu (to select between OS X/Ubuntu) to appear on every boot. You can make Ubuntu boot by default and change the menu timeout by editing the "refit.conf" file (described on the above website).

  4. If necessary, use Boot Camp to resize your OSX partition and make space for Ubuntu. Don't waste a CD creating a Windows driver disk. Reboot.
  5. Hold down "C" to boot from the CD.
  6. Install ubuntu as usual, except:
    • In the partitioner, select Manually edit partition table

    • Delete /dev/sda3 and /dev/sda4 if they exist
    • Create a new ext3 partition for your root
    • Mount the newly created ext3 partition on '/'
    • Note that Boot Camp will cause problems if you make more than two partitions in total.
  7. Finish the install and reboot.
  8. If you installed rEFIt, you should have a choice between booting OS X and Linux. Use the arrow keys and Enter to select Linux.
  9. Alternatively, if you did not install rEFIt, hold down Alt/Option to choose whether to boot into OSX / Ubuntu. Ubuntu is called "Windows".
  10. Log in on your system.
  11. Follow the steps in the sections below to work around things that still not work out of the box in Gutsy.

Wireless

If you have a first generation MacBook (Core Duo) then your wireless should just start working, though you may want to update to the latest version as illustrated below for better power efficiency and signal strength. Second generation MacBooks (Core 2 Duo) have a newer version of the Atheros Wifi chipset which requires the installation of the latest Atheros madwifi drivers. [https://bugs.launchpad.net/madwifi/+bug/122703 bug #122703] To ensure the new version of the driver loads, you may want to disable the Atheros HAL in the "Restricted Manager" (System-Administration-Restricted Drivers Manager).

Please note that the current madwifi drivers depend on a proprietary binary, the Atheros HAL, and therefore will taint your kernel.

To install:

sudo aptitude install build-essential
wget http://snapshots.madwifi.org/madwifi-trunk-current.tar.gz
tar -zxvf madwifi<tab>
cd madwifi<tab>
make
sudo make install

If you want you can alternatively get the sources by SVN

svn checkout http://svn.madwifi.org/madwifi/trunk madwifi)

At this point the driver should work and wifi will be enabled after reboot.

Alternatively you can use these commands to insert the driver into the running kernel:

sudo modprobe ath_pci
sudo modprobe wlan_scan_sta

More information can be obtained at http://madwifi.org/wiki/UserDocs/FirstTimeHowTo

Ndiswrapper

If you instead want to use ndiswrapper to use the Windows wireless drivers on Ubuntu (only for 32 bit OS) these are the instructions:

You have to have the XP drivers on your hard disk. If you don't have a Windows XP installation on an alternate partition, you can get the drivers from the Boot Camp driver disk. The drivers from the Boot Camp disk can be uncompressed using the non-free unrar in the multiverse repository:

  • Enable multiverse ( see https://help.ubuntu.com/community/Repositories/Ubuntu )

  • Install the packages rar unrar (actually only unrar is truly necessary)

  • Uncompress the Windows XP Atheros driver installer:
    mkdir ~/atheros
    unrar x atherosxpinstaller.exe ~/atheros/
  • Install the atheros drivers using ndiswrapper:
    sudo apt-get install ndiswrapper-utils-1.8
    
    #install the driver into ndiswrapper:
    sudo ndiswrapper -i "~/atheros/net5416.inf"
    #--or--
    sudo mount /dev/sda4 /mnt
    sudo ndiswrapper -i "/mnt/Program Files/Macintosh Drivers for Windows XP 1.1.2/net5416/net5416.inf"
    
    sudo modprobe ndiswrapper
    sudo echo >> /etc/modules "ndiswrapper"
    sudo umount /mnt

Reference: http://paulglover.net/20061210/triple-booting-macbook-os-x-ubuntu-edgy-windows-xp/

Sound

Sound on MacBooks is provided by an Intel HDA-based integrated chipset, and should work out-of-the-box. However, the volume control will not work correctly out-of-the-box - in particular, reducing the default volume will result in sound distortion at lower volume levels, and volume control changes won't effect the headphone volume level.

To fix this, do the following:

1. Add the following line to /etc/modprobe.d/alsa-base:

install snd-hda-intel position_fix=1 /sbin/modprobe --ignore-install snd-hda-intel $CMDLINE_OPTS && /lib/alsa/modprobe-post-install snd-hda-intel

2. Increase the volume (both using the key combination and the system tray applet) to its maximum possible value.

3. Right-click on the volume applet and choose Preferences. Select "PCM" as the device to control.

4. Open the Sound preferences (System-Preferences-Sound in GNOME). Select "PCM" as the device to control.

Suspend

Suspend is broken in Ubuntu 7.10 on many first-generation MacBooks as well as some later-generation MacBooks and MacBook Pros [https://bugs.launchpad.net/bugs/151016 #151016]. In particular, these machines will go into suspend, but will not come out of suspend. This is because the kernel supplied with 7.10 has some issues which prevent this from working. To fix this you will have to download an older version of the Linux kernel that is known to work. The latest known version to work is 2.6.22-12, which you can download by installing the packages at the locations pointed to below. Be sure to install them in the order as they appear here.

https://launchpad.net/ubuntu/gutsy/i386/linux-image-2.6.22-12-generic/2.6.22-12.39 https://launchpad.net/ubuntu/gutsy/i386/linux-headers-2.6.22-12/2.6.22-12.39 https://launchpad.net/ubuntu/gutsy/i386/linux-headers-2.6.22-12-generic/2.6.22-12.39 https://launchpad.net/ubuntu/gutsy/i386/linux-ubuntu-modules-2.6.22-12-generic/2.6.22-12.32 https://launchpad.net/ubuntu/gutsy/i386/linux-restricted-modules-2.6.22-12-generic/2.6.22.4-12.3

After installing, edit /boot/grub/menu.lst and change the default=0 line to default=2 (if the newly-installed kernel is the third listed in the menu.lst file, which it should be when installed on a stock Gutsy install).

Restart your MacBook for the update to take effect. You will have to reinstall any wireless drivers you may have installed in the past.

iSight

It only works with ekiga:

* Install prerequisites and launch Ekiga (Ekiga may also be launched through the menus)

sudo apt-get install ekiga libpt-plugins-v4l2
ekiga
  1. Configuration. You may have to select the iSight device. Edit > Preferences > Devices > Video Devices >

  2. Video plugin: V4L2

  3. Input device: Built-in iSight

If you want to use it in 640x480 mode, then:

gconftool-2 --type integer --set /apps/ekiga/devices/video/size 1

Minimum Fan Speed

To set a minimum fan speed which may help your MacBook run cooler. Substitute your speed of choice (in RPM) for 3000 if you wish.

First you need to load the appropriate module:

sudo modprobe applesmc
echo applesmc | sudo tee -a /etc/modules

then add the following line to /etc/init.d/acpid just before the exit statement:

echo 3000 > /sys/devices/platform/applesmc.768/fan1_min

Whining noise

To fix the whining noise that some MacBooks make Add the following to /etc/init.d/acpid (at the very end before the exit statement)

echo 2 > /sys/module/processor/parameters/max_cstate

Note that this will make your MacBook use more power than usual.

Reducing power consumption

Install the powertop package

sudo apt-get install powertop

and run with "sudo powertop" in a terminal. Follow the instructions given as to reducing power consumption.

Right/Middle Clicking

You can middle click by tapping 2 fingers, and right click with 3. Different tap combinations can be used for these clicks by editing "xorg.conf" (see below) but if you'd rather use keys, read this:

  • To enable mousekeys emulation and turn the lower Enter key into Right and Middle Mouse Buttons:
    • Go to System ▸ Preferences ▸ Accessibility ▸ Keyboard in the Main menu. Check Enable keyboard accessibility features. Click the Mouse Preferences tab and check Enable Mouse Keys also. On Kubuntu: bring up System Settings, find Keyboard & Mouse, choose Mouse on the left, than the Mouse Navigation tab, and check the checkbox beside Move pointer with keyboard (using the num pad). Please note that on Kubuntu you will lose your numpad. Than copy into a terminal for

      • either: lower Enter key = Right Mouse Button, Shift + lower Enter key = Middle Mouse Button

        sudo sed -i~ 's/KP_Enter/Pointer_Button3, Pointer_Button2/' /etc/X11/xkb/symbols/keypad
      • or: lower Enter key = Right Mouse Button, Alt Gr key + lower Enter key = Middle Mouse Button

        sudo sed -i~ 's/KP_Enter/Pointer_Button3, Pointer_Button3, Pointer_Button2, Pointer_Button2/' /etc/X11/xkb/symbols/keypad
        Restart X (Ctrl+Alt+Backspace) for the changes to take effect.

Motion Sensor

The motion sensor doesn't support disk parking yet ([https://bugs.launchpad.net/bugs/139881 bug #139881]), but you can play physical neverball Smile :-)

sudo modprobe applesmc
echo applesmc | sudo tee -a /etc/modules

Then fire up neverball... (or any other game that uses a joystick)

Keyboard layouts

  • To make the keyboard usable, for an international keyboard layout:

  • Fix swapped "><" and "°^" keys (pc102/pc105)

    sudo sed -i~ 's/    <LSGT> =  94;/    <LSGT> =  49;\n    <TLDE> =  94;/' /etc/X11/xkb/keycodes/xfree86
  • Turn right Apple key into Alt Gr key (pc104/pc105)
    • The GUI way:

      Bring up the Keyboard Preferences window with System ▸ Preferences ▸ Keyboard from the Main menu. Click on the Keyboard Layout Options tab, and find Third level choosers. Mark the right Win key as third level chooser. Now your right Apple key works as Alt Gr.

    • The console way:
      sudo sed -i~ '/xkb_symbols "ralt_switch" {/a\  include "level3(rwin_switch)"' /etc/X11/xkb/symbols/level3
      Restart X (Ctrl+Alt+Backspace) for the changes to take effect.

Screen Colors (optional)

To calibrate the screen colors (in order to match OS X), you need to install xcalib. This isn't available in the Ubuntu repositories, so you'll have to download it.

Go to http://www.etg.e-technik.uni-erlangen.de/web/doe/xcalib/ and (if you are running i386) download the newest Linux binary; save it to the Desktop. (If you are running amd64, you'll need to compile it from source; make sure to install libxxf86vm-dev and libxext-dev first, and then simply make xcalib in the extracted source directory. Take the resulting xcalib binary and continue with these instructions.)

To install and configure it, you will need to do a few things in the terminal and mount a Mac OS X partition (to copy your color profile) as follows (substitute your Mac OS partition's partition number for x in /dev/sdax, 2 being the first standard partition):

sudo mv ~/Desktop/xcalib /usr/local/bin/xcalib
sudo chmod 755 /usr/local/bin/xcalib
sudo mount -t hfsplus /dev/sdax /mnt
sudo cp /mnt/Library/ColorSync/Profiles/Displays/* /usr/local/etc

Then, do an "ls /usr/local/etc" and note the name of the profile (for the next step).

Finally, add the following line to the end of either /etc/gdm/Init/Default (for standard Ubuntu/Gnome) or /etc/kde3/kdm/Xsetup (for Kubuntu/KDE), before the final "exit" statement:

/usr/local/bin/xcalib "/usr/local/etc/<insert name of profile here>"

Restart X (Ctrl-Alt-Backspace) and your Mac OS X color profile will load as X starts.

Fonts like Mac OS X (optional)

By default, Ubuntu uses a style of font rendering different than that used on Mac OS X. You may prefer fonts similar to those on Mac OS X, and you can have these on Ubuntu by doing the following:

1. Open the Appearance preference panel (System-Preferences-Appearance) 1. Click Fonts, and select the "Subpixel smoothing" option. 1. Click Details, and select "Slight" hinting. 1. Enjoy!

More touchpad tweaks

* To enable touchpad scrolling/tapping/right-click:

You will need to edit the xorg.conf file (in /etc/X11/xorg.conf)

Replace the Synaptics Touchpad InputDevice section with the following:

Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "LeftEdge" "150"
Option "RightEdge" "1070"
Option "TopEdge" "100"
Option "BottomEdge" "310"
Option "FingerLow" "25"
Option "FingerHigh" "30"
Option "MaxTapTime" "180"
Option "MaxTapMove" "220"
Option "MaxDoubleTapTime" "180"
Option "HorizEdgeScroll" "0"
Option "VertEdgeScroll" "0"
Option "TapButton1" "0"
Option "TapButton2" "0"
Option "TapButton3" "0"
Option "LockedDrags" "off"
Option "VertScrollDelta" "20"
Option "HorizScrollDelta" "50"
Option "VertTwoFingerScroll" "1"
Option "HorizTwoFingerScroll" "1"
Option "MinSpeed" "1.10"
Option "MaxSpeed" "1.30"
Option "AccelFactor" "0.08"
Option "Emulate3Buttons" "true"
Option "SHMConfig" "on"
# corner buttons
Option "RTCornerButton" "0"
Option "RBCornerButton" "2"
Option "LTCornerButton" "0"
Option "LBCornerButton" "3"
EndSection

Restart X for changes to take effect with Ctrl-Alt-Backspace

With these settings, two finger scrolling is enabled as in Mac OS X. Right click is done by tapping the bottom left hand corner of the trackpad, and middle click is done by tapping the bottom right hand corner of the trackpad. Adjust the settings to fit your preference - man synaptics gives an explanation of all trackpad options.

With two finger scrolling enabled, you will probably want to change Firefox's horizontal scrolling behavior. To do so, open Firefox, go to the URL "about:config", and change the following settings:

mousewheel.horizscroll.withnokey.action from 2 to 0 mousewheel.horizscroll.withnokey.numlines from -1 to 1

Also, it is a real good idea to have the touchpad not use click or scroll events while you are typing. I got the info for this here: http://ubuntu.wordpress.com/2006/09/20/disable-touchpad-temporarily-when-typing/ . Just make syndaemon start up by default each time you login, add it to the list of Startup Programs in System->Preferences->Sessions. Add the following command: {{ syndaemon -t -d }}

This is an alternative Synaptics Touchpad configuration that's closer to Mac OS X. Right click by tapping two fingers on the touchpad and scroll by moving two fingers across the pad.

Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "LeftEdge" "10"
Option "RightEdge" "1200"
Option "TopEdge" "10"
Option "BottomEdge" "370"
Option "FingerLow" "10"
Option "FingerHigh" "20"
Option "MaxTapTime" "180"
Option "MaxTapMove" "220"
Option "SingleTapTimeout" "100"
Option "MaxDoubleTapTime" "180"
Option "HorizEdgeScroll" "0"
Option "VertEdgeScroll" "0"
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "LockedDrags" "off"
Option "VertScrollDelta" "20"
Option "HorizScrollDelta" "50"
Option "VertTwoFingerScroll" "1"
Option "HorizTwoFingerScroll" "1"
Option "MinSpeed" "1.10"
Option "MaxSpeed" "1.30"
Option "AccelFactor" "0.08"
Option "Emulate3Buttons" "true"
Option "SHMConfig" "on"
# corner buttons
Option "RTCornerButton" "0"
Option "RBCornerButton" "0"
Option "LTCornerButton" "0"
Option "LBCornerButton" "0"
EndSection

DVI Output (gutsy)

Misc

This is useful if you already have too many partitions on your macbook and want to put the swap file directly on the main / partition.

  • dd if=/dev/zero of=/swapfile bs=1024 count=2048000
    mkswap /swapfile
    swapon /swapfile
    edit fstab:
     /swapfile               swap                    swap    defaults        0 0

Note: You can use suspend on disk with a swapfile. To do that we have to add an option passed to the kernel. Add the resume=/dev/<partition> resume_offset=<offset to the swapfile in blocks> :

  • sudo filefrag -v /swapfile
    #output : First block: 102300

Copy the first block number of the swapfile (ex:102300) and edit the defoptions line of /boot/grub/menu.lst :

  • # defoptions=quiet splash resume=/dev/sda3 resume_offset=102300

The update your grub configuration :

  • sudo update-grub

On this example, the swapfile is on partition /dev/sda3. You are now able to use suspend on disk (hibernate).


References:

CategoryCleanup