maandag 7 juli 2008

HOWTO: MacBook (since february 2008) with Sabayon Linux 3.5 (Compiz Fusion, sound, belgian french keyboard)

Hi all,

I have my macbook since a few months and I like it alot.

But even Mac OS X can't give me the pleasure Linux or BSD gives me. (personally I hate the window manager)

That's why I tried installing Sabayon Linux.

I have experience with Gentoo, Debian, CentOS, ArchLinux, ...
However, the reasons why I installed Sabayon Linux (which is based on Gentoo) are the following:
- I like Gentoo alot, but am sometimes tired of all the compiling (Sabayon Linux provides a binary package manager which works together with portage (Gentoo package manager)
- Gentoo is more error prone
- Sabayon Linux has all the "bling bling" right out of the box (well... almost all:D )
- Sabayon is optimized to boot as fast as possible and shutdown as fast as possible (believe me, shutdown is really fast). This makes the other distros less good for this.
- ...

The following steps need to be done:
====================================
-Prepare the environment (partitioning)
-Install Sabayon Linux
-Install the bootloader (rEFIt)
-Configure Xorg to work with Compiz Fusion
-Configure Xorg to support the keyboard layout
-Configure ALSA for audio support
-Things still to fix

Partitioning
------------
There are different ways to do this, however I got alot of problems doing it.

I first tried with BootCamp (google for it ;) )
In a graphical interface you can slide a bar which splits a volume in 2 parts.
For me this failed. I booted with the Mac OS X Leopard CD and went to the diskutility.
There I repaired the drive and the permissions.
Still the same error (something about not being enough space; I even removed 2 large files which were 18GB in total, still the same result). I tried to first resize the first partition using diskutil, but with no succes either.
When I typed df -h to see the usage of the partitions I saw there was something wrong, so again I booted from CD and repaired it.
After alot of trying I gave up this method.

I disabled the journaling in Mac OS X:(should be re-enabled after resizing the partition)
sudo diskutil disableJournal disk0s2

I downloaded the Sabayon Linux iso file (x86_64) and burned it to a DVD.
Restart Mac OS X and be shure the DVD is in the drive. While booting up press "c" (without the quotes) after the chimes sound. (try to press it multiple times or for a long time if it fails to boot).
"Start Sabayon Linux 3.5" seemed a good start.
However I got a grey X server, and the Desktop Manager(window manager) would not start.
I went to the console by pressing "fn"+"ctrl"+"alt" (no shift for the alt button) and stopped xdm by issueing /etc/init.d/xdm stop
I just want X running with an easy window manager just so I could start gparted.
With nano I created a .xinit file in the root home directory.
nano .xinit
This was the content:
startfluxbox

Make .xinit executable by doing:
chmod +x .xinit
Now issue:
startx

This started fvwm (which is a very minimal window manager but it is more than enough for this purpose). X seemed to ignored my .xinit because fluxbox did not get started. Maybe I did something wrong, but the important is I have Xorg and a shell.

It is time to start gparted:
On a shell I typed "gparted" (without the quotes)
Then I selected where I wanted the application to be placed on the screen.

Then I resized the Mac OS X partition and Applied the changes.

To my surprise this went without any problems.

What I forgot the first time was making a linux partition and making it bootable.
So I rebooted after the install of Sabayon Linux (created the partition tool in the installer) and did it using the command line.
Again boot with the Sabayon Linux CD and this time choose Console only
parted
list
set 3 boot on
Where 3 is the number of the partition where linux is going to be (or in my case: already is)
If you don't make it bootable you get a black screen with a message that the device is not bootable.

Installation
------------
I used the text mode installer
After the installation boot into Mac OS X again (you will not be able to boot into linux anyway at this time).

Install boot manager
--------------------
Download rEFIt from sourceforge. Copy the efi directory to the root directory (not the root home directory). Go into the folder and run enable_always.sh (or something similar).

Now reboot again.
This time you should be presented with a menu which gives you the choice to boot Mac OS X or Linux (maybe also CD/DVD).
Just trying to boot Linux at this point will possibly still fail.
If it does, reboot and select the rEFIt shell in the menu.
It will automatically tell you something is wrong with the MBR and that it should be fixed.
Let rEFIt fix it.

Now reboot and select Linux.
Taaadaaaaaa :D

Configure Xorg for Compiz Fusion
--------------------------------
Go to the start menu and type "Compiz" in the search text field.
Start Compiz Fusion Icon.
When I the started applications I had only blank windows :s

I had a portable before with an Intel chipset so I knew where to search.
Open a terminal and edit /etc/X11/xorg.conf
Change your xorg Device section (Driver i810) until it looks like this: (you only have to uncomment 2 or 3 lines, if not, you are doing something wrong or another chipset is used. This method will help for you then)
IMPORTANT! BE SURE TO TAKE A BACKUP OF THIS FILE
Section "Device"
Identifier "VESA"
Driver "i810"
Option "RenderAccel" "on"
Option "XAANoOffscreenPixmaps"
#Option "BusType" "PCI"
#Option "ColorTiling" "on"
#Option "EnablePageFlip" "on"
Option "AccelMethod" "XAA"
EndSection

Now restart Xorg by issueing ctrl+alt+backspace (no shift for the alt key)
After starting Compiz Fusion Icon it should work great:)

Configure Xorg keyboard layout
------------------------------
Go to the start menu and search for "Control Center.
Start it and go to "Regional & accessibility", then "Keyboard layout".
Select France keyboard and add it to the list on the right.
Keep the layout variant as "Default" and for keyboard model select "MacBook/MacBook Pro (Intl)".

Apply and it should work correctly.
IMPORTANT! For square brackets or curly brackets (or braces), you need to use the LEFT alt key (with or without shift for curly or square brackets).

After logging out I get back to a qwerty keyboard layout. This is probably because I have to log in as root to change the keyboard layout system-wide.

Configure ALSA for audio support
--------------------------------
It took me some time to get this solved altough I found out quickly that it was the snd-intel-hda module(which was also in my Dell Latitude D630:) )

I searched for a few minutes and saw about the model that can be supplied as an option to the snd-intel-hda kernel module.

I was pretty sure this was the answer to my problem.
I tried with macbook, intel-mac-v1, ....
This url pointed me in the good direction:
http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Resolve_Problems_with_HDA-Intel_Sound_Cards

None of these worked so after a lot of searching I decided to try with mbp3 (which is for the MacBook Pro 3rd generation; while mine isn't).

IMPORTANT: To see what model you have you could check the list in the introduction on this link:
http://gentoo-wiki.com/HARDWARE_Apple_MacBook

Edit /etc/modules.d/options (or create it if it does not exist yet)
and put the following in it:
options snd-hda-intel model=mbp3

(if it still fails also try to add this:
options snd-hda-intel position_fix=1
)

IMPORTANT: Be sure to do this after each change you make to /etc/modules.d/*
update-modules force
This will regenerate the /etc/modprobe.conf and /etc/modules.conf files.
And then:
/etc/init.d/alsasound start.

If still no succes, retry with doing
alsaconf

Also check that your volumes aren't muted.
00 means NOT muted. For me it is always confusing.
Master, PCI and Front should be enabled if I am correct.

Things still to fix
-------------------
-When I use the arrow keys, they just don't move the cursor, but instead do another action
-Right click is not possible :s
-The touchpad is so sensitive that when I type I accidentaly move the cursor.

Geen opmerkingen: