content top

Installing Ubuntu 14.04 on Macbook Pro Retina (10,1)

I did an upgrade install of 13.10, so I skipped writing a blog post about it. However, I did a fresh install of 14.04 on my macbook pro (rMBP). It seems quite stable so far, and is mostly the same as 13.10 and 13.04.

Improved from 13.04

  1. Better nvidia support (no more need to set kernel options)

Now for the directions!

1. Preparation

Just follow steps 1 through 3 in my first guide, to get rEFIt installed and prepare to install Ubuntu. Make sure you download the 14.04 ISO though, for step 3.

2. Install Ubuntu

Note that the wifi won’t work (we’ll fix this in the next step), so don’t try to install updates during the installation process, unless you have a separate usb wifi dongle or ethernet. Also, at the end of the installer, after the dialog asking you to restart, you’ll probably get a black screen. Just press spacebar and it should reboot.

3. Install Wifi Drivers

Wifi doesn’t work out of the box, so from another computer (or your OSX install) download the driver and its dependencies (dkms, libc6-dev, linux-libc-dev), then copy them all to a flash drive and boot back into Ubuntu. Install each with:

sudo dpkg -i "the package file you downloaded"

Alternatively, if you have a usb wifi card, you can use that and install the driver with this command:

sudo apt-get update && sudo apt-get install bcmwl-kernel-source

4. EFI Boot

To get the 2880×1800 native resolution, and the external display ports working you’ll need to convert GRUB to EFI mode. Follow these steps adapted from the Ubuntu UEFI page (note: as of this writing the PPA is missing the packages for trusty, so you’ll need to use the saucy packages instead):

  1. sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
    sudo apt-get install -y boot-repair && boot-repair
  2. Click on “Advanced options”, go to the “GRUB location” tab.
  3. Make sure that “Separate /boot/efi partition” is checked, then click the “Apply” button, and follow the directions (you’ll be asked to remove and reinstall GRUB)
  4. Reboot. You’ll probably have several new options in rEFIt, select any of them to boot up
  5. (optional) if you want to remove some of the extra rEFIt options, just delete the directories you don’t want from /boot/efi/EFI (be VERY CAREFUL here, and don’t delete the APPLE directory)

Note: After changing to EFI, you may get a blank screen for several seconds during boot-up.

5. NVIDIA Drivers

Now you’ll need to install the proprietary NVIDIA drivers, and configure Xorg:

  1. sudo apt-get install linux-headers-`uname -r`
    sudo apt-get install nvidia-current
    sudo nvidia-xconfig
  2. edit /etc/X11/xorg.conf and add to the Device section:
    Option "UseDPLib" "off"
  3. edit /etc/default/grub and add “i915.lvds_channel_mode=2 i915.modeset=0 i915.lvds_use_ssc=0″  to GRUB_CMDLINE_LINUX_DEFAULT inside the double-quotes between the words “quiet splash“. Then run:
    sudo update-grub
  4. Reboot and you should see the nvidia logo during boot
  5. (optional) If you don’t see the nvidia logo or get a blank screen, try installing gfxCardStatus (version 2.2.1, not 2.3), and forcing the discrete graphics card from the dropdown menu of their toolbar icon. You may also need to run “sudo dpkg-reconfigure nvidia-current” after rebooting.

6. Brightness Controls

To make the brightness buttons work, add this to /etc/init.d/rc.local:

setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0

7. Other Configuration (optional)

If you’re like me and want the F1-F12 keys to behave as function keys, and not special keys then just follow these steps from the AppleKeyboard guide:

echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all
sudo reboot

Still Broken

  • Only the native resolution (2880×1800) is available, which means the text is rather small
Read More

Installing Ubuntu 13.04 on Macbook Pro Retina (10,1)

I’ve been using 13.04 (raring ringtail) daily build on my macbook pro (rMBP) for a couple days now, and things have been working great so far. Definitely a major improvement over 12.10, and for a daily build it’s been pretty stable too.

Improved from 12.10

  1. Better modesetting support in the kernel (no more need for nomodeset option)
  2. Proprietary Nvidia drivers finally work right
  3. New wifi drivers, that actually work!

Now for the directions!

1. Preparation

Just follow steps 1 through 3 in my first guide, to get rEFIt installed and prepare to install Ubuntu. Make sure you download the raring ringtail daily ISO though, for step 3.

2. Install Ubuntu

Note that the wifi won’t work (we’ll fix this in the next step), so don’t try to install updates during the installation process, unless you have a separate usb wifi dongle or ethernet. Also, at the end of the installer, after the dialog asking you to restart, you’ll probably get a black screen. Just press spacebar and it should reboot.

