Monthly Archives: January 2015

Xubuntu on Unsupported MacBook

Last week I wrote about installing Mac OS X Mavericks on my MacBook 2007 (MacBook 2,1). That went fine… but… for a computer I mostly use in my lap, in the living room, no decent Internet Video performance (like YouTube) feels disappointing (it was not good before I upgraded to 10.9 either).

So, I decided to install Xubuntu on it. First the conclusions:

  1. Xubuntu runs nicely on the MacBook2,1.
  2. Video works fine, much better than on Mac OS, and also suspend/sleep, audio, WiFi seems perfect. I have not tried the webcam.
  3. I ended up using Xubuntu 14.04.1, the 32-bit i386 edition.
  4. Booting and partitioning is not trivial.
  5. International Apple Keyboards are always a challenge in Linux.

Now to the details.

Xubuntu version
The 32-bit EFI and 64-bit CPU that causes problems for current versions of Mac OS is also an issue for Xubuntu. I downloaded and burnt DVD-isos to try different versions. The 64-bit Xubuntu does not boot easily but the 32-bit versions are just fine. For a computer with 2.5Gb RAM as I have, the practical disadvantages of running it in 32-bit mode instead of 64-bit are insignificant.

A nice thing with Xubuntu is the Live-mode; you can start the DVD and test the full system before deciding to install. Of course performance when starting applications suffer. I first installed 14.10; the Live system worked perfectly, but I had video problems (screen was black after system was completely started) after installation and decided to try 14.04.1 instead, which worked just fine. Since 14.04 is a long-term-release it might just be the better choice anyway.

There used to be x64-Mac-images, that fixed the 32-bit-EFI-64-bit-kernel problem but they are not available anymore.

Finally, I think it is quite safe to assume that you will be fine with Ubuntu, Kubuntu or Lubuntu if you prefer them to Xubuntu.

Keyboard issues
I have a Swedish keyboard on my MacBook, and the AltGr (just named Alt on the Mac) does not work out of the box. This cause problems to type particularly the following characters: @$|[]\{}~.

I found it best to just use Generic 105-key PC keyboard and standard Swedish layout. After that a little xmodmap-hack is required.

Put the following in a file called .Xmodmap in your home directory:

keycode 64 = Mode_switch
keycode 11 = 2 quotedbl at at
keycode 13 = 4 dollar 4 dollar
keycode 16 = 7 slash bar backslash
keycode 17 = 8 parenleft bracketleft braceleft
keycode 18 = 9 parenright bracketright braceright
keycode 35 = dead_diaeresis dead_circumflex dead_tilde dead_caron

The first row maps the left Alt ley of my keyboard to something called Mode_switch. The other rows indicate what happens when pressing the buttons 2,7,8 and 9.

The following information from “man xmodmap” was useful in finding the above solution:
Up to eight keysyms may be attached to a key, however the last four are not used in any major X server implementation. The first keysym is used when no modifier key is pressed in conjunction with this key, the second with Shift, the third when the Mode_switch key is used with this key and the fourth when both the Mode_switch and Shift keys are used.

The internet is full of sources telling to use ISO_Level3_Shift. It did not work for me and the above manpage told me exactly what I needed to know.

There are also sources telling you other names than .Xmodmap (like .xmodmaprc , .xmodmap), that also do not work.

Before you are ready to write your .Xmodmap file you can test one by one:

xmodmap -e "keycode 64 = Mode_switch"
xmodmap -e "keycode 11 = 2 quotedbl at at"
xmodmap -e "keycode 13 = 4 dollar 4 dollar"
xmodmap -e "keycode 16 = 7 slash bar backslash"
xmodmap -e "keycode 17 = 8 parenleft bracketleft braceleft"
xmodmap -e "keycode 18 = 9 parenright bracketright braceright"
xmodmap -e "keycode  35 = dead_diaeresis dead_circumflex dead_tilde dead_caron"

The command xev is very useful to find out what keycode corresponds to a physical key on your keyboard.

Partitioning – The hard way
From the beginning, before ever playing with Xubuntu on the computer, I had the following partitions:

1: EFI (small, hidden in Mac OS)
2: Mac OS 10.9 System
3: Mac OS 10.7 System
4: Apple boot (small, hidden in Mac OS)

When I first installed Xubuntu I deleted partition 3 and replaced it with three partitions:

3: biosboot (small, required by EFI)
5: Linux SWAP (4GB)
6: Linux /

