Tuesday, July 9, 2013

Small update:

Recently I installed Linux Mint 15 KDE when it came out. Using the hardware acceleration from the nouveau drivers seems to have acceptable performance and using nouveau+kde means the desktop resolution changing is much better than it is under nvidia with my script. KDE's compositor works really well with this screen. So far I'm quite happy with it, although I need to see how well really intensive programs work. Portal worked quite happily with nouveau and mesa and that library set before it crashed, but I'm not sure whether that was a function of graphics or something else, as there weren't any error messages.

Thursday, March 7, 2013

If you are using an ubuntu-based distro on a macbook pro retina, I recommend grabbing this package here: http://packages.ubuntu.com/raring/bcmwl-kernel-source, as the latest version of the bcmwl package supports the BCM4331 card of the macbook pro retina, and it has support for more modes than the b43 drivers do.

Tuesday, January 15, 2013

Changing the Resolution in Ubuntu

Well, after having this set up, I wanted to be able switch resolutions (the screen is really tiny, and it drops the frame-rate of games rather significantly)  I tried all of the standard xorg.conf configuration, addmode, newmode, all of that.  But nothing worked.

Today, I stumbled on a solution:  xrandr's --scale option.  This allows you to scale that screen to almost any resolution you want.

 for example:
  • xrandr -q 
