Draft Instructions for Debian Lenny 5.0 on the Macbook Air
Posted: | 2010-03-08 13:10 |
---|---|
Tags: | Debian, Macbook Air |
Headline: | Draft instructions for installing Debian Lenny on a Macbook Air and getting everything working. |
I bought a MacBook Air as soon as they were availble in the Apple Store in Regent Street, London and it had served me well until January. Ubuntu Karmic was telling me my hard disk was failing and sure enough I started getting strange data loss problems. Not wanting to believe it and since the number of bad sectors wasn't going on I thought it might just be Karmic mis-behaving so I installed Debian 5. It only lasted a few days before the data loss problems removed large parts of the disk, preventing me from booting at all. At that point I took the MacBook Air in to have a replacement hard drive fitted and 5/6 weeks later I still haven't got it back (but that's a different story) so I haven't re-tested the instructions in this file. In fact it was so difficult compared to Ubuntu I expect I'll just wait for the release of Lucid and install that. I hope that dispite that they might still be useful to someone. See the further reading links at the bottom too.
Contents
Installation
Installation proceeds fine but afterwards GRUB doesn't work. Other instructions suggest running update-grub2 gptsync during the installation. I did afterwards from a rescue disk but it had no effect. Instead I got reFIT to rescan the partitions to boot by selecting the appropriate icon from the reFIT screen. This did the trick.
Change Apt Settings
Now remove the CD from the list of Debian sources.
sudo vim /etc/apt/sources.list sudo apt-get update sudo apt-get upgrade
Change Nautilus behaviour
First click Edit->Preferences then in the Behaviour tab tick "Always open in browser windows". Then install the equivelent of Microsoft's CmdHere powertoy for Nautilus under Linux:
sudo apt-get install nautilus-open-terminal
SSHFS
The wireless drivers I need are on a remote server I access with SSHFS. I need to install SSHFS to mount the drive with the wireless drivers. You need a USB ethernet drive or get them from the MacBook Air CD instead:
sudo apt-get install sshfs
Mount it:
mkdir ~/Desktop/Archive sudo sshfs -o allow_other,ro root@192.168.1.10:/shares/internal/PUBLIC ~/Desktop/Archive
Wireless
Install the unrar deb from http://packages.ubuntu.com/hardy/unrar:
sudo dpkg -i unrar_3.7.8-1_amd64.deb
Then get ndiswrapper installed and working:
sudo apt-get install ndiswrapper-common ndiswrapper-utils-1.9 # May not need ndiswrapper-common here. sudo apt-get install ndiswrapper-source sudo module-assistant prepare sudo module-assistant auto-install ndiswrapper
Get the broadcomxpinstaller.exe file from the Mac OS X DVD and install the firmware like this:
mkdir ~/Desktop/wireless cp /home/james/Desktop/Archive/Work\ 3/Essentials/Mac/broadcomxpinstaller.exe ~/Desktop/wireless cd ~/Desktop/wireless chmod u+w . unrar x broadcomxpinstaller.exe sudo ndiswrapper -i bcmwl5.inf sudo ndiswrapper -m sudo modprobe -v ndiswrapper
Check the status:
sudo ndiswrapper -l bcmwl5 : driver installed device (14E4:4328) present (alternate driver: ssb)
Add the line:
ndiswrapper
to /etc/modules and the line:
install ndiswrapper modprobe -r ohci_hcd ssb; modprobe --ignore-install ndiswrapper $CMDLINE_OPTS; modprobe ohci_hcd
to the end of /etc/modprobe.d/ndiswrapper
If you reboot you should find the driver is loaded:
$ dmesg | grep ndis [ 277.010208] ndiswrapper version 1.53 loaded (smp=yes, preempt=no) [ 277.089968] usbcore: registered new interface driver ndiswrapper
Disable then enable networking from the Network Manager icon in the top right in Gnome, wait a few seconds and the networks should be detected. Choose the correct network, enter the WEP key and then run:
ifdown wlan0 ifup wlan0
You should now be connected.
Next time you login, network manager should connect you automatically.
Sound
Create /etc/modprobe.d/sound with this content:
alias snd-card-0 snd-hda-intel options snd-hda-intel model=mbp3
When you reboot sound should work. Test it with a YouTube video (Flash is already installed).
Importing from Digital Camera
The Canon IXUS 30 is detected, but the import fails because it doesn't use PTP mode. This is easily worked around though by using a command line wrapper of the libgphoto2 library:
sudo apt-get install gphoto2 gphoto2 --get-all-files --camera "Canon Digital IXUS 30 (PTP mode)" --port "usb:004,025" --debug --debug-logfile=my-logfile2.txt
Running Windows
This can be done via KVM but there is no need to use Virtulization Manager (virt-manager). In fact it is easier to set things up manually.
Stop the libvirt daemon, you don't need it and it gets in the way:
sudo /etc/init.d/libvirt-bin stop
Copy the XML files from your previous setup to /etc/libvirt/qemu. Then install the tools you need:
sudo apt-get install kvm uml-utilities
Now manually configure the network (you'll need to do this once for each time you reboot your computer and want to use a virtual machine):
sudo brctl addbr br0 brctl show sudo ifconfig br0 192.168.100.254 netmask 255.255.255.0 up sudo modprobe tun sudo tunctl -b -u root -t qtap0 sudo brctl addif br0 qtap0 sudo ifconfig qtap0 up 0.0.0.0 promisc
Ensure that /proc/sys/net/ipv4/ip_forward has the number 1 in it and that IP routing is set up for your actual network device that connects to the internet (mine is eth1 which is used in the command below, usually it is eth0):
sudo -s echo "1" > /proc/sys/net/ipv4/ip_forward exit sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
The bridge now looks like this:
$ sudo brctl show bridge name bridge id STP enabled interfaces br0 8000.00ff18fbff78 no qtap0
You can choose your own IP address for the bridge but it must be on a different range from any other networks your machine is using.
$ /sbin/ifconfig br0 Link encap:Ethernet HWaddr 00:ff:18:fb:ff:78 inet addr:192.168.100.254 Bcast:192.168.100.255 Mask:255.255.255.0 inet6 addr: fe80::2864:d1ff:fe10:65af/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:42 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:8304 (8.1 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:560 (560.0 B) TX bytes:560 (560.0 B) qtap0 Link encap:Ethernet HWaddr 00:ff:18:fb:ff:78 inet6 addr: fe80::2ff:18ff:fefb:ff78/64 Scope:Link UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:20 overruns:0 carrier:0 collisions:0 txqueuelen:500 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) wlan0 Link encap:Ethernet HWaddr 00:1f:5b:84:23:e2 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:2482 errors:0 dropped:0 overruns:0 frame:0 TX packets:2688 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2053520 (1.9 MiB) TX bytes:436466 (426.2 KiB) Interrupt:16 Memory:90300000-90304000
You can now ping the bridge:
ping 192.168.100.254
You can start the virtual machine directly like this:
sudo /usr/bin/kvm -M pc -m 512 -smp 1 -name WindowsXP -monitor pty -localtime -no-acpi -boot c -drive file=/home/james/Vms/windowsxp/hda.img,if=ide,index=0,boot=on -drive file=,if=ide,media=cdrom,index=2 -net nic,macaddr=54:52:00:12:ba:a7 -net tap,ifname=qtap0,script=no,downscript=no -serial pty -parallel none -usb -usbdevice tablet -k en-gb -soundhw es1370
Here's a version for an Ubuntu virtual machine:
sudo /usr/bin/kvm -M pc -m 512 -smp 1 -name GRP -monitor pty -localtime -no-acpi -boot c -drive file=/home/james/Vms/grp/ubuntu-kvm/disk0.qcow2,if=ide,index=0,boot=on -drive file=/home/james/Vms/grp/ubuntu-kvm/disk1.qcow2,if=ide,index=1 -net nic,macaddr=52:54:00:39:81:49 -net tap,ifname=qtap1,script=no,downscript=no -serial pty -parallel none -usb -usbdevice tablet -k en-gb
If you want to start the second machine after the first you'll need a new tun device first:
sudo tunctl -b -u root -t qtap1 sudo brctl addif br0 qtap1 sudo ifconfig qtap1 up 0.0.0.0 promisc
Note
Sound doesn't seem to work. I'm not sure why but it isn't a major concern for me personally as I only use virtual machines as servers.
The two "-net" switches have a different meaning but are both needed:
- nic,macaddr=52:54:00:39:81:49
- Specifies network interface options on the guest side, each guest should have a different mac address
tap,ifname=qtap0,script=no
Specifies network interface options on the host side. The "script=no" means not use the scripts in /etc/kvm/kvm.ifup which is what we want because we've configured the networking manually.
Once the machine has booted you'll need to manually give it a static IP address in the range 192.168.100.2-192.168.100.253 inclusive. The gateway and the DNS server should be set to the IP address of the bridge too, 192.168.100.254 in this example.
If you are running Linux you can achieve this by adding this to your /etc/network/interfaces file:
# The primary network interface auto eth0 iface eth0 inet static address 192.168.100.1 network 192.168.100.0 netmask 255.255.255.0 up route add 192.168.100.254 dev eth0 up route add default gw 192.168.100.254 down route del default gw 192.168.100.254 down route del 192.168.100.254 dev eth0
You should set /etc/resolv.conf to look like this:
nameserver 192.168.1.1
If you have problems with networking try to ping the bridge:
ping 192.168.100.254
If this fails you have misconfigured networking. Now try to ping an external IP address on the internet which you know exists. For example:
ping 188.40.40.171
If this fails you have not set up IP routing correctly on the host machine. Now try to ping a domain name:
ping google.com
If this fails you have not set up DNS servers correctly.
The advantage of this manual command line approach is that you can easily add more configuration, such as USB devices, which you couldn't easily do through the GUI.
If you are happier with GUI interfaces you can install Virtual Machine Manger but be aware it might set things up differently. When debugging problems with the approach the GUI app takes it is handy to look in /var/log/libvirt for tips.
sudo apt-get install kvm virt-manager
Gnome Configuration
Make all the fonts size 9 instead of 10.
http://jimmyg.org/blog/2007/debian-etch-40-install-thinkpad-r50e.html
sudo apt-get install vim-nox mercurial unzip rsync dosfstools dia apache2-utils dia iceweasel-firebug sudo apt-get remove --purge epiphany-browser nano
Microsoft Fonts
Replace these lines in /etc/apt/sources.list:
deb http://ftp.uk.debian.org/debian/ lenny main deb-src http://ftp.uk.debian.org/debian/ lenny main
with these:
deb http://ftp.uk.debian.org/debian/ lenny main contrib deb-src http://ftp.uk.debian.org/debian/ lenny main contrib
Install like this:
sudo apt-get update sudo apt-get install ttf-mscorefonts-installer
Then put the lines back and run this again:
sudo apt-get update
Flash
Install dependencies:
sudo apt-get install libnspr4-dev
Add this to /etc/apt/sources.list:
deb http://www.backports.org/debian lenny-backports main contrib non-free
Install Flash:
sudo apt-get update sudo apt-get install flashplugin-nonfree sudo /usr/sbin/update-flashplugin-nonfree --install
After these commands comment out the line you added in /etc/apt/sources.list and run this again:
sudo apt-get update
Keyboard
Following the instructions for the touchpad below also fix the keyboard. Make sure the keyboard section of /etc/X11/xorg.conf has these lines:
Section "InputDevice" Identifier "Generic Keyboard" Driver "kbd" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc105" Option "XkbLayout" "gb" Option "XkbOptions" "lv3:rwin_switch,apple:badmap" EndSection
Backlight
sudo apt-get install libpci-dev wget http://hackweb.altervista.org/downloads/backlight-0.1.1.tar.gz tar zxfv backlight-0.1.1.tar.gz cd backlight-0.1.1
FAILS.
$ backlight Failed to detect video card, aborting...
Touchpad
This is a bit of a pain but the instructions below do work:
Build and install the bcm5974 driver:
sudo apt-get install git-core dpkg-dev debhelper git clone http://bitmath.org/git/bcm5974-dkms.git # rev 9ef004eb41fe5e2b087d61b00e3963fad97e6332 git clone http://bitmath.org/git/usbhid-dkms.git # rev 04b66d9b55676e0347b9c8bfa04d5d15dd8dc0f0 wget http://linux.dell.com/dkms/permalink/dkms_2.0.20.4-0ubuntu1_all.deb dpkg -i dkms_2.0.20.4-0ubuntu1_all.deb cd bcm5974-dkms/ make bump sudo dpkg-buildpackage cd .. cd usbhid-dkms/ make bump sudo dpkg-buildpackage cd .. sudo dpkg -i bcm5974-dkms_1.1.1_all.deb usbhid-dkms_0.11.1_all.deb sudo modprobe bcm5974
Replace your /etc/X11/xorg.conf file with this.
# Get back to the default configuration like this: # sudo dpkg-reconfigure -phigh xserver-xorg Section "Module" Load "glx" Load "synaptics" EndSection Section "InputDevice" Identifier "Generic Keyboard" Driver "kbd" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc105" Option "XkbLayout" "gb" Option "XkbOptions" "lv3:rwin_switch,apple:badmap" EndSection Section "InputDevice" Identifier "Synaptics Touchpad" Driver "synaptics" Option "SendCoreEvents" "true" Option "Device" "/dev/input/mice" Option "Protocol" "auto-dev" Option "SHMConfig" "true" Option "New AccelFactor" "0.03" Option "LeftEdge" "0" Option "RightEdge" "1280" Option "RightEdge" "1280" Option "TopEdge" "0" Option "BottomEdge" "800" Option "MinSpeed" "0.94" Option "MaxSpeed" "1" Option "AccelFactor" "0.0015" #tapping Option "RTCornerButton" "2" Option "RBCornerButton" "3" Option "LTCornerButton" "2" Option "LBCornerButton" "3" Option "FingerHigh" "30" Option "FingerLow" "20" Option "MaxTapTime" "150" Option "FastTaps" "0" Option "TapButton1" "1" Option "TapButton2" "2" Option "TapButton3" "3" #edge scroll Option "VertEdgeScroll" "0" Option "HorizEdgeScroll" "0" Option "VertScrollDelta" "5" Option "HorizScrollDelta" "0" #two finger scroll Option "VertTwoFingerScroll" "1" Option "HorizTwoFingerScroll" "1" EndSection Section "Device" Identifier "Configured Video Device" EndSection Section "Monitor" Identifier "Configured Monitor" EndSection Section "ServerLayout" Identifier "Main Layout" Screen "Default Screen" InputDevice "Synaptics Touchpad" InputDevice "Generic Keyboard" Screen "Default Screen" 0 0 EndSection Section "Screen" Identifier "Default Screen" Monitor "Configured Monitor" EndSection
Now you can restart. Two finger tap is middle click, three is right click. Scroll by putting two fingers on the pad and moving around.
Filesystem Support
sudo apt-get install hfsutils hfsprogs dosfstools
Make Gvim Default
Get a terminal, and cd to ~/.local/share/applications. There is now a new file in there called gvim-usercreated.desktop
In that same path create a new file called defaults.list with the following info:
[Default Applications] text/plain=gvim-usercreated.desktop
Restart nautilus with killall nautilus then edit ~/.gvimrc:
set gfn=Monospace\ 9
Further Reading
- http://gem.mydns.jp/daitei/linux/macbookair/
- http://ftbfs.wordpress.com/2008/08/15/debian-lenny-on-macbook/
- http://translate.google.com/translate?hl=en&sl=ja&u=http://gem.mydns.jp/daitei/linux/macbookair/&ei=m-1AS56jHZf80wSJqtCSBQ&sa=X&oi=translate&ct=result&resnum=6&ved=0CCEQ7gEwBQ&prev=/search%3Fq%3Ddebian%2Blenny%2Bmacbook%2Bair%26hl%3Den%26client%3Diceweasel-a%26rls%3Dorg.debian:en-GB:unofficial
http://jimmyg.org/blog/2008/ubuntu-804-hardy-heron-on-the-macbook-air.html