Old iMac Ubuntu Studio Installation
On September 3rd, 2015 Joseph asked…
I have the opportunity to install Linux at work on a 5 year old iMac rarely used due to its age. My gut tells me I should go with Ubuntu Studio as it has access to just about every type of creative and office software imaginable upon installation. I see this as an opportunity to grab a few entry level users with varied needs. What would you install on an older system collecting dust that gets used maybe once a week?
I definitely think you’re on the right path for getting more life out of the old Mac. I recently did some testing with a 2010 Macbook Pro (6,2 version) and Ubuntu MATE. It’s more involved than simply installing Linux onto a PC, but it’s totally possible. Unlike Macbook Pro laptops however, the process should be a bit easier with the iMac.
That article is coming out soon and addresses how to install Ubuntu MATE onto a Macbook Pro under UEFI mode. Needless to say, I was able to get the proprietary graphic drivers working despite some known issues (black screen). The existing fixes found on Google are not compatible with Ubuntu 15.10 (nomodeset and other related hacks) and will likely create new issues, hence, why my upcoming article addresses this directly. Okay, back to your question.
Preparing for the installation
First and foremost, you should prep the hard drive for the Ubuntu Studio installation while booted into OS X. This OS X article provides a relevant guide for preparing a second partition using Disk Utility. The key here is to shrink down the existing OS X partition. I’d shrink it down substantially, since we’re only keeping this partition for access to recovery stuff, should you need to access them in the future. The newly freed space on the drive should be left as unformatted, since we’re going to be using the Ubuntu installer to handle the file system creation.
The next step is to install a new boot manager. Yes, you could “try” the old “hold down the Option key” approach and hope it works. Historically, I’ve found this approach to be very hit and miss. By installing the boot manager known as rEFInd (download the zipped package), a USB flash drive with Ubuntu will show up as bootable. Simply follow these instructions for installation and you should be good to go. We’re avoiding the Option key approach as I found it was not working reliably.
At this stage, you are ready to take your downloaded Ubuntu ISO and install it to a USB flash drive. Personally, I’ve always done this from the Mac itself. Here’s how on OS X, using an Apple keyboard.
Cmd+Space then type terminal and hit Return.
(Windows) Cmd+Space then type terminal and hit Enter.
hdiutil convert /path/to/ubuntu.iso -format UDRW -o /path/to/target.img
Don’t worry about adding dmg to the file, this happens automatically.
Now you’ll want to list the existing drives available. For newer users, I recommend running the command twice – once without the flash drive and a second time with it. If you feel comfortable in doing so, once is fine as you’ll be able to recognize drive.
In the list, you should see something like /dev/disk#
(The # might be a 2 or a 3)
When we plugged in the flash drive, OS X automatically mounted it. We need to unmount it.
diskutil unmountDisk /dev/disk#
(Remember to replace # with the correct number corresponding to the flash drive)
If it doesn’t eject correctly and you see something like “Unmount failed”, I’d try dragging it to the trash to unmount it.
Okay, the next step is to dd the new dmg over to the flash drive.
sudo dd if=/path/to/downloaded.img.dmg of=/dev/diskN bs=1m
(Yes, it appended .dmg to the .img file. In the interest of just getting things moving, I left it.)
At this stage, your flash drive has an OS X bootable copy of Ubuntu on it. All that’s left is to unmount the flash drive.
diskutil eject /dev/diskN
(Or drag it to the trash – when you completed the dd, the drive re-mounts itself and needs to be unmounted.)
Reboot the Mac. Since we shrunk down the OS X partition, freeing up a ton of free space for Ubuntu…the installation process is painfully simple.
After rebooting, you should be staring at rEFInd. Simply arrow key over to the icon representing the flash drive. If there are multiple entries, it’s usually the first one.
Once booted, you’ll be asked to select Try or Install. Choose Try, then run Gparted. Historically, I’ve found that sometimes the installer hangs. To avoid this, I usually setup an ext4 partition in Gparted, close the program and THEN run the installer.
When promoted, choose “install along side of OS X” and the rest of the process is exactly like a normal Ubuntu installation. Once completed, reboot.
Pro tip: Nine times out of ten, you’ll find that you’re presented with a grub menu instead of rEFInd. When this happens, I hold down the power button and then restart the Mac. This time, I hold down the Option key (Alt on a PC keyboard). I then select the OS X partition. Once back in OS X, I run the terminal script for rEFInd again (see above). This provides me with my rEFInd menu at boot again and grub there after.
That said, this may not be critical. If you don’t plan on using the OS X option frequently, you may be able to boot into Ubuntu without the above step – I’ve never tried, so I don’t know for sure. If it fails, the above steps will get you going.
Getting stuff working in Ubuntu
With my tested Macs, I found everything worked great. The only exception in my case, was the brightness keys on a Macbook Pro. With your Mac being a 2010 iMac you’re likely looking at an AMD graphics card, AirPort Extreme wireless and gigabit Ethernet. Out of the box, everything “should” work. This means everything is set to the non-proprietary drivers ranging from the wifi to GPU.
Most common issues with iMacs of that vintage is the audio not working. I doubt this is an issue with today’s latest kernels, but just in case…keep reading.
ONLY DO THIS IF: After jumping into the Sound Preference dialog and confirming that A) Everything is turned up or B) Options in Output or Hardware are grayed out. I highly doubt this is needed any longer…but just in case it is I’ve provided some things to try. Also double-check alsamixer (run in a terminal) to verify nothing is muted). Any time you use alsamixer, the things to watch for are Master, PCM, Front, Surround and that the right card is selected and everything is unmuted. Use the function keys in the upper right to navigate.
From your Ubuntu terminal:
if the file doesn’t exist:
sudo touch /etc/modprobe.d/options.conf
Next we need to paste or type in the following into the file:
options snd-hda-intel model=imac24
Then do a Ctrl+X to save the file, and reboot.
If that failed to work after verifying that Sound Preferences shows you all the sound toggles are up all the way, then try this next.
sudo rm /etc/modprobe.d/options.conf
Try the same code in this file below:
options snd-hda-intel model=imac24
pasted at the bottom of:
sudo nano /etc/modprobe.d/alsa-base.conf
sudo alsa force-reload
And like before, run alsamixer to see if things are working and make sure stuff is unmuted.
To reiterate, I do not believe this will be an issue for most people using the modern kernel(s). This is just in case, as a grab bag of stuff to try.
In my case, the iSight camera worked out of the box with Cheese and other apps. If however, it doesn’t work for you, I recommend taking this for a spin.
In my case, everything except some of the function keys worked great. I seriously doubt you’ll have any need to fool with the audio tweaks above. The keys for brightness controls and what not are usually bound to the proprietary video drivers.
In an upcoming article, I’ll share exactly how I got proprietary drivers working and avoiding a black screen after installing them!
Until next time…keep an eye our for the Macbook Pro Ubuntu MATE article. I’ll show you how to avoid the black screen of death using NVIDIA proprietary drivers on an Intel/NVIDIA MBP.
Do you have Linux questions you’d like Matt to help with? Hit the link here and perhaps you too, can Just Ask Matt!