(this returns certain names e.g. mine is DP-2. Another is HDMI-0.  One will say "connected" and that's the one you need.
  • xrandr  --output DP-2 --scale .5x.5 
This scales it to a 1440x900 resolution.

One thing to note.  Sometimes trying to go from one scaled resolution to another will fail with an error.  Don't panic:  just change the scale back to 1x1, and the next scale you choose will work. The scaling numbers don't have to be simple: I managed to get ~1650x1050 by putting the scale value as .5729x.5729.

Here's a link to the script:  https://gist.github.com/4552263/

This script takes one parameter: the width in pixels of your screen.

Sample run:

   sh ./Res.sh 1680

The result is a 1680x1050 scaled screen.

EDIT:  I found a way to fix the trackpad settings.
I followed this advice here:  uselessuseofcat.com/?p=74ls,
but it didn't quite help with the trackpad's tap-click.
I then found this package: gpointing-device-settings

    sudo apt-get install  gpointing-device-settings

This installs a utility that is launched by running
in the terminal.

This is a graphical configuration for your trackpad, so you should be able to customize your mouse however you want.

Sunday, December 16, 2012

Ubuntu 13.04 Daily Build Macbook Pro Retina documentation and install guide

      Over the past few days I have embarked on a journey:  to install and run Linux on a Retina Macbook Pro. (15-inch 2.3 GHz base model)  The main issues were the kernel not supporting it and the lack of internet connections that work immediately without extra hardware. (As well as the lack of solid instruction, which is why I created this guide.)

      Other places I have seen this topic discussed have been focused on current releases, which is understandable.  However, looking at these changes for Ubuntu 13.04, one of which states that it will be compatible with this computer, I decided to try the daily build.

      The daily build of Ubuntu 13.04 has kernel support for this computer.  This first post will describe the current state of Ubuntu 13.04 and the various steps I used to get Ubuntu working.

When partitioning, it is better to let Linux do the partitioning of free space in the installer rather than creating an msdos partition in Mac OS X.  This prevents the creation of a hybrid MBR and creates a protective MBR which has a standard.

 Installing to an external drive--Important Note

Your disk's partition table needs to be GUID/GPT  (GPT and GUID are the same thing).  External drives can be checked in disk utility under partitions.  Underneath the picture of the partitioning scheme, there is a button named options.  Click it, and you should be able to see what the partition table format is.  If it is GPT, you can proceed.  if it is not, the EFI bootloader will not work.

To make the drive GPT, it will need to be reformatted, erasing all the data on the disk, so don't convert unless you have somewhere to put those files.

Before you begin:

Create enough free space (unformatted) for Ubuntu to fit.

Grab a 1GB or larger flash drive and a DVD-R, or a 4GB or larger flash drive.

Recommended:  an ethernet adapter that works with the retina mac

Now for the actual guide.  Hopefully it is easy enough that people who are newer to linux can follow it.

1:  Install rEFInd

       The install.sh should be run in a Mac OS X partition with the --drivers option and I (personally) installed it to the Mac partition rather than the EFI (ESP according to the rEFInd guide).  For more information, the creator of rEFInd has this information organized already:  http://www.rodsbooks.com/refind/

so unzip the files, run the install.sh.

If you want to have Linux on an external hard drive, or want to dual-boot, you may run either option:

      ./install.sh --alldrivers

but if you want only Linux on your internal hard drive, you must run this:

       ./install.sh --esp --alldrivers

Test if rEFInd works.  It may take two reboots for it to load.

2:  Install Linux


The iso image for the daily build can be grabbed here:

(grab the amd64 mac iso)

Insert an ethernet or wifi adapter if you have one.  If you have a thunderbolt ethernet adapter, you will need to plug it in before booting Ubuntu.

If not, you will need this .deb file and this driver package later:



Save them to the flash drive. 

Make the LiveCD

Reboot into the Ubuntu LiveCD through the rEFInd menu

Select try ubuntu.

Get the ethernet settings set up

run the installer with

      ubiquity -b

This will prevent it from installing grub.  Since we will be booting from the kernel itself, grub is not necessary for this install.

Go through the normal installation process

Select "continue to try ubuntu": there are a couple more steps to make this visible to the mac's EFI.

3:Configure rEFInd

Mount your /boot (if you made one) to your install's /boot or your hard drive's EFI (if you didn't) to your install's /boot/efi directory (make one if it isn't there.)

Create the path /boot/efi/EFI/ubuntu/

Then run:

     sudo cp /boot/vmlinuz<version> /boot/efi/EFI/ubuntu/vmlinuz<version>

     sudo cp /boot/initrd<version> /boot/efi/EFI/ubuntu/initrd<version>

As an example, my current vmlinuz and initrd reads vmlinuz-3.8.0-0-generic and initrd-3.8.0-0-generic. 

      Find your UUID with either "sudo blkid /dev/sdXY" (the one you want to know) or with  "ls -l /dev/disks/by-uuid/"  and finding the /dev/sdXY that you need

UUID is a long string of numbers and letters.

My options inside refind_linux.conf look like this:

"Boot using standard options" "root=UUID=<Your root partition's UUID> ro   quiet splash $vt_handoff"
"Boot using minimal options"  "root=UUID=<Your root partition's UUID> ro"
"Boot to shell"                           "root=UUID=<Your root partition's UUID> ro text"
"Boot using recovery options" "root=UUID=<Your root partition's UUID> ro recovery nomodeset"

This uses the kernel (which should be above 3.7 if you are following this guide) as the bootloader, with no requirements for grub.  (Grub can be safely ignored, as with this setup the mac cannot see grub as a boot option)

If you upgrade your kernel, you will need to also copy it inside the ubuntu folder like before.

4:Final Adjustments

At this point, reboot into your newly-working Ubuntu install.

(There should be an Ubuntu logo on the rEFInd boot selection screen)

Reconfigure wired internet if required.

Wireless Drivers

If you have Ethernet working

Download the drivers from here: 

open with the archive manager and extract wl_apsta.o to your home folder.

     sudo apt-get install b43-fwcutter

then run

     sudo b43-fwcutter -w /lib/firmware/`uname -r` ~/wl_apsta.o

     sudo modprobe b43

Wireless networking should be working.  If it isn't, reboot.

Without Ethernet

Mount your flash drive and move the files to your home folder.

Open the driver package with the archive manager and extract wl_apsta.o to your home folder.

       sudo dpkg -i b43-fwcutter.deb

       sudo b43-fwcutter -w /lib/firmware/`uname -r` ~/wl_apsta.o

      sudo modprobe b43

Wireless networking should be working.  If it isn't, reboot.

 Nvidia graphics

Nvidia drivers work from the standard repository (run

           sudo apt-get update; sudo apt-get install nvidia-current

in the terminal), but the setting must be configured by the Nvidia x Server settings program to display properly.

Reboot after install.  I saw 3 mirrored 800x600 screens stacked on top of each other, with garbage to the right.

Open the x server settings. 

Selection:  change to  X screen 0

click advanced

click X server Display Configuration

click the first button after "metamode" and select nvidia auto-select

hit apply.  if the screen goes back to looking like a 2880x1800 screen, reopen x server settings if it closed, check the configuration to make sure it's the same, and click "save to X configuration file"  This will keep this setting throughout reboots.

*For changing the resolution, after the NVIDIA graphics is set up correctly, my second post has a scrip that you can use.*

Changing the desktop environment:

This should work.  If you speakers stop working after installing it, run

sudo apt-get remove --purge alsa-base
sudo apt-get remove --purge pulseaudio
sudo apt-get install alsa-base
sudo apt-get install pulseaudio
sudo alsa force-reload

The current status below is in a shorthand, descriptive format.

Retina Macbook Pro Ubuntu 13.04 daily-build, installed on eternal hard drive.

Desktop Environment:  Cinnamon
Steam for Linux working properly
EFI boot working
Nvidia Graphics working (yes, at the same time as EFI booting)
full screen resolution  2880x1800

Current Status:

      Kernel of LiveCD and installed OS does not require any extra configuration from the default. Thunderbolt and USB to ethernet adapters work, but only when plugged in from boot.

      b43 wireless drivers work after install with sudo modprobe b43 with a reboot, using the standard b43-fwcutter with the open-source broadcom driver 5.100.138. No network drops seen so far.

      The booting is handled by rEFInd using the kernel as an EFI stub inside the external drive's ESP (labelled EFI) in the GUID as described by the creator of rEFInd. http://www.rodsbooks.com/ubuntu-efi/index.html

       Installing cinnamon desktop destroyed detection of sound card, though it can be fixed by reinstalling alsa-core and pulseaudio and running sudo alsa force-reload

      At this point, everything that I have tested works. The system usually reports a couple crashes early on after login which don't affect the stability. One freeze has been seen while changing the auto-hide option in the cinnamon settings, but  later attempts to recreate failed, so no confirmed bugs.

      The trackpad is sensitive to the lightest tap, so a USB mouse in recommended, though I had heard of someone editing the trackpad config... which if I get around to it I will include in another post. The keyboard works normally, AFAIK.

      With the latest updates and the proper libraries, steam and TF2 work, although TF2's frame-rate is choppy and resolution cannot be changed in TF2 in fullscreen mode. Unknown whether this is an issue with hardware or optimization by Valve being incomplete or something else entirely.

Enjoy having linux on that 2880x1800 screen!