Skip to main content

Debian Squeeze and Mac OSX Lion - Dual boot

With Mac OSX Snow Leopard, things were much simpler to install and run a Linux operating system just by using rEFIt boot manager utility, on my Mac Mini(4,1 Mid-2010 model). With the introduction of Lion, Apple has introduced a hidden, OS recovery partition. In total, there will be 3 partitions for Mac OSX alone, for Lion. They are ESP (EFI System Partition), Mac OSX installation partition and, the OS recovery partition. Also, as per the GUID Partition Table(GPT) which Mac uses, there can be maximum of 4 primary partitions, with no scope for Extended partitions like in typical MSDOS Partition Table setup. It is also recommended to follow GPT when using Mac.

With all these constraints, I'm actually left with one partition where I can install and run GNU/Linux (in this case, Debian Squeeze). I didn't try resizing an existing Mac OSX installation partition and creating an Ext4 partition for Linux. Rather, I choose to go for fresh installation. You can try with the resizing method, if you feel it might work out for you. If it does, please do let me know via comment to this post. Otherwise, below is the sequence of steps to follow in order to setup a dual boot system running Mac OSX Lion along with Debian Squeeze. It is assumed that you are an Admin user in the Mac before going further. Since, Mac Mini is a 64bit system, I have choosen to install Debian Squeeze 64-bit version (amd64). Also, note that you need a working ethernet network connection to complete the setup.

  1. Install Mac OSX Lion: I started by using my Snow Leopard installation DVD. Using disk utility which is available from top menu during installation, I created two partitions. The first partition is named as "MacOSHdd" and formatted as "MacOSX Case-sensitive journaled". The second partition as marked as "free space". The second partition is intended to be used for installing Debian, later. Since, I wanted more space for Linux, I choose the size of first partition to be about 80GB (for Mac OS). The rest is available as "free space". Once I installed Snow Leopard, I used my already downloaded 10.6.8 Combo Update dmg image to update my system. This update was needed to install Mac OSX Lion from App Store. Once I installed Mac OSX Lion (via App Store), I downloaded 10.7.4 Combo Update dmg image to update Mac OSX Lion to the latest available version.

  2. Install rEFInd: rEFIt, which used to be the popular boot manager tool for setting up multi-boot in Mac systems seem to have limited support for Lion. I found rEFInd to be much better and updated alternative to rEFIt. Hence, I used it in my case. You can download the binary zip file (built with GNU-EFI) from rEFInd webpage and extract it. Then, open a Terminal and run the following commands to install rEFInd to ESP ('$>' below, indicates command prompt).

    • $> cd <refind-root-dir> # Get into refind extracted directory

    • $> sudo bash # Login as superuser

    • $> sh install.sh esp # Remember to install rEFInd to ESP only. You will know why sooner

    • $> mount -t msdos /dev/<esp-disk> /Volumes/ESP # <esp-disk> will be your ESP partition disk. Ex., diskp0s1

    • $> vim /Volumes/ESP/EFI/refind/refind.conf # Edit the refind.conf configuration file for rEFInd to include boot image scanning for mbr based drives.

      Note: in the refind.conf file look for the line beginning with the configuration parameter 'scanfor' (uncomment it, if it is commented) and make sure it is configured as

      scanfor internal,external,optical,hdbios,biosexternal,cd

      You may need to add the missing hdbios,biosexternal,cd entries. Save and exit the text editor.

    • $> exit # Now, exit from the superuser login

    Close the Termial and reboot the machine. Remember that, rEFInd may take few seconds to scan and show up the screen with detected bootable media. So, you need to be patient.

  3. Debian Linux Installation: Soon after issuing reboot in the previous step, insert the Debian Squeeze CD (Desktop CD1 or netinstall CD). The system reboots and stops at rEFInd screen. If you cannot see the Legacy Linux CD next to Mac OS icon, just choose the 'reboot computer' option as your CD might not have been detected yet. Once you see the 'Legacy Linux CD', you can boot from it and follow the installation steps till you reach the disk partition. Just choose the 'Manual' partitioning for installing Debian. In the partitioning interface you will see the 3 partitions for Mac OS as mentioned earlier. Do not touch any of these. Instead, use the free space available which you must have allocated by now for installing Linux and, create a single, bootable Ext4 partition with mount point as '/'.

    Once you proceed further, the system may complain that you do not have SWAP partition. Ignore and proceed further to format the just created Ext4 partition. Rest of the installation should continue usually. When you are given the option to choose which set of packages to be installed in the "Tasksel" menu, I would recommend you to choose only the base system and openssh server and do not choose any other set, not even the desktop environment. The reason being, these other package sets need a good amount of time to retrieve updates from the net and to install them in the system. We can as well install any of them later, once a base system is up and running. At the end, you can install GRUB boot loader to MBR itself. Finally, once the setup is complete CD will be ejected out and the system will halt at the message "... restarting the system". Re-insert the Debian CD and do a hard reboot.

  4. Synchronizing the partition tables and firmware installation: Even though we finished installing Debian on to the mac disk, things won't work as we expect. The reason being, there will be two parallel partition tables, GPT and MBR. The MBR needs to be synchronized properly with GPT information. That is the reason why we re inserted the Debian installation CD again.

    Select to boot from Debian installation CD and select 'Rescue Mode' from the Advanced installation options menu. Follow the menu options normally till it asks you to select the partition to use as Root filesystem. Select the partition (Ex., /dev/sda4) where you have installed Debian. In the next screen select to run the shell/commandline in the installed root file system (not under the installer CD environment). This basically does a chroot into the installed, Debian filesystem so that, we can install some additional packages as needed.

    Once you get the shell, edit the file /etc/apt/sources.list to reflect the following entries.

    deb http://ftp.de.debian.org/debian/ squeeze main contrib non-free
    deb-src http://ftp.de.debian.org/debian/ squeeze main contrib non-free

    deb http://security.debian.org/ squeeze/updates main contrib non-free
    deb-src http://security.debian.org/ squeeze/updates main contrib non-free

    # squeeze-updates, previously known as 'volatile'
    deb http://ftp.de.debian.org/debian/ squeeze-updates main contrib non-free
    deb-src http://ftp.de.debian.org/debian/ squeeze-updates main contrib non-free

    Do an apt-get update to update the package cache. Then, install gptsync package using the command apt-get install gptsync.

    Once, gptsync is installed, issue the command gptsync /dev/sda to synchronize the partition tables properly (You need to choose 'y', when gptsync asks you whether to sync the partition or not). Do a re-configuration of GRUB bootloader by issuing the command grub-install --force /dev/sda (grub-install will complain about some gpt partitions if --force option is not given).

    You can choose to install some of the additional packages to make sure the graphics and WiFi can be setup correctly. For nvidia graphics card support install the necessary packages from the command apt-get install nvidia-glx nvidia-kernel-dkms.

    For Wifi related firmware installation, issue the command apt-get install firmware-linux firmware-linux-free firmware-linux-nonfree.

    Finally, issue grub-update to make sure boot images have been suitably updated with firmware information. Now, exit from the chroot shell and then choose to reboot the system. CD might not get ejected this time. Don't worrry! Just do a hard reboot once you see the message "... restarting the system".

  5. Configuring display and desktop installation: Select to boot from Linux on HDD (Linux installed on Hard drive). In the GRUB menu that appears, choose the first option and press 'E'. Look out for the line which ends with quiet (the root filesystem related line). Edit this line by removing the quiet option and adding nomodeset instead. Then press Ctrl+x to boot. The reason why we set nomodeset is, due to invalid display mode, the monitor might get no signal and will go to sleep. This issue will get rectified once we install the complete desktop environment.

    Once the boot process completes, we get the login prompt. Login as 'root' and install the desktop environment of your choice. I installed 'gnome-desktop-environment' meta-package (apt-get install gnome-desktop-environment) which installed the gnome-desktop for me.

    Once all the packages are installed (it takes a while), you might need to setup X configuration to use nvidia driver. Run the command Xorg -configure which will dump the xorg.conf.new file in the current directory. copy this file to /etc/X11/xorg.conf. Now edit the file /etc/X11/xorg.conf change the driver option to 'nvidia' under display card related configuration. Save this file and exit. Issue the command eject /dev/cdrom to eject the Debian installation CD so that you don't see this being getting scanned and shown by rEFInd upon next boot.

    Reboot the machine again and select to boot from Linux on HDD. If everything is configurated properly, the Debian system will boot and should give you the GDM login prompt. That's pretty much about it!! Debian Squeeze is now available to configure and use in the way you like. Enjoy :-)