3. Install Wifi Drivers

Wifi doesn’t work out of the box, so from another computer (or your OSX install) download the driver and its dependencies (dkms, libc6-dev, linux-libc-dev), then copy them all to a flash drive and boot back into Ubuntu. Install each with:

sudo dpkg -i "the package file you downloaded"

Alternatively, if you have a usb wifi card, you can use that and install the driver with this command:

sudo apt-get update && sudo apt-get install bcmwl-kernel-source

4. EFI Boot

To get the 2880×1800 native resolution, and the external display ports working you’ll need to convert GRUB to EFI mode. Follow these steps adapted from the Ubuntu UEFI page:

  1. sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
    sudo apt-get install -y boot-repair && boot-repair
  2. Click on “Advanced options”, go to the “GRUB location” tab.
  3. Make sure that “Separate /boot/efi partition” is checked, then click the “Apply” button, and follow the directions (you’ll be asked to remove and reinstall GRUB)
  4. Reboot. You’ll probably have several new options in rEFIt, select any of them to boot up
  5. (optional) if you want to remove some of the extra rEFIt options, just delete the directories you don’t want from /boot/efi/EFI (be VERY CAREFUL here, and don’t delete the APPLE directory)

Note: After changing to EFI, you may get a blank screen for several seconds during boot-up.

5. NVIDIA Drivers

Now you’ll need to install the proprietary NVIDIA drivers, and configure Xorg:

  1. sudo apt-get install linux-headers-`uname -r`
    sudo apt-get install nvidia-current
    sudo nvidia-xconfig
  2. edit /etc/X11/xorg.conf and add to the Device section:
    Option "UseDPLib" "off"
  3. edit /etc/default/grub and add “i915.lvds_channel_mode=2 i915.modeset=0 i915.lvds_use_ssc=0″  to GRUB_CMDLINE_LINUX_DEFAULT inside the double-quotes between the words “quiet splash“. Then run:
    sudo update-grub
  4. Reboot and you should see the nvidia logo during boot
  5. (optional) If you don’t see the nvidia logo or get a blank screen, try installing gfxCardStatus (version 2.2.1, not 2.3), and forcing the discrete graphics card from the dropdown menu of their toolbar icon. You may also need to run “sudo dpkg-reconfigure nvidia-current” after rebooting.

6. Other Configuration (optional)

  1. If you’re like me and want the F1-F12 keys to behave as function keys, and not special keys then just follow these steps from the AppleKeyboard guide:
    echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
    sudo update-initramfs -u -k all
    sudo reboot
    

Still Broken

  • Brightness controls still aren’t working
  • Only the native resolution (2880×1800) is available, which means the text is rather small
Read More

Using hostapd on Ubuntu to create a wifi access point

I’ve been working on an autonomous hexacopter, which has a Pandaboard ES running Ubuntu on it, and I wanted it to setup its own wifi network in the field for easy ssh access. Turns out this is pretty simple to do, but you need to configure several different daemons to get it working right.

1. Check your wifi card

You’ll need a wifi card that supports master mode, if you’re going to create an access point with it. First, figure out what your wifi card is named (look for one starting with ‘wlan’)

ifconfig

Next, check if “AP” mode is supported

iw list

and look for something like:

...
Supported interface modes:
         * IBSS
         * managed
         * AP
...

On some drivers you can also check for master mode with iwconfig:

sudo iwconfig  mode master

2. Setup hostapd

Assuming your wifi card supports master mode, the next step is to setup hostapd

sudo apt-get install hostapd

Now create the file /etc/hostapd/hostapd.conf with the follow content: (if you want to use 5Ghz instead of 2.4Ghz, use hw_mode=a and channel=149 instead)

interface=wlan0
driver=nl80211
ssid=my_ap
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=my_password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Finally, edit /etc/default/hostapd to have the line:

DAEMON_CONF=/etc/hostapd/hostapd.conf

3. Setup dnsmasq

Now, it’s time to setup dnsmasq to handle DHCP and DNS on our wifi network, otherwise your clients won’t be able to get an IP address.

sudo apt-get install dnsmasq

Next, edit the dnsmasq configuration file to include this:

interface=wlan0
dhcp-range=10.0.0.2,10.0.0.10,255.255.255.0,12h
no-hosts
addn-hosts=/etc/hosts.dnsmasq

We set ‘no-hosts’ to avoid including all the entries in your hosts file in the DNS server, and instead set a separate file that will configure the DNS mapping for the machine hosting the AP. Make sure to create the file /etc/hosts.dnsmasq with the name of your computer:

