Revision 77 as of 2007-07-26 18:05:46

Clear message

Whats New

May 1 - Madwifi drivers available. No more ndiswrapper! Yay! May 14 - Updated Madwifi instructions Smile :)

How to install Ubuntu on a MacBook

Hello world! Here's my guide how to install Ubuntu on a MacBook.

Discussion thread at: http://ubuntuforums.org/showthread.php?p=1699961

Compact Guide for (k)ubuntu feisty here: https://wiki.ubuntu.com/MacBookProFeisty

For Triple Boot see this: http://wiki.onmac.net/index.php/Triple_Boot_via_BootCamp_Ubuntu

Why another HOWTO? There are others available already (see references below). But this one is different:

  • Using only GRUB instead of LILO bootloader
  • For the latest Ubuntu release
  • Made for the official wiki
  • Designed for Copy and Paste
  • Installation completes successfully without error, yes, on a MacBook!

This is the way to go if you don't care about Windows and want only Mac OS X and Linux with Boot Camp.

Ubuntu 7.04

  1. First, update MacOS X to the latest version using [http://www.apple.com/macosx/upgrade/softwareupdates.html Software Update] and upgrade the [http://www.apple.com/support/downloads/ firmware] to the latest version.

  2. Use the [http://www.apple.com/macosx/bootcamp/publicbeta.html Boot Camp] to partition the drive in two. When asked whether to create a driver disk, answer "no" and click on "reboot" at the end of the process. This way you have a shrunk Mac OS X partition and a windows partition which you will replace with some Linux partitions.

  3. Get the [http://www.ubuntu.com/getubuntu/download Live CD] and boot on it. Choose your language and/or keymap. ||<tablestyle="background: red; width:100%"> Info (!) To prevent a kernel panic which might occasionally occur, press F6 and enter one of the following parameters at the boot: prompt:BRlpj=8000000 (for 2 GHz MacBook) or lpj=7330000 (for 1.83 GHz MacBook)BRN.B.: It will automatically be applied to the installed system so you won't have to enter it manually ever again!

(note: on mine, it didnt put it in and my system was crashing, so make sure to check your grub setup after install.||

  • Select Start or install Ubuntu.

  • To install Ubuntu, double-click Install on your desktop, then click through the installer as usual. The defaults are fine most of the time. For the default partition scheme, follow these steps: At step 4, "Prepare disk space", choose Manually edit partition table and click Forward. Delete /dev/sda3 (and /dev/sda4 if it exists) from /dev/sda. Create an ext3 partition taking up all but 512MB of the disk and mount it on /, and create a swap partition taking up the remaining 512MB. Click Forward.

  • Continue through the remaining questions, and finally click Install to start the installation process.

  • The installation will be completed without an error. Choose Restart now to reboot.

  • Hold down the Alt/Option key at boot time to select the operating system to boot. To boot Linux, choose "Windows" (yes, really).

  1. Log in on your system. Now let's fix it up. Proceed to the "Common" section below.

Ubuntu 6.10

  1. First, update MacOS X to the latest version using [http://www.apple.com/macosx/upgrade/softwareupdates.html Software Update] and upgrade the [http://www.apple.com/support/downloads/ firmware] to the latest version.

  2. Once this is done install [http://refit.sourceforge.net/ rEFIt] following the [http://refit.sourceforge.net/doc/c1s1_install.html documentation]:

  3. Use the [http://www.apple.com/macosx/bootcamp/publicbeta.html Boot Camp] to partition the drive in two. When asked whether to create a driver disk, answer "no" and click on "reboot" at the end of the process. This way you have a shrunk Mac OS X partition and a windows partition which you will replace with some Linux partitions.

  4. Get the [http://releases.ubuntu.com/edgy/ubuntu-6.10-desktop-i386.iso Live CD] and boot on it. Choose your language and/or keymap.

    Info (!) To prevent a kernel panic which might occasionally occur, press F6 and enter one of the following parameters at the boot: prompt:BRlpj=8000000 (for 2 GHz MacBook) or lpj=7330000 (for 1.83 GHz MacBook)BRN.B.: It will automatically be applied to the installed system so you won't have to enter it manually ever again!

    Select Start or install Ubuntu.

  5. To install Ubuntu, double-click Install on your desktop, then click through the installer as usual. The defaults are fine most of the time. For the default partition scheme, follow these steps:

    At step 5, "Prepare disk space", choose Manually edit partition table and click Forward. Delete /dev/sda3 (and /dev/sda4 if it exists) from /dev/sda. Click Forward, then Apply, finally Close. Still at step 5, "Prepare mount points", click Back and Back again. Now choose Use the largest continuous free space and click Forward.

    Warning /!\ At step 6, "Ready to install", DO NOT click on Install JUST YET!

  6. To make GRUB installation work, GPT and MBR must be in sync and the boot partition must be of type Linux. Thanks to Debian's [http://packages.debian.org/unstable/admin/refit refit] package, available in its unstable repository, GPT and MBR can be synced from within Ubuntu. After partitioning the Macintosh HD, but before installing GRUB, syncing must be done and the boot partition type must be set to Linux. (Since the installer always repartitions the disk automatically, breaking GPT/MBR sync, fixing the disk before starting the installation doesn't work!)

    Before clicking Install, download and install the refit [http://ftp.debian.org/debian/pool/main/r/refit/refit_0.7-3_i386.deb .deb], then open a terminal and enter the following command (without hitting Enter!):

    sudo gptsync /dev/sda && sudo sfdisk -c /dev/sda 3 83
    3 means Partition 3, the boot partition (where GRUB will be installed), adapt as necessary for a non-default partition scheme.
  7. Click Install to start the installation process.

    During Installing system - Copying files..., return to the terminal and execute the command you entered before by pressing Enter.

    Answer the question May I update the MBR as printed above? [y/N] with y.

    If you did not select any partitions for use as swap space, the window "Do you want to return to the partitioning menu?" pops up, pausing the installation until you click Continue. Then you won't have to wait and fix the disk while the installer is copying files. No matter how you do it, the disk must be fixed before GRUB is installed, at 94 % installation progress!

  8. The installation will be completed without an error. Choose Restart now to reboot.

  9. The rEFIt menu offers a choice between Boot Mac OS X from Macintosh HD and Boot Linux from HD. Select Boot Linux from HD to boot into the newly installed distribution.

  10. Log in on your system. Now let's fix it up.

Common

If you have a first generation MacBook (Core Duo) then your wireless should just starting working. Second generation MacBooks (Core 2 Duo) have a newer version of the Atheros Wifi chipset, so you have to install the latest madwifi drivers which came out after the feisty release. [https://bugs.launchpad.net/madwifi/+bug/122703 bug #122703]

(On gutsy, you'll find that this is too old, and you should rather use http://snapshots.madwifi.org/madwifi-trunk-current.tar.gz)

Here are the latest madwifi instructions:

  • sudo aptitude install build-essential
    wget http://snapshots.madwifi.org/madwifi-hal-0.90.30.13-current.tar.gz
    tar -zxvf madwifi<tab>
    cd madwifi<tab>
    make
    sudo make install   (answer 'r' when asked)

at this point you can reboot and you will probably have working wifi. Or you can play around with these commands.

sudo modprobe ath_pci
sudo modprobe wlan_scan_sta
sudo wlanconfig ath0 list scan (scan for APs)
sudo iwconfig ath0 essid "foo" (connect to open AP "foo")
sudo dhclient ath0 (get IP address from DHCP)

Or you can read these docs if you need to: http://madwifi.org/wiki/UserDocs/FirstTimeHowTo

If you want to use ndiswrapper (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/

I'll show you the commands you'll have to copy and paste into a terminal (Applications -> Accessories -> Terminal). That's easier and faster than doing it with GUI applications, and thanks to verbatim copying, you won't make any mistakes.

  • In Ubuntu 6.10, install Network Manager (included by default in Ubuntu 7.04):

    sudo apt-get -y install network-manager-gnome
  • To fix the screen resolution, install the 915resolution package (it's in the Universe repository). MacBook Pro users can skip this step.

    sudo software-properties -e universe
    sudo apt-get update
    sudo apt-get install 915resolution
    Restart X (Ctrl+Alt+Backspace) for the changes to take effect.
  • 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 download the newest Linux binary (save it to the Desktop). 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, create a new file entitled "51xcalib" in /etc/X11/Xsession.d (sudo nano /etc/X11/Xsession.d/51xcalib) with the following contents:

  • # script to start xcalib when X loads
    /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 be used every time you start up.

  • New MacBooks / MacBookPro - backlight 7.04/7.10: [https://bugs.launchpad.net/ubuntu/+source/hal/+bug/119184/ bug filed]

    Change in line 6 of /usr/share/hal/fdi/policy/10osvendor/10-macbook-backlight.fdi "Apple Comupter, Inc" to "Apple Inc.".
    Change in line 8 of /usr/share/hal/fdi/policy/10osvendor/10-macbookpro-utils.fdi "Apple Comupter, Inc" to "Apple Inc.".
  • To control your backlight, install macbook-backlight (it's from a third-party repository): Not needed in Ubuntu 7.04

    wget http://ubuntu.desrt.ca/macbook-backlight_0.0-1_i386.deb
    gdebi-gtk macbook-backlight_0.0-1_i386.deb
    sudo chmod u+s /usr/bin/macbook-backlight
    gconftool-2 --type string --set /apps/metacity/global_keybindings/run_command_1 "0x65"
    gconftool-2 --type string --set /apps/metacity/global_keybindings/run_command_2 "0xd4"
    gconftool-2 --type string --set /apps/metacity/keybinding_commands/command_1 "/usr/bin/macbook-backlight -10"
    gconftool-2 --type string --set /apps/metacity/keybinding_commands/command_2 "/usr/bin/macbook-backlight +10"
  • Suspend is broken in Ubuntu 7.04 on many first-generation MacBooks as well as some later-generation MacBooks and MacBook Pros. In particular, these machines will go into suspend, but will not come out of suspend. This is because the kernel supplied with 7.04 has some issues which prevent this from working. To fix this, you should either build your own kernel from the latest sources (see KernelCustomBuild for more info on this) or try using the Gutsy (7.10 prerelease) kernel (which currently works fine, but may not work anymore once Gutsy undergoes more updates. To install the Gutsy kernel (be warned that this is prerelease software - use at your own risk): Add the following to /etc/apt/sources.list (sudo nano /etc/apt/sources.list to edit

    deb http://archive.ubuntu.com/ubuntu/ gutsy main restricted
    deb-src http://archive.ubuntu.com/ubuntu/ gutsy main restricted
    Then, to prevent apt-get from installing gutsy packages by default, put the following in /etc/apt/preferences:
    Package: *
    Pin: release o=Ubuntu,a=feisty
    Pin-Priority: 900
    
    Package: *
    Pin: release o=Ubuntu,a=gutsy
    Pin-Priority: 400
    Now , use the command
    sudo apt-get -t gutsy install linux-image-2.6.22-8-generic linux-restricted-modules-2.6.22-8-generic linux-ubuntu-modules-2.6.22-8-generic
    to install the kernel and all needed dependencies. The version number (2.6.22-8) is the current Gutsy kernel - you may need to change this if it is updated to a newer version.
  • To fix suspend if the display doesn't wake up from sleep but stays black (any rev MacBook):

    sudo ln -bs /bin/true /usr/sbin/laptop-detect

    Restart your MacBook for the fix to take effect.

  • To set a minimum fan speed (helpful for making the MacBook run cooler) Add the following to /etc/init.d/acpid (at the very end before the exit statement):

    echo 3000 > /sys/devices/platform/applesmc/fan0_minimum_speed
    Substitute your speed of choice (in RPM) for 3000 if you wish... Note that this only applies to the 7.04 (feisty) release - if you're running a 7.10 (Gutsy) pre-release or a kernel from Gutsy, this won't work.
  • 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
  • Ubuntu 7.04 has available the mouseemu package, which is used to emulate right and middle clicks. Middle click is set to F11 by default, and right click to F12. However, this causes the light on the caps lock and num lock keys to stop working. As a result, you may want to uninstall it (apt-get remove mouseemu) and use tapping or mousekeys emulation (described below) for middle/right click.

  • To enable mousekeys emulation and turn the lower Enter key into Right and Middle Mouse Buttons:
    • 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/pc
      gconftool-2 --type bool --set /desktop/gnome/accessibility/keyboard/enable true
      gconftool-2 --type bool --set /desktop/gnome/accessibility/keyboard/mousekeys_enable true
    • 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/pc
      gconftool-2 --type bool --set /desktop/gnome/accessibility/keyboard/enable true
      gconftool-2 --type bool --set /desktop/gnome/accessibility/keyboard/mousekeys_enable true
    Restart X (Ctrl+Alt+Backspace) for the changes to take effect.
  • 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)
    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.

* 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 }}

  • OPTIONAL: To install Beryl, instead of compiz:

    1. Add the beryl repository. Skip this step if you are using 7.04, as it includes beryl in the ubuntu repository.

      sudo sed -i '$adeb http://ubuntu.beryl-project.org/ edgy main' /etc/apt/sources.list
      wget http://ubuntu.beryl-project.org/root@lupine.me.uk.gpg -O- | sudo apt-key add -
      sudo apt-get update
    2. Install beryl

      sudo apt-get -y install beryl emerald-themes
      beryl-manager
  • OPTIONAL: To make the built-in iSight camera work with Ekiga (even after restarting!):

  • wget http://people.freedesktop.org/~rbultje/linux-uvc-0.1.0-e.tar.gz
    tar -xvvzf linux-uvc-0.1.0-e.tar.gz
    cd linux-uvc-0.1.0-e
    sudo apt-get install libc6-dev libgcrypt11-dev libglib2.0-dev libgpg-error-dev libusb-dev linux-libc-dev
    make
    sudo apt-get -y --purge autoremove libc6-dev libgcrypt11-dev libglib2.0-dev libgpg-error-dev libusb-dev linux-libc-dev
    sudo mv extract /root
    sudo mount -r -t hfsplus /dev/sda2 /mnt
    sudo cp -p /mnt/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport /root
    sudo umount /mnt
    sudo /root/extract /root/AppleUSBVideoSupport
    sudo make install
    sudo modprobe uvcvideo
    sudo sed -i~ '$i/root/extract /root/AppleUSBVideoSupport' /etc/rc.local
    gconftool-2 --type string --set /apps/ekiga/devices/video/plugin "V4L2"
    #gconftool-2 --type int --set /apps/ekiga/devices/video/size 1
    ekiga
    
    NOTE:  isight works out of the box on Feisty Fawn(7.04)(Tested on Feisty Beta). You will need to select V4l2 as your video driver when configuring the webcam in Ekiga.  (Actually, it doesnt work out of the box for me, --stevenwagner, Anyone ?

A great forum post to make the webcam work even with kernel 2.6.20-16 (latest in Feisty): http://ubuntuforums.org/showthread.php?t=225621

  • OPTIONAL: Extended desktop and video mirroring:

    DVI/VGA output is enabled in mirror mode by default, but if the external monitor isn't the same as the MacBook's, the mirrored display will have a wrong refresh rate and resolution, making it pretty much useless. To fix this, editing the Xorg configuration file is necessary, which can be quite complicated. To make it as easy as possible, I've created a configuration which can be copied and pasted into the xorg.conf, at the beginning or end of the original file. Then you can switch between single and dual head setups by commenting/uncommenting a few lines and restarting the X server.

    N.B.: Extended desktop and video mirroring do NOT work with Beryl just yet! You'll have to disable either dual head mode or the 3D desktop while using the other.

    1. Create a backup of your Xorg configuration file:
      sudo cp -p /etc/X11/xorg.conf /etc/X11/xorg.conf~
    2. Open your Xorg configuration file for editing with administrator privileges:
      sudoedit /etc/X11/xorg.conf
    3. Copy and paste the following excerpt into your Xorg configuration file, add it at the top or bottom of the original, but do NOT overwrite the existing content:

      ######################################################################
      Section "ServerFlags"
              Option          "DefaultServerLayout" "Default Layout"
      #       Option          "DefaultServerLayout" "MonitorLayout Layout"
      #       Option          "DefaultServerLayout" "Clone Layout"
      #       Option          "DefaultServerLayout" "Xinerama Layout"
      EndSection
      ######################################################################
      Section "Device"
              Identifier      "MonitorLayout Device"
              Driver          "i810"
              BusID           "PCI:0:2:0"
              Option          "MonitorLayout" "NONE,CRT+LFP"
      EndSection
      
      Section "Screen"
              Identifier      "MonitorLayout Screen"
              Device          "MonitorLayout Device"
              Monitor         "Color LCD"
              DefaultDepth    24
              SubSection "Display"
                      Depth           24
                      Modes           "1280x800"
              EndSubSection
      EndSection
      
      Section "ServerLayout"
              Identifier      "MonitorLayout Layout"
              Screen          "MonitorLayout Screen"
              InputDevice     "Generic Keyboard"
              InputDevice     "Configured Mouse"
              InputDevice     "stylus" "SendCoreEvents"
              InputDevice     "cursor" "SendCoreEvents"
              InputDevice     "eraser" "SendCoreEvents"
      EndSection
      
      Section "Device"
              Identifier      "Clone Device"
              Driver          "i810"
              BusID           "PCI:0:2:0"
              Option          "MonitorLayout" "CRT,LFP"
              Option          "Clone"
      EndSection
      
      Section "Screen"
              Identifier      "Clone Screen"
              Device          "Clone Device"
              Monitor         "Color LCD"
              DefaultDepth    24
              SubSection "Display"
                      Depth           24
                      Modes           "1280x800"
              EndSubSection
      EndSection
      
      Section "ServerLayout"
              Identifier      "Clone Layout"
              Screen          "Clone Screen"
              InputDevice     "Generic Keyboard"
              InputDevice     "Configured Mouse"
              InputDevice     "stylus" "SendCoreEvents"
              InputDevice     "cursor" "SendCoreEvents"
              InputDevice     "eraser" "SendCoreEvents"
      EndSection
      
      Section "Device"
              Identifier      "Xinerama Device"
              Driver          "i810"
              BusID           "PCI:0:2:0"
              Screen          0
              Option          "MonitorLayout" "CRT,LFP"
      EndSection
      
      Section "Device"
              Identifier      "Xinerama Device (2)"
              Driver          "i810"
              BusID           "PCI:0:2:0"
              Screen          1
              Option          "MonitorLayout" "CRT,LFP"
      EndSection
      
      Section "Screen"
              Identifier      "Xinerama Screen"
              Device          "Xinerama Device"
              Monitor         "Color LCD"
              DefaultDepth    24
              SubSection "Display"
                      Depth           24
                      Modes           "1280x800"
              EndSubSection
      EndSection
      
      Section "Screen"
              Identifier      "Xinerama Screen (2)"
              Device          "Xinerama Device (2)"
              Monitor         "Color LCD"
              DefaultDepth    24
              SubSection "Display"
                      Depth           24
                      Modes           "1280x1024"
              EndSubSection
      EndSection
      
      Section "ServerLayout"
              Identifier      "Xinerama Layout"
              Screen          "Xinerama Screen"
              InputDevice     "Generic Keyboard"
              InputDevice     "Configured Mouse"
              InputDevice     "stylus" "SendCoreEvents"
              InputDevice     "cursor" "SendCoreEvents"
              InputDevice     "eraser" "SendCoreEvents"
              # RightOf LeftOf Above Below
              Screen          "Xinerama Screen (2)" LeftOf "Xinerama Screen"
              Option          "Xinerama"
      EndSection
      ######################################################################
    4. To switch between different display modes, change server flags by modifying the comments like this:
      1. Original single-head display (Default) - same as with original configuration:
        Section "ServerFlags"
                Option          "DefaultServerLayout" "Default Layout"
        #       Option          "DefaultServerLayout" "MonitorLayout Layout"
        #       Option          "DefaultServerLayout" "Clone Layout"
        #       Option          "DefaultServerLayout" "Xinerama Layout"
        EndSection
        b. Dual-head video mirroring 1 (Piped) - resolutions must be equal, but cannot be changed; overlays are supported:
        Section "ServerFlags"
        #       Option          "DefaultServerLayout" "Default Layout"
                Option          "DefaultServerLayout" "MonitorLayout Layout"
        #       Option          "DefaultServerLayout" "Clone Layout"
        #       Option          "DefaultServerLayout" "Xinerama Layout"
        EndSection
        c. Dual-head video mirroring 2 (Cloning) - resolutions must be equal, but can be changed; overlays aren't supported:
        Section "ServerFlags"
        #       Option          "DefaultServerLayout" "Default Layout"
        #       Option          "DefaultServerLayout" "MonitorLayout Layout"
                Option          "DefaultServerLayout" "Clone Layout"
        #       Option          "DefaultServerLayout" "Xinerama Layout"
        EndSection
        d. Dual-head extended desktop (Xinerama) - no direct rendering (no 3D acceleration!):
        Section "ServerFlags"
        #       Option          "DefaultServerLayout" "Default Layout"
        #       Option          "DefaultServerLayout" "MonitorLayout Layout"
        #       Option          "DefaultServerLayout" "Clone Layout"
                Option          "DefaultServerLayout" "Xinerama Layout"
        EndSection

        Info (!) If you, like me, have an external monitor whose resolution differs from the MacBook's, I recommend you use either method C (Dual-head video mirroring 2 - Cloning) with both screens at the same resolution (e.g. 1024x768) or D (Dual-head extended desktop - Xinerama) with both screens at their native resolutions (e.g. 1280x800 MacBook, 1280x1024 external). No matter which mode you choose, 3D desktops (Beryl) should be disabled when using a dual-head setup, otherwise the X server might crash! If your external screen is of a different resolution than 1280x1024, search and replace that with the proper resolution in the xorg.conf! If you want to have two independent desktops, each with their own menus, you can comment out Option "Xinerama".

    5. Save the configuration, exit the editor, then press Ctrl+Alt+Backspace to restart the X server. If it doesn't work, reboot. If it still doesn't work, restore the backup and try with some different settings.

Have fun with Ubuntu on the MacBook!

Discuss it here: http://ubuntuforums.org/showthread.php?p=1699961

See ya! Awesome! B) -- StefanDanielSchwarz

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


References:

CategoryCleanup