Archive for the Mac Category

How to Install Linux on a Mac

Here are some notes about installing Linux (in particular CentOS 5, but that shouldn't matter, it could be Ubuntu etc) on an Intel-based system running Mac OS X 10.4.11 "Tiger", in my case a MacBook but this should be the same for other Macs.

The summary for the impatient is:

0) Preparation: Get the DVD / CD-ROMs of the Linux distribution you want to install and backup the data in your computer.

1) Re-partition the hard drive to make space for the new operating system. I used Apple's Boot Camp which can be downloaded.

2) Install a boot loader or boot manager, I used the open source rEFIt.

3) Install Linux on the newly made partition, make sure that GRUB goes in the 1st sector of the boot partition, not Master Boot Record (MBR).

Now the details.

0) Backing up my up disk. I have an external (USB) hard drive: "Maxtor OnetTouch III Mini Edition". The OneTouch software is a disappointment; both the synchronization and the backup failed, the first one choked on one file and crashed but I only found out after looking at the logs; the GUI kept showing the same thing. For the backup method, it just kept saying "Completed back up. 0 items were updated" and again it the logs there was some cryptic problem that prevented the program from starting.

1) Apple is including Boot Camp as part of his new OS version "Leopard", and they took out Boot Camp 1.4 from their web site. I couldn't find it online so I got Boot Camp 1.3 instead.

After installing and running it I see that the smallest new partition you can create is 5GB. Boot Camp formats the new partition with the Windows file format but we don't care because we are going to re-format it. There's also an option regarding Windows drives that we can ignore.

When I tried to re-partition the disk I kept getting an error from Boot Camp: "Your disk cannot be partitioned because some files cannot be moved", and it suggested to start all over: to copy all my data from the MacBook, reformat the disk, reinstall OS X etc. No Way.

It was worth a shot to try and delete some big files. I couldn't find any free defragmentation tool. I downloaded Disk Inventory X, which is a nifty tool that shows you graphically how big the files in your disk are.

I deleted a bunch of unneeded big files and I also found a big "sleepimage" file (as big as your RAM) that is used for hibernation and followed these instructions on how to delete sleepimage.

Basically (just in case the link disappears):

$ sudo pmset -a hibernatemode 0
$ sudo nvram "use-nvramrc?"=false

reboot and $ rm -f /private/var/vm/sleepimage

After this I was able to run Boot Camp successfully. Note that if you're getting the "cannot move files" error with a bigger partition if you make it smaller (down to 5GB) you increment the chances that the "unmovable" files are not in the smaller partition.

2) I downloaded and installed rEFIt, the rEFIt 0.10 Mac disk image.

With this rEFIt version for Mac there's no need to manually run the install script and move its folder.

At this point with the bootable Linux DVD (or CDROM), if you restart the Mac you'll get rEFIt's boot menu first of all, where you can choose if you want to start OS X or from disc.

3) Once we have made space for Linux and we got the boot manager we can just proceed an install Linux from disc as normally, we only have to be careful in the format/partition section of the installation to use the space we created (it will show as FAT32) and not to format or use the shrunk HFS partition used by Mac OS. We can safely delete that partition and use the free space to create our Linux partitions.

The other thing to be careful is to Install GRUB (or LILO, the Linux boot manager ) in the 1st sector of the boot partition (that would be 'root' or / if you don't make a /boot partition) , not onto the Master Boot Record (MBR). Red Hat and CentOS have this option by default.

That's all. I'll just comment that I found CentOS 5 bloated; I tried a minimal installation by unselecting almost everything (but with KDE) but still after installation I takes over 3GB. There are lots of gnu packages and even 300MB of an openoffice core file even if I unselected all office applications. After the first reboot I also unselected SELinux but then I had lots of SE services running, among with sendmail, cups and many others.

I wanted my desktop to have Internet access but since it's not close to my router and I don't want to pay some $70 for a PCI wireless card, I decided to connect the desktop with an Ethernet cable to my MacBook, which is connected via wireless through AirPort.

So, this is what the Mac help says:

1. Open System Preferences, click Sharing, and then click Internet.
2. Choose a network port from the "Share your connection from" pop-up menu.
3. Select "Built-in Ethernet" or AirPort depending on which computers will share your Internet connection.

If you have turned on the firewall on the Firewall pane of Sharing preferences, you also need to turn on Personal Web Sharing on the Services pane of Sharing preferences in order to share your Internet connection and allow computers connected to your Internet connection to browse the web.


This need to turn on Personal Web Sharing is confusing since stopping it is to “prevent users of other computers from accessing Web pages in the sites folders on this computer”; I'm not sure how this is related to making a bridge for Internet sharing.
So in my case, I selected “Share your connection from: AirPort” to computers using “Built-in Ethernet” and I allowed “Personal Web Sharing” in Services (it automatically allows it in the firewall settings).

Now, there's a couple of extra steps to take, at least with my default configuration.

After the previous steps I lost Internet connectivity in the MacBook, and this is because it was trying to connect thru the Ethernet port, ie, Ethernet has higher priority by default than the AirPort wireless port.

This can be checked in System Preferences -> Network and “Show: Network Status”; I see that the Ethernet interface was assigned the private address 10.10.10.1 and at first it was saying “You are connected to the Internet via Ethernet”. I changed to the view “Show: Network Port Configuration” and in effect, Built-in Ethernet was higher up in the list than AirPort, so I dragged AirPort to the top of the list and gained the connectivity back.

Now, regarding the computer that is connected to the Ethernet, it's not likely that its network settings will be ready for the connection; many will have DHCP by default and the MacBook is not offering that service (at least by default). So I setup a fixed ip address in the desktop, 10.10.10.2 (or 10.10.10.whatever) with a network mask 255.255.255.0 and as gateway the MacBook: 10.10.10.1.

So everything is working fine now. As an additional note, the MacBook Ethernet port supports both regular network cables and cross-over ones; it will auto-detect the type of cable and it can work in both modes automatically, so you don't need a cross-over cable to connect directly to another computer, you can use a regular patch cable. (I checked that it works with both types of cables).

Besides reports of problems between MacBooks (or Apple AirPort in general) and D-Link's DI-614+ wireless router, I couldn't find any useful information of how to make the beauty and the beast to play nicely together, so here's my experience in case in can help somebody.

No matter what I tried, I couldn't get the Macbook to connect to the D-Link POC access point using any form of WAP encryption, it would connect just fine as an open network. I reckon this wasn't a problem of the mac wireless since I had visitor's laptops that wouldn't connect to the D-Link router either. I guess this crappy router is safer for being quirky.

Apple has some interesting notes about WEP passwords, but that didn't help.

I didn't want to shell out $80 or so for a new wifi router, especially when I don't need 802.11g at 55Mbps speed and they don't sell in retail stores older "b" models anymore. I wonder how many people that get the new routers as upgrades have an Internet connection close to 55Mbps.

So finally what did the trick was upgrading the firmware of the wi-fi router. In the admin page (default is http://192.168.0.1) the section is reached by going to the "Tools" tab and then "Firmware". There's a link there to D-Link's TechSupport and after some navigation you can download the latest firmware (Current Firmware Version: 3.44 Firmware Date: 16 Nov 2005) and flash the router.

In Advance -> Performance I lowered the beacon interval range and that seemed to improve the wireless data rate.

For security I'd recommend besides the WEP encryption (of course) setting in Advance -> Filter a MAC filter and in Advance -> Performance checking the "Disabled" for SSID broadcast.