Installing Ubuntu on old Mac Mini

Hello, I am a Linux beginner, but not entirely inexperienced. Comfortable with CLI and finding my way around… mostly. I want to run Ubuntu on a 2007 Mac Mini, which I think is possible and it’s almost working!

After a lot of research I made a Desktop 24.04 live persistent USB stick which works. I have rEFInd installed on the Mini and it sees the MacOS (which runs fine) and GRUB on the USB stick. GRUB gives the correct menu and Ubuntu runs from the “Try Linux” selection. I get the desktop and all the rest, so I have a working “live” install.

Added a FAT32 partition for Linux on the Mac HD, and have run the Ubuntu installer from the live desktop several times. During setup it correctly finds the UEFI partition and the Linux partition on the HD. But the install always ends with an error message. When I look at the log (which does not seem to be saved anywhere) it appears the problem is right at the end (screenshot). If I try to boot Linux from the HD at this point I get the GRUB “fallback bootloader” but it comes up with a command line instead of a menu. And the Boot command does not work (says I need to load the kernel first).

I have tried the boot-repair utility a couple times with no improvement. I should note that to make GRUB work at all on the USB or the HD I had to add a file called bootia32.efi to /boot. There is also a file called efi.img which must be in /boot/grub/ on the USB in order for GRUB to boot Ubuntu. I tried putting both of those files in their respective places (I think) on the HD but that has not made GRUB run correctly or allowed Ubuntu to boot.

I have the sense that this might be a problem with GRUB not locating all the parts, or something about partition tables… I have not done a new install of just GRUB, partly because the installer should do it correctly, and partly because I am not sure how to specify the “install device.” When I use /dev/sda1/ (which is the UEFI partition) it says “failed to get canonical path of /cow.” I also tried a couple other ideas which did not work, and I’m at the limit of my understanding. See screenshots of Drives listing.

So it’s time for advice from real Linux users. I’d like to preserve the MacOS on the HD, but I don’t care about the Linux partition, happy to delete and start again. Thank you to anyone who can attempt this one, sorry for the long post!



1 Like

Your 2007 Mac mini has a 32-bit EFI firmware.
The Ubuntu 24.04 desktop ISO you used only carries the 64-bit EFI loader
(grub-efi-amd64). When the installer reaches the install GRUB step it
tries to drop that 64-bit file into the EFI partition, the machine’s firmware
rejects it, and you get the i386-pc/modinfo.sh doesn’t exist … please specify --target or --directory error. The root and swap partitions are written
correctly only the bootloader is missing so you end up at the GRUB rescue
prompt.

All you have to do is install the 32-bit EFI version of GRUB (grub-efi-ia32)
into your EFI partition.


Step-by-step fix

Boot the same USB stick in “Try Ubuntu” mode.

Mount the system you just installed

sudo mount /dev/sda5  /mnt            # your new Ubuntu root
sudo mount /dev/sda1  /mnt/boot/efi   # the 210 MiB EFI system partition
for d in /dev /proc /sys /run; do sudo mount --bind $d /mnt$d; done

Chroot into it

sudo chroot /mnt

Pull in the 32-bit EFI GRUB and signed shim

apt update
apt install grub-efi-ia32 shim-signed

Install GRUB for a 32-bit Mac EFI

grub-install --target=i386-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --removable
update-grub
exit     # leave chroot

--removable also writes /EFI/BOOT/BOOTIA32.EFI, which rEFInd (or the
Mac’s built-in picker) can load even if no NVRAM entry exists.

Clean up and reboot

for d in /run /sys /proc /dev; do sudo umount /mnt$d; done
sudo umount /mnt/boot/efi
sudo umount /mnt
reboot

rEFInd should now show an Ubuntu icon (or you can pick the “legacy” EFI
entry). The system boots straight into your new 24.04 install.


Why the USB stick worked

You manually dropped bootia32.efi on the USB, so the firmware could
launch GRUB in 32-bit mode. The installer, however, only knew about the
64-bit GRUB and failed. Installing grub-efi-ia32 inside the target
filesystem gives the hard drive the same 32-bit loader the USB had.

