Sunday, April 12, 2009

Installing Ubuntu on a MacBook

macbookpro.png

About

This page describes installing Ubuntu 8.10 (Intrepid Ibex) on the 1st Generation MacBook Pro, hardware revisions 1,1 and 1,2, processor: Core Duo.

To determine which version / generation of MacBook Pro you have, either click in OS X on the Apple on the top left, then "About this Mac" -- "More Info...", see the generation in the "Model Identifier" row; or run in Linux

sudo dmidecode -s system-product-name

Following is a list of links providing details on running Linux on the MacBook or MacBook Pro:

Installation Methods

Various ways to install Ubuntu on your mac, alongside OSX, Windows, or both and the methods are the same for any Intel Mac version. See the Installation Page for details on Installation.

Post-installation Setup

WARNING: to avoid system freeze and overheating (see bug 262550) make sure to add applesmc to your /etc/modules file (the module is automatically loaded on jaunty).

Video

video_card.png

You have 2 choices for the video driver:

1. The default, open source radeon driver, which is automatically selected. This driver supports 3D (OpenGL 1.3), fast 2D (with EXA), Visual Effects (Compiz), textured video Xv with bicubic filtering, XRandR 1.2.

2. The closed source fglrx ATI Proprietary driver, which is automatically detected in the Hardware Drivers and installs if selected. This driver should be used only if you need OpenGL 2.1 support (e.g. for recent games).

Note: to disable auto screen brightness buggy adjustments, go to System > Preferences > Power Management > General Tab > at the Extras, and uncheck the "Use ambient light to ajust LCD brightness" option.

Screen Colors

screen_colors.jpg

MacBook Pros can use a program called xcalib to emulate the screen coloring calibration of OS X:

sudo apt-get install xcalib

sudo mount -t hfsplus /dev/sda2 /mnt
#(this mounts the mac partition [/dev/sda2] on /mnt)

