Jump to content

Dualboot (installing Linux after Mavericks)


devilotx

Recommended Posts

So I got a Mavericks working great on an e6230, and then booted a usb flash drive partitioned the drive and installed Saucy, I made sure to install Grub to the / partition that Linux was installed on, rebooted into Mavericks, reinstalled Chamelon and.... nothing, Chameleon doesn't recognize that there is anything else installed, I've read through a few things, but most go the other way, installing Linux then OSX.

 

Any advise would be helpfull, I don't know if you can modify chameleon to chainload.

Link to comment
Share on other sites

devilotx,

 

I'm assuming first that you installed to GPT instead of MBR.  If that's not the case, then this probably won't work for you.  Also, note that while I dual-boot Linux, I'm using CentOS, not Ubuntu.  So, as the saying goes, your mileage may vary (YMMV).

 

You need to change the partition type of the Linux boot partition to '0700' for Chameleon to recognize it, in my experience.

 

This can be done most easily with a program called 'gdisk' which is available for Linux and OSX.  By default, CentOS at least will set the boot partition's type to EF00 (as that's correct when booting from a 'normal' EFI).  Here's the output of 'gdisk -l /dev/sda' for my triple-boot system:

[root@dhcp-pool121 ~]# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 195C6419-B7BC-4938-A6EE-123456789012
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 8-sector boundaries
Total free space is 263990 sectors (128.9 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       587833295   280.1 GiB   AF00  MixBusM4300
   3       588095440      1113159887   250.4 GiB   AF00  MixBusSL
   4      1113161728      1317961727   97.7 GiB    0700  CentOS6-root
   5      1317961728      1334738943   8.0 GiB     8200  CentOS6-swap
   6      1334738944      1953525134   295.1 GiB   0700  
[root@dhcp-pool121 ~]# 

The way I use it is a bit convoluted.  When I go to install a CentOS installation to a system booting with Chameleon, I have a couple of boot USB drives available.  One is a boot USB of the installer, and the other is a 'live' USB, both using CentOS.  I don't install from the 'live' USB because I don't like the default preferences that brings across, and, well, I like to select lots of packages out of the gate off the install media and go away for a while during the actual install.

 

Anyway, the 'live' USB is set up using the Fedora liveUSB tools to have a persistence overlay; i then add the 'EPEL' repositories to the live USB and install gdisk there.  I boot the install media, do the install, shut down, boot the live USB, and change the partition type of the CentOS boot partition with gdisk from the live USB media.

 

With Ubuntu, I know you can do very similar things, including the persistence overlay and custom live USB spins, but since I've not done that with Ubuntu I can't give a step-by-step.  Since Ubuntu installs most easily from the live media, a custom spin of the live media with the gdisk package will do what you need.  What you'll have to do then is launch a command line terminal and run gdisk on your hard disk, and change the partition type with the 't' command.  You can also assign descriptive names within gdisk.  When done, use the 'w' (write) command to write the changes back to disk.  The '?' at the gdisk prompt with give you help.  Do be careful that you have the correct disk, as gdisk, being a disk partitioner, can potentially cause data loss.  So, back up your OS X stuff beforehand, if you have anything important to back up.

 

Hope that helps.

 

EDIT: While I'm sure this could be done inside OS X, I am first and foremost a Linux freak, and so I tend to use Linux tools to do things.  A 'pure' OSX recipe for doing the same thing would be interesting.

  • Like 1
Link to comment
Share on other sites

Further note: it appears that gpt might do the same thing as gdisk, under OS X.  I have not tried it, and will at my earliest opportunity reboot into OS X to see if that is indeed the case.  I'll update this post if a reply isn't posted before..... (Updated to remove pdisk reference, instead it appears gpt is the command to use).

 

Issue 'man gpt' at a terminal command line to get arguments and such, or use the online manpages on the Apple Developer site.

 

EDIT:  The technical info:

 

Chameleon (as of SVN 2283 from voodooproject svn) will recognize one of two GUID's for chain booting a foreign OS: BasicData {EBD0A0A2-B9E5-4433-87C0-68B6B72699C7} or BasicData2 (reserved partition, {E3C9E316-0B5C-4DB8-817D-F92DF00215AE}) as selected in the function diskScanGPTBootVolumes in i386/libsaio/disk.c in the Chameleon source tree.  This corresponds to a gdisk 'type' of 0700.  In order to detect a 'native' Linux (8300 type) Chameleon would need to be patched to recognize GUID {0FC63DAF-8483-4772-8E79-3D69D8477DE4} as well.  But CentOS 6 at least uses the reserved EFI type of EF00 {C12A7328-F81F-11D2-BA4B-00A0C93EC93B} for the booting partition.

 

You can find the list of gdisk's 'types' to actual GUID's along with comments in the gdisk source tree; through-the-web svn:

http://sourceforge.net/p/gptfdisk/code/ci/master/tree/parttypes.cc

 

Hope this is helpful to someone.... it was fun spelunking in the Chameleon source to find it.

  • Like 1
Link to comment
Share on other sites

devilotx, can you provide the output of 'sudo gpt show /dev/disk0' please?  Here's what I get with a working triple boot, where one of the OS's in CentOS Linux:

dhcp-pool132:bin lowen$ sudo gpt show /dev/disk0
Password:
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34           6         
          40      409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      409640   587423656      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
   587833296      262144         
   588095440   525064448      3  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  1113159888        1840         
  1113161728   204800000      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1317961728    16777216      5  GPT part - 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
  1334738944   618786191      6  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1953525135          32         Sec GPT table
  1953525167           1         Sec GPT header
dhcp-pool132:bin lowen$ 

I've booted into Mav, and am looking at what is available to deal with this.... but it looks like the best solution is going to be installing the OS X version of GPT fdisk ( http://www.rodsbooks.com/gdisk/ ) which can do what you need.  Since i have always used the Linux version from a boot USB, I really don't know if gdisk will allow you to edit the boot drive's partition types or not. UPDATE: The author's documentation seems to indicate that only under FreeBSD will you be locked out of editing the partition table of a disk with a mounted volume.  YMMV, etc.  Hope that helps.

 

The OSX built-in gpt and diskutil commands seem to be pretty weak on making changes to existing partitions, but I would love to be proven wrong.

  • Like 1
Link to comment
Share on other sites

I read and re-read your directions about 5 times before diving in and as I had installed with a separate /boot partition, it was made that much easier, booted the ubuntu live USB and install gdisk, used gdisk to change my boot partiton (5 in my case) to 0700 and wrote the change, and perfect, worked perfectly, 

 

Can't thank you enough for that perfectly written and explained answer! 

 

If this was reddit, you'd have yourself an upvote!

Link to comment
Share on other sites

×
×
  • Create New...