Once that’s done you don’t need to copy anything else or rebuild partitions;
your Mac mini can dual-boot macOS and Ubuntu happily.

Aha, I was aware that bootia32 had something to do with the old Mac having 32-bit EFI, and I tried putting it into the same place on the HD as it is on the USB, which didn’t work. I guess that’s because the installer had already failed. Or I put it in the wrong place.

One question: The two lines that start with “for d in…” are about mounting and unmounting something. Do I type those in as written? What is “d” ?

Thanks very much for the help, I will try it out tomorrow!

Yestype (or copy-paste) the two for d in … lines exactly as shown.
They are just quick one-line Bash loops.

What they do

for d in /dev /proc /sys /run; do
    sudo mount --bind $d /mnt$d
done
  • Bash takes each item in the list /dev /proc /sys /run and stores it
    temporarily in the variable $d.

  • The command after do runs once for each value of $d.
    So it executes four times, effectively doing:

    sudo mount --bind /dev  /mnt/dev
    sudo mount --bind /proc /mnt/proc
    sudo mount --bind /sys  /mnt/sys
    sudo mount --bind /run  /mnt/run
    

These bind mounts make the live system’s device nodes and process info
visible inside the chroot so grub-install works as if you had booted from
the disk itself.

The unmount loop is the same idea in reverse:

for d in /run /sys /proc /dev; do
    sudo umount /mnt$d
done

(We unmount in the opposite order so nothing is still in use.)

If you prefer, you can run each mount --bind and umount as separate
commands; the loop just saves typing.

Give it a go once those mounts are in place the rest of the commands should
run exactly as written and bring your Mac mini up on the 32-bit GRUB loader.

2 Likes

Thank you for including the explanations, I’m learning a lot along the way. Getting closer on this, but it seems something is funky with the repository:

root@ubuntu:/# apt update
Get:1 file:/cdrom noble InRelease
Ign:1 file:/cdrom noble InRelease
Get:2 file:/cdrom noble Release
Err:2 file:/cdrom noble Release
File not found - /cdrom/dists/noble/Release (2: No such file or directory)
Reading package lists… Done
E: The repository ‘file:/cdrom noble Release’ no longer has a Release file.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Looked at the man page but not sure how to change the security setting. Then tried to install the grub file anyway to see what would happen:

root@ubuntu:/# apt install grub-efi-ia32 shim-signed
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Package grub-efi-ia32 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
However the following packages replace it:
grub-common grub2-common grub-pc grub-efi-amd64

So I downloaded grub-efi-ia32-signed_1+2 12+8_i386(2).deb from a debian ftp site, but not sure if this is the correct file or what to do with it. Sorry this is such a hassle!

The live-USB still has the “cdrom” line in its temporary
/etc/apt/sources.list, so APT is looking only at the install media and
doesn’t see the network archives. Comment that line out and add the normal
Ubuntu mirror, then apt install will find the 32-bit EFI packages.

# 1. Disable the stale cd-rom entry
sudo sed -i 's|^deb cdrom:|# deb cdrom:|' /etc/apt/sources.list

# 2. Add the main Noble mirrors (and universe, which grub-efi-ia32 sits in)
echo 'deb http://archive.ubuntu.com/ubuntu noble main universe'       | sudo tee -a /etc/apt/sources.list
echo 'deb http://archive.ubuntu.com/ubuntu noble-updates main universe' >> /etc/apt/sources.list
echo 'deb http://security.ubuntu.com/ubuntu noble-security main universe' >> /etc/apt/sources.list

# 3. Refresh package lists
sudo apt update

# 4. Now install the 32-bit EFI grub and shim from the official repo
sudo apt install grub-efi-ia32 shim-signed

After that command succeeds, continue with the earlier steps:

grub-install --target=i386-efi --efi-directory=/boot/efi \
             --bootloader-id=ubuntu --removable
update-grub

Unmount the chroot binds, reboot, and the Mac mini should see
BOOTIA32.EFI and load your new Ubuntu install without the rescue prompt.

