# Mac mini G4 FreeBSD & Mac OS X dual-boot is ok, but FreeBSD & Ubuntu not ok, why?



## aurora (Feb 11, 2013)

Hello

I'm trying to install 3 OS'es on my Mac mini G4 (PowerPC) to make better use this aging computer. The 3 OS'es are: FreeBSD, Ubuntu and Mac OS X.

I have managed to install FreeBSD and MAc OS X together on a single harddisk and both OS'es can boot quite fine.

But I couldn't install FreeBSD and Ubuntu on the same harddisk because after I installed FreeBSD, the Ubuntu Install cannot see the partitions properly. For full details I experienced, please see this post [Edit: after a while, the problem on this post was solved, see the second post there)

Is there a practical way to make Ubuntu install after FreeBSD is installed?


----------



## sossego (Feb 12, 2013)

What you need to do is recreate a partition scheme with the Ubuntu disk.
1. Apple boot block, ext4, and swap for Ubuntu. Re-install Ubuntu on it.
2. Apple boot block,ext3, swap, and others for FreeBSD. Mark each of these as  "Do not use." You can do two partitions with FreeBSD as with Linux since your system is smaller. Re-install FreeBSD on it.
3. Keep the MacOS as it is.
When you boot and hold down the option key, you should have an option of a penguin, a disk image, and the Mac face.

If this doesn't help, try contacting somebody on the mailing list.


----------



## aurora (Feb 13, 2013)

Finally, that worked! I found out I was misinterpreting the partitions, I was thinking of just one Apple boot block was necessary for both FreeBSD and Ubuntu. But they need 2 separate and dedicated partitions for that. Now I got a dual-boot system of FreeBSD and Ubuntu on Mac mini G4.

Now the problem is solved. But I have still something more to ask: 

It's about the FreeBSD's boot logo. It's only a stock harddisk logo of open firmware.

Can I assign another logo for FreeBSD partition inside open firmware (like the way I can do it in rEFIt?)

How can I edit the label of FreeBSD partition, is there a safe and practical way to do it?

Thanks.


----------



## aurora (Feb 13, 2013)

I've noticed something more (a kind of a problem)

Dual-boot of FreeBSD & Ubuntu seems possible only on a harddisk with some free space of size between 25K-1M (called padding?) before bootcode partition; like this:






If there's no such free space, like the sample below, Ubuntu Install cannot detect the partitions, thereby making it impossible to install Ubuntu into harddisk:





Do you have any idea why it 's that way? And what is the best way to add such free space?

Thanks.


----------



## sossego (Feb 13, 2013)

Dude, hit the mailing lists on this one. Sorry for being real; but, those cats can help you out much better than I can on here, dig?


----------



## aurora (Mar 2, 2013)

Hello
On mailing list someone has really helped a lot to solve it out, but it's still not solved. Here's a suggestion :

> I have a clue on how to achieve a partition structure which GParted
> can detect: http://d1302.hizliresim.com/16/f/k2fd8.jpg

It seems your partition table has not been created with gpart(8).
And probably this did the trick.

As you can see, your APM metadata takes 14 sectors, but when you use
gpart(8), by default it takes 18 sectors.

> How could I remake such a partitioning, how is it done? Thanks.

You can patch your geom_part_apm module:


```
Index: /usr/src/sys/geom/part/g_part_apm.c
===================================================================
--- /usr/src/sys/geom/part/g_part_apm.c    (revision 241375)
+++ /usr/src/sys/geom/part/g_part_apm.c    (working copy)
@@ -101,7 +101,7 @@ static struct g_part_scheme g_part_apm_scheme = {
    g_part_apm_methods,
    sizeof(struct g_part_apm_table),
    .gps_entrysz = sizeof(struct g_part_apm_entry),
-    .gps_minent = 16,
+    .gps_minent = 12,
    .gps_maxent = 4096,
};
G_PART_SCHEME_DECLARE(g_part_apm);
```
Then you can do:
`# 
# mdconfig -s 78140160
# gpart create -s apm  md0
# gpart add -b 64 -t apple-boot -s 2001 md0
# gpart add -t freebsd-ufs -s 5859376 md0
# gpart add -t apple-ufs -s 1953126 md0
# gpart add -t freebsd-ufs -s 1171876 md0
# gpart add -t freebsd-ufs -s 1171876 md0
# gpart add -t freebsd-ufs -s 7812501 md0
# gpart add -t freebsd-ufs -s 1171876 md0
# gpart add -b 19144704 -t apple-boot -s 2048 md0
# gpart add -t apple-ufs -s 15624192 md0
# gpart add -t apple-ufs -s 1953792 md0

# gpart show md0`

```
14  78140146  md0  APM  (37G)
        14        50      - free -  (25k)
        64      2001    1  apple-boot  (1M)
      2065  5859376    2  freebsd-ufs  (2.8G)
  5861441  1953126    3  apple-ufs  (953M)
  7814567  1171876    4  freebsd-ufs  (572M)
  8986443  1171876    5  freebsd-ufs  (572M)
  10158319  7812501    6  freebsd-ufs  (3.7G)
  17970820  1171876    7  freebsd-ufs  (572M)
  19142696      2008      - free -  (1M)
  19144704      2048    8  apple-boot  (1.0M)
  19146752  15624192    9  apple-ufs  (7.5G)
  34770944  1953792  10  apple-ufs  (954M)
  36724736  41415424      - free -  (19G)
```

I could not try this solution because it was hard to patch the  geom_part_apm module and my FreeBSD live CD didn't contain mdconfig command. I think you will agree that this solution suggestion looks really a bit convoluted.

Instead, I have applied the first solution (Dual Booting Debian and FreeBSD on Apple PPC hardware again, because by using that solution, I got it working (only once, though)

Here is the gpart output of the harddisk which didn't work (in the second installation of Debian, the Debian installer cannot detect the harddisk's partitions) 






You see it's got the same structure as the one which is working. Really tricky.

Btw, to visualize the output of the working harddisk I've been talking about so far, here is the Apple boot menu screenshot of it:






You see I 've been able to add even a third OS on it, (Mac OS X as disk0s12) by creating a ~15GB partition. 

The only problem is, I cannot reproduce that harddisk. I guess there's a trick to it.


----------



## sossego (Mar 2, 2013)

I've always seen the solution of:
"Use the disk partitioning tool to create space on your Mac hard drive before installing..."


----------



## aurora (Mar 2, 2013)

By the "disk partitioning tool" you mean which tool, Mac OS X's Disk Utility or any other tool?


----------



## sossego (Mar 3, 2013)

I believe that the OpenBSD tutorial for installation on a MacPPC covers this.http://www.openbsd.org/macppc.html#multiboot You would need to use the disk partitioning tool to create two instances. The first would have space for the Linux distribution and the second for the FreeBSD distribution. 

Please carefully follow the instructions listed on that tutorial and apply them with what you want.


----------



## aurora (Mar 6, 2013)

Thank you for ever continuing interest in my problem. 

I have managed to reproduce the dual-boot harddisk, finally. 

The trick seems to be: Not to use gpart for modifying anything until Linux (Debian or Ubuntu) is installed. FreeBSD can be installed into partitions made by Debian Install (of type Apple UFS), therefore using 

`# gpart modify -i2 -t freebsd-ufs ad0]` was not necessary

Also, using 

`# gpart bootcode -p /dist/boot/boot1.hfs -i1 ad0` is not necessary either. (using the command dd is right, in par with your original tutorial)


----------