That was ok. But when I later deleted those partitions from Mac OS X because I thought that was more safe, the Apple boot partition (#4) disappeared. If it was this thing then perhaps it is ok. Mac OS still boots.

I always choose manual partitioning, and to install the Linux Bootloader (GRUB) on the Linux root partition (/dev/sda6). I have no idea what happens if it is installed on another partition, and particularly not on /dev/sda itself.

rEFInd – The hard way
The recommended way to boot Xubuntu on a Mac is to use rEFInd. Apples EFI-implementation is not supposed to be very competent at booting other systems. So I installed rEFInd (0.8.4) using the install.sh script from Mac OS X. Very easy, and it worked right away. Problems started later.

My first installation of Xubuntu was 14.10, and as mentioned above it had video problems. So I reinstalled 14.04.1 instead of 14.10, same partitioning, and everything was fine. Except rEFInd displayed TWO linux systems as well as Mac OS to boot. This disturbed me enough to decide to delete all traces of Xubuntu and reinstall.

I ended up in the following situation:

  • I have not managed to get rid of the last Linux-icon in rEFInd.
  • I have ended up with a partly broken rEFInd, it displays the error message:
    Error: Invalid Parameter while scanning the EFI directory
  • rEFInd does not boot Xubuntu.
  • I can not uninstall rEFInd as described in its site, by removing the directory EFI/refind, because it does not exist (there are just some rEFInd config files in the EFI directory).
  • I read that efibootmgr can be used form Linux to clear parts of NVRAM, but it is not supposed to have much effect on a Mac anyways. And I failed to use efibootmgr on Live-Xubuntu.

The rEFInd errors actually disappeared by themselves after I had used (started) Mac OS a few times.

Partitioning and rEFInd – the Easy way
I think you will be safe if you do:

  1. Make empty space on the disk, after the Mac OS partitions.
  2. Install rEFInd from Mac OS
  3. Install Xubuntu 14.04.1 i386 (32-bit), let Xubuntu install side by side and take care of partitioning and boot devices

This finally worked for me. My partition table is now:

Number  Start   End    Size    File system     Name                  Flags
 1      20,5kB  210MB  210MB   fat32           EFI system partition  boot
 2      210MB   120GB  120GB   hfs+            Customer
 3      120GB   120GB  1049kB                                        bios_grub
 4      120GB   317GB  198GB   ext4
 5      317GB   320GB  2651MB  linux-swap(v1)

Conclusion
Xubuntu on a MacBook mid 2007 (MacBook2,1) rocks. Better than Mavericks. But dual booting and rEFInd is not completely predictable. The good thing is that it is not very easy to end up with a complete unbeatable computer at least.

Install Mac OS X 10.9 on unsupported MacBook

Update 2019-05-02: For those of you who want to install macOS 10.14 on an unsupported Mac, check this post.

I have a MacBook Mid 2007 (more technically named MacBook2,1) that officially can not be upgraded beyond Mac OS X 10.7 (Lion). It is however possible to install Mac OS X 10.9 (Mavericks) on it with quite good success and not too much effort.

System information with Mavericks

System information with Mavericks

I want to first write what does not work:

  1. Sleep mode – not working at all – leave on or shut down
  2. The build-in web camera – “works” but not as it did in 10.7, I think
  3. YouTube-video (etc), works occationally (now worse than in 10.7, my experience)

I suggest you read the user comments to this post. A few helpful readers have shared their experiences.

What you need:

  1. A USB Memory, 8GB or larger
  2. Mac OS X Mavericks (i had the install/upgrade Application that I had myself
    downloaded on another Mac, from App Store, when I upgraded it from 10.8 to
    10.9. I always keep these for possible future use.)
  3. SFOTT: I used version 1.4.4 which is currently the latest stable
  4. Audio/Video-drivers from (not here anymore, se comments below).
    Warning, this is one of these horrible download pages where you don’t know
    where to click to get the right thing, and what gives you spyware. You
    should get the file mac-mini-mavericks.7z. Discard anything else without
    opening. The 7z-file can be opened with StuffitExpander, that already
    comes with Maverick

Making a bootable USB-drive
You first need to use SFOTT to create your bootable USB-drive (it is called “key” in SFOTT). You simply double-click on SFOTT on a Mac where you both have your Mavericks Install App and your USB-drive. SFOTT is a self guiding menu-driven application. It will take some time to make all the settings in SFOTT (it took me perhaps 15 minutes), but it was self-explanatory and not very difficult. Use the autorun mode to create the drive.

Recovery Scenario
When you install a Mac OS upgrade there is a risk your Mavericks system will not boot. When upgrading from 10.9.0 to 10.9.5 like I did, it will not boot. My impression (after reading different sources) is that this recovery is needed when upgrading from 10.9.0 (or 10.9.1 / 10.9.2) but not later. Nobody knows about 10.9.6 of course, because it is not out. Minor upgrades to applications or security upgrades should not cause need to recovery.

When Mavericks fails to start you need to “re-Patch” using SFOTT. I installed Mavericks on a separate partition, side-by-side with Lion, so when Mavericks failed to start my computer automatically started Lion instead and I could run SFOTT in Lion to re-Patch my Mavericks system.

If you can not do side-by-side you can start from your SFOTT-key (which you still have) and instead of installing Maverick you start the Terminal application. Find the SFOTT.app on the key, and find SFOTT.sh inside SFOTT.app. Run SFOTT.sh and you can re-Patch your broken Mavericks system. I did the entire procedure on my working Mavericks just to test it, and it seems fine.

There is if course no true guarantee that a future Apple upgrade will not break everything completely.

Installing Mavericks
Installation of Mavericks from the USB-drive is very standard. To start the computer from the USB-drive, hold down the “alt”-key (not Apple-key, not ctrl-key) while starting the computer. Choose SFOTT and proceed normally. After about an hour you should have a clean 10.9.0 Mavericks with network/wifi working. Video will work, but with problems (try Safari, and you will see), and Audio will not work.

Upgrade Mavericks
I used App Store to upgrade Mavericks to 10.9.5. That works just fine, until Mavericks fails to start (I ended up in my old Lion system on a reboot, if you have no other system installed your computer with probably just not start). This is where you need to recover your system using SFOTT.

Fixing Audio and Video
The 7z-file I referred to above contains Audio and Video drivers. You run the application “Kext Utility” and the you drag the contents of the folder Extensions into the Kext Utility, and it will install the drivers. There is a folder with “optional wifi drivers”, I have not installed those because wifi has been fine all the time for me.

The MacBook2,1 has Intel GMA950 Video, and there are no supported 64-bit-drivers for Mavericks. The drivers I suggest you to install are supposed to be drivers from a public beta of 10.6 (Snow Leopard) that Apple once released. They seem to work quite fine for me though. And not installing them is worse.

I suggest you upgrade to 10.9.5 before fixing Audio and Video. I guess a later Apple-upgrade could break Audio and Video and require you to reinstall drivers.

Problems booting the SFOTT key
I first created the SFOTT key using the SFOTT beta (that is also supposed to work with Yosemite), and I used System Preferences/Startup Disk (in Lion) to start the installion. This failed and my computer just started up in Lion.

I then created the SFOTT key using 1.4.4, AND i restarted the computer holding down the alt-key. This worked. This key also later worked when I used System Preferences/Startup Disk (in Mavericks) to choose startup drive.

Driver Problems
There are open source Audio drivers called VoodooHDA. I installed those ones with success, but audio volume was low. I tried to fix with no success. Later I found the drivers I referred to above and that I recommend.

I found another download for what was supposed to be the same Video Drivers. But the Kext-utility did not work, and I installed the drivers by copying them directly into /System/Library/Extensions and this gave me a broken unbootable system. I don’t know what went wrong, but I recommend the drivers I linked to.

Video/YouTube Performance
Some videos seem to play perfectly, others dont. I had problems with 10.7 too.

Background and about SFOTT
There are several Apple computers that can run 10.7, that have a 64-bit processor, but that can not officially run 10.8 or later. There are a few issues:

  1. Video Drivers – and in the case of my MacBook2,1 the unofficial ones mentioned
    above may be good enough
  2. 32 bit EFI. Even though the computer has a 64 bit processor, the EFI, the
    software that runs before the Installer/Operating system, is 32 bit, and not
    capable of starting a 64-bit system.
  3. Mavericks does not believe it can run on this hardware.

As I understand it SFOTT installs a little program that 32 bit EFI is capable of starting, and that in turn is capable of staring a 64 bit system. Also, SFOTT patches a few files so Mavericks feels comfortable running on the unsupported hardware.

You can do all of this on your own without SFOTT. SFOTT “just” makes this reasonably easy.

There are plenty of forums, tools and information about running Mac OS X on unsupported hardware (also non-Apple-hardware: a Hackintosh). Those forums of course focus a lot on problems people have.

Yosemite
It is supposed to be possible to install Yosemite in a similar way. SFOTT has a beta release for Yosemite. For my purposes going to Mavericks gave me virtually all advantages of an upgrade (supported version of OS X, able to install latest Xcode, etc).

Conclusion
In the beginning of 2015, it is not that hard to install Mavericks on a MacBook Mid 2007, with a quite good result. I have pointed out the tools and downloads you need and that will work.

Scenarios for GNoSR

I found a beautiful little route for Train Simulator on Workshop: GNoSR. Unfortunately, since the route is not “Final” it is not possible to upload scenarios to it, to Workshop.

I created a scenario for GNoSR, and perhaps there will be more in the future. The scenario is downloadable as an .rwp-file, which is installed with the utilities.exe-program in the railworks folder. As always, please report any problems with the scenario, otherwise I can not fix it.

Scenario 1: Mixed Train to Heith
Drive a mixed train to Heith, stopping at all stations and picking up freight wagons along the way. Duration: 60 minutes. Download: Mixed Train To Heith.

Scenario 2: Petroleum Freight
Drive a heavy freight train with Marine Fuel from Heith to Portbyvie. Duration: 70 minutes. Download: Petroleum Freight.

Dependencies
There should be no additional dependencies or requirements apart from those of GNoSR (Woodhead Line, Western Lines of Scotland and Falmouth Branch). Please let me know if you have problems with this.

Other versions
I consider making other versions of the same scenario, perhaps with the Robinson O4, the Standard 2MT or the 3MT Jinty. But I may not bother if I get no interest whatsoever in the original.

UKTS
It seems the route and scenarios are available on UKTS. I personally find UKTS to be too much work and too many dependencies. My scenario is for the Steam version of the route, and I want people who just use Steam to have some fun with GNoSR.

Scenarios for other routes
Granfield Branch
Hedborough North