10.0.0.1 my_hostname

4. Modify /etc/network/interfaces

Add these lines to your /etc/network/interfaces file, to give it a static IP address:

auto wlan0
iface wlan0 inet static
address 10.0.0.1
netmask 255.255.255.0

5. Troubleshooting

If you have network-manager configured to use your wifi card, you should disable auto-connect for all the wireless connections. Otherwise, it may interfere with hostapd. If some frequencies are disabled, make sure your driver is set to use the right regulatory domain. You can see the current one with:

iw reg get

If it says “country 00″, you need to set it manually, in /etc/default/crda. To set it manually you need (at least for some cards) to have cfg80211 and mac80211 installed as kernel modules. You can check if they’re installed as modules by using

zcat /proc/config.gz

Look for CONFIG_CFG80211=m, if it says “=y” then it’s compiled into the kernel, and you’ll need to re-install your kernel. If you’re using an Atheros card, you may also need to set the region in the driver. Do this by adding “cfg80211 ieee80211_regdom=US” to /etc/modules

Read More

Installing Ubuntu 12.10 on Macbook Pro Retina (10,1)

Well, 12.10 (quantal quetzal) is out and runs a lot better on a Macbook Pro retina (rMBP) than 12.04. Just installed it on my retina and I think I can finally use it as my day to day laptop!

Improved from 12.04

  1. Better APIC support in the kernel (previous you had to boot with noapic)
  2. Special keys on keyboard work (volume control…etc)
  3. Better touchpad support (two-finger scrolling works!)
  4. Got full resolution and external monitor (edit: ran into some issues after trying to boot between OSX and Ubuntu, that I haven’t figured out yet) working! (this might have worked in 12.04, but I didn’t test EFI booting with 12.04)

So, without further ado, the directions!

1. Preparation

Just follow steps 1 through 3 in my last guide, to get rEFIt installed and prepare to install Ubuntu. Make sure you download the 12.10 ISO though, for step 3.

2. Install Ubuntu

Kernel modesetting doesn’t work, and will give you a garbled display, so make sure you disable it before starting the installer (press space at the splash screen, then F6, and turn on nomodeset). Also, note that the wifi won’t work (we’ll fix this in the next step), so don’t try to install updates during the installation process.

3. Update Kernel Options

Once the installation finishes, you’ll need to boot up with the nomodeset option (press ‘e’ in GRUB and add it to the kernel parameters, right next to “splash” and “quiet”), and then add it permanently once you’ve booted up:

  1. In a terminal run: sudo gedit /etc/default/grub
  2. Add nomodeset to GRUB_CMDLINE_LINUX_DEFAULT inside the double-quotes after the words “quiet splash“.
  3. Finally, run: sudo update-grub

You can find detailed directions for both of these steps in the Ubuntu guide for Kernel Boot Parameters.

 4. Install Wifi Drivers

You’ll need to be a bit creative here. Apple removed the ethernet port, so you’ll need a USB wifi card, or some other method of installing the drivers (I tethered my Android phone using EasyTether). Once you have a working Internet connection, just follow these directions to install the driver:

  1. sudo apt-get update && sudo apt-get install b43-fwcutter
  2. Download driver from: http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2
  3. tar -xf broadcom-wl-5.100.138.tar.bz2
  4. sudo b43-fwcutter -w /lib/firmware broadcom-wl-5.100.138/linux/wl_apsta.o
  5. Reboot and the wireless should work.

5. EFI Boot and NVIDIA Drivers

To get the 2880×1800 native resolution, and the external display ports working you’ll need to convert GRUB to EFI mode. Follow these steps adapted from the Ubuntu UEFI page:

  1. sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
  2. sudo apt-get install -y boot-repair && boot-repair
  3. Click on “Advanced options”, go to the “GRUB location” tab.
  4. Make sure that “Separate /boot/efi partition” is checked, then click the “Apply” button.

Before restarting you’ll need to install the proprietary NVIDIA drivers, and configure Xorg:

  1. sudo apt-get install linux-headers-`uname -r`
  2. sudo apt-get install nvidia-current
  3. sudo nvidia-xconfig

Restart, and you should now have a new option in rEFIt (or maybe a couple of them…), which will boot up Ubuntu using EFI.

6. Still Broken

  • Brightness controls for monitor
  • Wifi is sometimes flaky (tons of packet loss, until I reload the b43 module)

Let me know in the comments, if you get brightness controls working or find more stable wifi drivers!

Read More

Installing Ubuntu 12.04 on Macbook Pro Retina (10,1)