How much RAM?
Older systems with limited RAM 4GB or less should not use Ubuntu but a lighter weight flavor. Ubuntu may not install or if it does run slowly as it may use swap.

Light weight flavors:
Lubuntu, Xubuntu, Ubuntu MATE, Budgie
Flavors of Ubuntu only come with three years of supported life (five years applies to Ubuntu Desktop, Ubuntu Server but not flavors)

Supposedly Forums are still read only, but I now get too many links?
Older post, if you can get to it.
Ubuntu 15.04 on Mac Mini 2,1 with EFI boot (2007 Intel)

A lot of this is old and does not apply as newer Ubuntu/flavors work better.
https://www.rodsbooks.com/ubuntu-efi/

Hmmm, not there yet…

The sources.list commands did not work from the chroot mount, but they did from the original root (the USB I guess). The first two ran okay, but the ones for archive and security got a “permission denied.”

Tried apt update anyway and it appeared to run okay:

Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
308 packages can be upgraded. Run ‘apt list --upgradable’ to see them.

Then a ton of warnings about things “being configured multiple times” in sources.list, which I’m guessing don’t really matter…?

Tried to install grub-efi-ia32, but got this output:

ubuntu@ubuntu:~$ sudo apt install grub-efi-ia32 shim-signed
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
shim-signed is already the newest version (1.58+15.8-0ubuntu1).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
shim-signed : Depends: grub-efi-amd64-signed (>= 1.191~) but it is not going to be installed or
grub-efi-arm64-signed (>= 1.191~) but it is not installable or
base-files (< 12.3)
Depends: grub-efi-amd64-signed (>= 1.187.2~) but it is not going to be installed or
grub-efi-arm64-signed (>= 1.187.2~) but it is not installable
E: Unable to correct problems, you have held broken packages.

Thanks for your patience, I know how hard it is to do this without sitting in front of the computer and just typing commands! I’ve become a bit lost about whether we’re modifying the USB version or the HD install. Seems like it would need to be the HD install. Or make the mods to the USB and then install again…?

Thanks, Fred. The Mini is 4GB but slow would be okay for my purposes. The USB live runs okay. Ironically it happens to be on a 64GB USB drive! I’m not opposed to using a lite version, but at this point I need to resolve the problem with the GRUB 32-bit bootloader and then see how the HD install works.

We need to edit the installed system’s sources list (inside the chroot)
and then pull in plain grub-efi-ia32 only.
shim-signed drags in 64-bit Secure-Boot files you don’t need on an
old 32-bit Mac and that’s what causes the dependency mess.


Fix the sources list inside the chroot

# still in the live-USB session
sudo nano /mnt/etc/apt/sources.list

Comment-out any line that starts with deb cdrom: and leave something like:

deb http://archive.ubuntu.com/ubuntu noble main universe
deb http://archive.ubuntu.com/ubuntu noble-updates main universe
deb http://security.ubuntu.com/ubuntu noble-security main universe

Save, then (still in chroot):

sudo chroot /mnt
apt update

If you see “308 packages can be upgraded” that’s fine.


Install only the 32-bit EFI GRUB package

apt purge shim-signed  # remove the package that pulls 64-bit grub
apt install grub-efi-ia32

No -signed variant is needed; your Mac’s firmware cannot do Secure Boot
anyway.


Write the bootloader and rebuild the menu

grub-install --target=i386-efi --efi-directory=/boot/efi \
             --bootloader-id=ubuntu --removable
update-grub
exit    # leave chroot

Unmount and reboot

for d in /run /sys /proc /dev; do sudo umount /mnt$d; done
sudo umount /mnt/boot/efi
sudo umount /mnt
sudo reboot

rEFInd (or the Mac’s boot picker) should now show ubuntu and the system
should boot straight into your hard-disk installation without the GRUB rescue
prompt.

If anything still complains, post the exact error from the chroot session,
but usually removing shim-signed and installing grub-efi-ia32 alone clears
the dependency blockage and the 32-bit loader works.

1 Like

I used to own one. That particular machine came with 1gb ram stock.

Nevermind. Didn’t see the OPs post that it’s been upgraded to 4gb.

Ubuntu Mate runs well on that machine with 4gb ram.

It seems like with Linux there’s always “one more thing” to do. It did not want to remove the shim-signed, and it cannot find the grub 32-bit file. Maybe it’s really not in the repository?

root@ubuntu:/# apt update
Hit:1 Index of /ubuntu noble-security InRelease
Hit:2 Index of /ubuntu noble InRelease
Hit:3 Index of /ubuntu noble-updates InRelease
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
238 packages can be upgraded. Run ‘apt list --upgradable’ to see them.

root@ubuntu:/# apt purge shim-signed
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following package was automatically installed and is no longer required:
mokutil
Use ‘sudo apt autoremove’ to remove it.
The following packages will be REMOVED:
shim-signed*
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
shim-signed
0 upgraded, 0 newly installed, 1 to remove and 238 not upgraded.
After this operation, 4,854 kB disk space will be freed.
E: Removing essential system-critical packages is not permitted. This might break the system.

root@ubuntu:/# apt install grub-efi.ia32
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package grub-efi.ia32
E: Couldn’t find any package by glob ‘grub-efi.ia32’

I do not think there is/was a 32 bit signed version. That was before 2012 when Microsoft required signed boot loaders.

I find these as the file names of 32 bit which you need to install. Name before the / with description.

fred@dell5310:~$ apt list *ia32*
efi-shell-ia32/noble-updates,noble-updates 2024.02-2ubuntu0.4 all
grub-efi-ia32-bin/noble-updates 2.12-1ubuntu7.3 amd64
grub-efi-ia32-dbg/nobfred@dell5310:~$ apt list *iafred@dell5310:~$ apt list *ia32*
efi-shell-ia32/noble-updates,noble-updates 2024.02-2ubuntu0.4 all
grub-efi-ia32-bin/noble-updates 2.12-1ubuntu7.3 amd64
grub-efi-ia32-dbg/noble-updates 2.12-1ubuntu7.3 amd64
grub-efi-ia32/noble-updates 2.12-1ubuntu7.3 amd64
ovmf-ia32/noble-updates,noble-updates 2024.02-2ubuntu0.4 all
le-updates 2.12-1ubuntu7.3 amd64
grub-efi-ia32/noble-updates 2.12-1ubuntu7.3 amd64
ovmf-ia32/noble-updates,noble-updates 2024.02-2ubuntu0.4 all

If at ubuntu@ubuntu that is live installer. You need to chroot into install to update, install or repair the installed system as you typically cannot change live installer.

Thanks, Fred. Yes, I’m doing chroot for this, per Mehmet’s instructions. Looking at those file names I think the name I was using was incorrect. I just tried grub-efi-ia32-bin and it may have installed correctly! It’s hard to tell because it reports all kinds of messages that might be unimportant.

Use the exact package names that are in Noble:

apt install grub-efi-ia32 grub-efi-ia32-bin

grub-efi-ia32 is the real 32-bit loader; grub-efi-ia32-bin supplies the
support files. You can leave shim-signed alone removing it is optional
and apt only complains because that meta-package is marked “essential”. Once
the two ia32 packages are installed, run:

grub-install --target=i386-efi --efi-directory=/boot/efi \
             --bootloader-id=ubuntu --removable
update-grub

Exit the chroot, unmount, reboot. rEFInd should now load the 32-bit GRUB on
the hard drive and boot straight into Ubuntu.

Yes, it’s working! I was copying the exact text from your posts, so the file name wasn’t quite right. I didn’t realize until I saw the list that Fred posted.

When it starts I get the penguin in rEFInd, and that goes to the Grub menu. The only weird thing is that if I choose the top option “Ubuntu” or let it auto-start, it hangs. But if I use advanced options and choose “Ubuntu with Linux 6.11.0.17” it boots up.

As long as the running install is good I don’t really care about what happens with Grub, unless it’s a super easy fix. Don’t want to take any more of your time on this!

Many thanks, Mehmet, and thanks Fred!

1 Like