Comments

Post a Comment

Popular posts from this blog

Using USB CDMA modem to setup a home/private WiFi network

The idea here is to give a ‘how-to’ on setting up a a home WiFi network using mobile, CDMA based USB modem, hoping that bandwidth that you obtain from this service is satisfactory :-)

Hardware Requirements:
Linux PC/Notebook/Netbook
Wifi Access point connected to ethernet port of the Linux box
CDMA-1x USB Modem (Device used: Reliance M880)

Software/OS Requirements:
Linux Operating System with “usbserial” and “cdc_acm” device driver modules
“pppd”, “wvdial”, “iptables”, and “dnsmasq” applications and their dependencies installed on the System

Setup: The steps followed in setting up this CDMA based connectivity can be split into 3 steps, as follows.
Configuring kernel modules for auto-loading at bootupConfiguring “wvdial” application for dialup / ppp connectionInitializing / starting the CDMA modem connectionSetting up “iptables” for NAT forwardingSetting up “dnsmasq” for resolving DNS and as DHCP server
Configuring kernel modules for auto-loading at bootup
Open a terminal and type the co…

Creating GRUB/Syslinux splash images

GRUB splash image creation:
Open GIMP application.Create an image of size 640x480 pixels. You may open an existing image and resize it too.Reduce the number of colors to 14 by selecting menu item “Image->Mode->Indexed”. Don’t use any color dithering.Save the resulting image as splash.xpm and close GIMP.Compress the image file by running; gzip splash.xpmCopy the resulting splash.xpm.gz file to /boot/grub.Run update-grub to upgrade the grub configuration to include this splash image.
Syslinux splash image creation:
Open GIMP application.Create an image of size 640x480 pixels. You may open an existing image and resize it too.Reduce the number of colors to 14 by selecting menu item “Image->Mode->Indexed”. Don’t use any color dithering.Save the resulting image as splash.ppm and close GIMP.Install the package syslinux-common by running; apt-get install syslinux-common as sudo/root. Convert the saved image to syslinux format by running; ppmtolss16 ‘#ffffff=7’ <splash.ppm >spl…