1. Install rEFIt

  1. Download and mount the rEFIt-0.14.dmg disk image.
  2. Double-click on the “rEFIt.mpkg” package.
  3. Follow the instructions and select your Mac OS X installation volume as the destination volume for the install.

If everything went well, you’ll see the rEFIt boot menu on the next restart.

If you run into any problems, you can find more details on their website.

2. Resize Partitions

This step is pretty straight-forward. Just open Disk Utility in OSX, and resize your existing OSX partition, so that there’s some free space for Ubuntu. You’ll want to leave the empty space as “free space” (it will get formatted during the Ubuntu installation). There are plenty of guides, if you get stuck on this step, including the Ubuntu wiki.

3. Create USB Installer

The ISOs on the main Ubuntu download page don’t work, so you’ll need to get the Ubuntu ISO for Macs, which is listed along with other less widely used images in their CD images directory. Once you’ve downloaded the Mac Ubuntu ISO, you’ll need to follow some special steps to make it bootable on a Mac (the Startup Disk Creator on Ubuntu won’t work). Follow the directions for the “Manual Approach” on this wiki page.

4. Install Ubuntu

It seems that something in the Macbook power management causes a kernel panic, so you’ll need to run the installer with the “noapic” option (press space at the splash screen, then F6). Note: you may need to reboot several times, as the installer may kernel panic before you have the option to set “noapic”. Also, note that the wifi won’t work (we’ll fix this in the next step), so don’t try to install updates during the installation process.

Once the installation finishes, you’ll need to boot up with the noapic option (press ‘e’ in GRUB and add it to the kernel parameters, right next to “splash” and “quiet”), and then add it permanently once you’ve booted up. You can find detailed directions for both of these steps in the Ubuntu guide for Kernel Boot Parameters.

5. Install Wifi Drivers

You’ll need to be a bit creative here. Apple removed the ethernet port, so you’ll need a USB wifi card, or some other method of installing the drivers (I tethered my Android phone using EasyTether). Once you have a working Internet connection, just follow these directions to install the driver:

sudo add-apt-repository ppa:mpodroid/mactel
sudo apt-get update
sudo apt-get install b43-fwcutter firmware-b43-installer
sudo apt-get install linux-backports-modules-cw-3.3-precise-generic

Edit the /etc/modprobe.d/blacklist.conf and add the line:

blacklist ndiswrapper

Create or edit the file /etc/pm/config.d/modules and make sure the wireless modules (b43 and bcma) are blacklisted:

SUSPEND_MODULES="b43 bcma"

Reboot and the wireless should work.

These directions are adapted from the Ubuntu directions for installing 11.10 on a Macbook Pro.

6. Not Yet Working

Here’s a list of the things that aren’t working for me

  • Brightness control for screen (apple-gmux)
  • Volume control and other special keys on keyboard (pommed)
  • Touchpad (synaptics driver)
  • Internal screen resolution (maximum detected is 1024×768) & external monitor. I installed the new nvidia driver  (>= 295.59) and Bumblebee, which atleast means that the Additional Drivers window in Ubuntu detects the proprietary drivers, but it says they’re “activated but not currently in use”. Let me know in the comments if you have any luck fixing this!

 

Read More

Git revision numbers for setuptools packages

Add snapshot versions to your setuptools packages from SVN is easy, using the “tag_svn_revision = true” options in setup.cfg. However, getting this working for GIT proved to be more difficult, as there’s no built in support. However, I finally settled on a bash script that does the job quite nicely.

now=`date +%s`
gitversion=`git describe –long –dirty=-$now | sed ‘s/.*\([-][0-9][0-9]*[-][a-z0-9]*\)/\1/’`
python setup.py setopt -o tag_build -s $gitversion -c egg_info
python setup.py sdist

First we generate a unique version string, based on the number of commits since the last GIT tag:

now=`date +%s`
gitversion=`git describe –long –dirty=-$now | sed ‘s/.*\([-][0-9][0-9]*[-][a-z0-9]*\)/\1/’`

Then we just apply it as an option before building the release:

python setup.py setopt -o tag_build -s $gitversion -c egg_info
python setup.py sdist

Read More

Pyflakes error in Eclim on Ubuntu

I started using Eclim a couple days ago, and kept running into “Error running command: pyflakes <path to my code>”, when my files contained more than one syntax error/warning. After a bit of googling I discovered this bug, which suggests that the version of pyflakes in Debian isn’t compatible with Eclim. Sure enough, removing the the .deb package (apt-get remove pyflakes) and installing it from pip (pip install pyflakes), fixed it.

Read More
content top