sudo mkdir /etc/xcalib
sudo cp /mnt/Library/ColorSync/Profiles/Displays/* /etc/xcalib

Then, do an "ls /etc/xcalib" 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/bin/xcalib "/etc/xcalib/"

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

Sound / Audio & Microphone

speakers.jpg microphone.jpg

1. Double click on the Volume icon (it opens Volume Control), Select Edit > Preferences > enable Master, PCM, Front, Surround, Capture, Capture 1, Input Source, Mux, and Mux 1.

2. In Playback TAB -> Increase the volume to 100% and unmute (Master, PCM , Front, Surround).

3. In Recording TAB -> Unmute all and set 'Capture' and 'Capture 1' Volume to 95% and 'Mux' and 'Mux 1' to 50% of volume(higher results on static)

4. In Options TAB -> Set Input Source as: 'Mic'

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

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

Wireless

wireless.jpg

Works out of the box with the default madwifi driver from the restricted repository. Alternatively, you can install the linux-backports-modules-intrepid package and use the open source ath5k driver; in this case, make sure you first disable the madwifi driver from System -> Administration -> Hardware Drivers.

Temperatures & Fan Speed

temperatures.jpg

Hard Disk Temperature

hddlinux.jpg

sudo apt-get install hddtemp

Select 'Yes', then 'OK', and 'OK' again.

CPUs Temperature

cpu.jpg

add this to /etc/rc.local :

modprobe coretemp
sensors -s

To install lm-sensors and sensors-applet type in terminal :

sudo apt-get install lm-sensors sensors-applet

Right Click in the main panel menu and 'Add to Panel...' the 'Hardware Sensors Monitor', then right click on Hardware Sensors Monitor applet and go to 'Preferences' > 'Sensors' and Enable > 'hddtemp' > '/dev/sda', and also Disable > 'libsensors' > temp2 to temp11 .

Manual Fan Speed Control

fan_speed1.png fan_speed2.png fan_speed3.png

It is not recommended to set the fan speed manually, because the Linux kernel automatically adjusts the fan speed proportionally to the CPU temperature. If you really need to set it manually, this is the method to use. This method does not carry over through a reboot, so rebooting the computer reverts the fans to automatic speed.

Copy the files to your home dir: fan_speed1 , fan_speed2 , fan_speed3

And to execute: gksu bash ~/fan_speed1 (...2 or 3)

To see the fan speed, Enable 'Left Side' and 'Right Side' in the Sensors Applet Preferences.

This way, you have three different configurations of fan speeds to use for different activities. It is recommended to set the fans to a minimum of 3500RPM (fan_speed1). When you are doing CPU-intensive activities, set the fans to 4000RPM (fan_speed2) or even 5000RPM (fan_speed3).

Keyboard Fixes

altgr.jpg

The MacBook Pro Keyboard doesn't have a Alt GR / Right Alt key, so there is no way to type Third Level Keys, such as "@" and "[" (these vary from country to country). Here is a solution:

Go to System > Preferences > Keyboard. On the Layout Options tab, select "Third Level Choosers" and check "Press Enter key on keypad to choose 3rd level".

Now you can use the Left Enter key (on the MacBook Pro keyboard) as a Alt Gr Key to access these Third Level Keys.

Alternative: Select form System > Settings > Keyboard > Layout > Model "MacBook Pro" and function keys should work. Also, buttons F11 and F12 simulate 2nd and 3rd mouse buttons. Left Enter simulates Alt Gr button.

Right / Middle Clicking

rightclick.jpg

Go to System > Preferences > Keyboard > Accessibility tab > General - and enable "Allow to turn accessibility features on and off from the keyboard"

Go to System > Preferences > Keyboard > Mouse Keys tab > and enable "Allow to control the pointer using the keyboard"

Create a text file as ~/.xmodmap containing the following text (Note: This sets Right Apple key as Right mouse click and Left Enter Key as Alt Gr key)

keycode 116 = Pointer_Button3
keycode 108 = ISO_Level3_Shift

Add a call to xmodmap to your startup applications (System > Preferences > Sessions) [example]:

xmodmap /home/fuz2y/.xmodmap

Restart X (Ctrl+Alt+Backspace) for the changes to take effect, and load the xmodmap.

You can use xev in order to see the keycodes associated with each key.

Alternative: Select form System > Settings > Keyboard > Layout > Model "MacBook Pro" and function keys should work. Also, buttons F11 and F12 simulate 2nd and 3rd mouse buttons. Left Enter simulates Alt Gr button.

Function Keys

fuctionkeys.jpg

Pommed is a daemon to support extra keys on apple computers. These include the brightness, eject, volume and others. It can be installed with this command:

sudo apt-get install pommed

The default behavior on Apple keyboards is to have the top row keys primarily function as media keys (brightness, volume, etc), and have the expected function keys (F1, F2, etc) accessible with using the fn keys.

To reverse this behavior, edit the pommed configuration file with this command:

sudo gedit /etc/pommed.conf

Change the value of fnmode to "2", and save. At any time, you can change this value back to "1" to return to the default behavior.

Touchpad Fixes

touchpad.jpg

To disable the touchpad while typing, configure syndaemon to startup when you login. To 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

Log out and back in to see the changes.

WebCam (iSight)

webcam.jpg

The iSight webcam is working with the default uvcvideo kernel module; you need however the proprietary firmware from your OS X installation. See AppleiSight for instructions on how to do this.

Access OS X, Windows Partition & Network Shares

hddosx.jpg hddwin.jpg shares.jpg

To do so edit /etc/fstab , here's what you need to add :

#...

# Macintosh
/dev/sda2 /media/Macintosh hfsplus rw,exec,auto,users 0 0

# Windows
/dev/sda3 /media/Windows ntfs defaults,uid=1000 0 0

Then do the following in terminal:

sudo gedit /etc/nsswitch.conf (change the line "hosts: file dns ..." to "file dns wins ...")
sudo aptitude install winbind samba smbfs
sudo mkdir /media/Macintosh
sudo chmod 755 /media/Macintosh
sudo mkdir /media/Windows
sudo chmod 755 /media/Windows

And to apply:

sudo umount -a
sudo mount -a

The Mac HFS+ volume will be mounted read only. However, you will most likely not be able to access files in your OSX user's folder due to permissions issues. To fix this, log into your account in OSX. Open up terminal and navigate to the directory containing the folder you want to be able to access from Ubuntu. Issue the following commands:

sudo chmod 755 

If you want to access the files within that folder you need to pass the recursive flag to chmod so:

sudo chmod -R 755 

For example, if you want to access your music you should navigate to your user folder and issue the following command:

sudo chmod -R 755 Music

Allow Writing to HFS+ (OS X) Partitions

hddosx.jpg

The hfsplus drivers for Ubuntu cannot handle journaling, and thus can't write to HFS+ partitions with journals, though they can still be read. To allow writing, journaling must be disabled in OS X. However, please note that this may increase the risk of filesystem corruption, even in OS X itself. To disable journaling, use diskutil in a terminal in OS X (this can also be done with the installation media), replacing / for the desired volume if applicable:

sudo /usr/sbin/diskutil disableJournal /

With this change, the partition will be writable in Ubuntu, and will automatically be mounted to allow writing. However, if the drivers detect any filesystem corruption, writing will be disabled. This can be remedied by either booting into OS X, which will attempt to repair the damage, or (in hardy) running fsck.hfsplus, found in the hfsprogs package in universe.

Apple Remote Control

remotecontrol.jpg

Apple's Remote Control is working by default, but only allows you to control the Volume. So here's the tweaks to get it working on with other applications:

sudo apt-get install inputlirc lirc lirc-x

At the prompt select apple's mac mini ir.

And edit /etc/rc.local and add:

/etc/init.d/inputlirc start
/etc/init.d/inputlirc restart

Then go to > System > Preferences > Sessions , and add the following to the Startup list by this order:

/usr/bin/irexec $HOME/.lircrc
/usr/bin/irxevent $HOME/.lircrc

Note: $HOME = your home directory. Must be written out, e.g. /home/janedoe

To make it work on the startup you have to change the file access mode so that the user can run it, but it still executes in root mode:

sudo chmod +s /usr/bin/irexec
sudo chmod +s /usr/bin/irxevent

Then to create the .lircrc file in your home dir do this:

gedit ~/.lircrc

Here's my lircrc_file , select all and copy to ~/.lircrc

Reboot for it to work!

sudo shutdown -hr now

Apple Wireless Keyboard

apple_wireless_keyboard.jpg

  • Reboot your system
  • Right the bluetooth icon in the menu bar
  • Select preferences
  • Goto the service tab
  • Check "input service"
  • Click on "Add"
  • Select the bluetooth keyboard that should appear
  • Click on connect
  • A balloon should appear asking for a PIN: enter whatever you want (0000 works just fine) and validate
  • On the bluetooth keyboard type the same PIN and press enter
  • You should now be able to use your keyboard

Note: You'll have to delete your wireless keyboard profile from OSX as it won't let you pair with Linux. Restart into OSX, delete wireless keyboard profile, restart into Ubuntu and repeat the steps. The next time you log into OSX, configure your keyboard normally; Ubuntu will keep connecting after that (refuses to pair just the first time when OSX configured).

Desktop Tweaks

Fonts like Mac OS X

fonts.jpg

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)

2. Click Fonts, and click on Details..., on Hinting select the "Slight" option.

Troubleshooting

questions.jpg

Bootsplash fix

If you experience a blank screen during booting and shutdown, edit the file:

/etc/usplash.conf

and replace the resolution there with your display's actual resolution (for the 15" this is 1440 by 900)

It should look like:

xres=1440
yres=900

After editing, enter in a shell:

sudo update-initramfs -u -k `uname -r`

Battery state not working

I had a problem with the acpi value of my battery.

It was due to a hardware problem.

To solve it (source):

  • Shut down your Computer
  • Disconnect the AC Adapter
  • Remove the computer's battery
  • Press the power button for 5 seconds
  • Insert the battery and reconnect the AC Adapter
  • Turn your computer on

No comments: