Wierd problem after doing a triple boot OS-X, UBUNTU 20.04, KALI-LINUX
This answer assumes the following:
- You are using macOS High Sierra or newer.
- The
/etc/fstab
file is setup up correctly for Ubuntu and Kali. More specifically, each/etc/fstab
file has the correct entry for the filesystem stored in the EFI partition. - Grub is installed correctly for Ubuntu and Kali.
Below are steps that can be taken to improve your configuration.
-
Remove from the Mac Startup Manager the existing internal drive icon with the
EFI Boot
label shown below.Use the macOS commands given below.
sudo diskutil mount disk0s1 rm /Volumes/EFI/EFI/BOOT/BOOTX64.EFI diskutil unmount disk0s1
-
Give names and labels to the EFI partitions used by Ubuntu and Kali. Also, make Grub from the Kali installation appear in the Mac Startup Manager. Below are the macOS commands I would use.
sudo diskutil mount disk0s3 diskutil rename disk0s3 EFI2 bless --folder /Volumes/EFI2/EFI/BOOT --label "Ubuntu" diskutil unmount disk0s3 sudo diskutil mount disk0s6 diskutil rename disk0s6 EFI3 mkdir -p /Volumes/EFI3/EFI/BOOT cp /Volumes/EFI3/EFI/kali/grubx64.efi /Volumes/EFI3/EFI/BOOT/bootx64.efi bless --folder /Volumes/EFI3/EFI/BOOT --label "Kali" diskutil unmount disk0s6
-
Add a Kali linux icon to Mac Startup Manager.
Note: This step assumes you have completed the previous step.
Download the file
mac-icns.dmg
from this SourceForge website to yourDownloads
folder. Next, enter the following command to copy the Kali linux icon set (icns) file to your third EFI partition.hdiutil attach ~/Downloads/mac-icns.dmg sudo diskutil mount disk0s6 cp /Volumes/mac-icns/OSX10.11.6/os_kali.icns /Volumes/EFI3/.VolumeIcon.icns diskutil unmount disk0s6 hdiutil detach /Volumes/mac-icns
The next time you boot to the Mac Startup Manager, the following icon should appear.
-
Change the type of the partition containing Kali to the linux filesystem data type.
Boot to either Ubuntu or Kali linux. Open a window to enter commands. Enter the following command to edit the GUID Partition Table (GPT).
sudo gdisk /dev/sda
Enter the following commands into
gdisk
.t 7 8300 w y
Restart the Mac.
-
Configure Grub to be hidden and/or omit other operating systems.
Boot to either Ubuntu or Kali linux. Open a window to enter commands. Enter the following command to edit the
grub
file.sudo nano /etc/default/grub
To remove other operating systems from the Grub menu, add the line
GRUB_DISABLE_OS_PROBER=true
after the line given below.
GRUB_CMDLINE_LINUX=""
To skip the Grub menu, add the line
GRUB_TIMEOUT_STYLE=hidden
after the line given below.
GRUB_DEFAULT=0
Exit the editor and enter the following command to update Grub.
sudo update-grub
Booting Ubuntu from the Mac Startup Manager
Note: This section refers to the files stored in
/dev/sda3
.
When Ubuntu is selected from the Mac Startup Manager, the bootx64.efi
(which is a copy of shimx64.efi
) is booted before grubx64.efi
is booted. This results in Ubuntu being automatically made the default operating system to boot.
Alternative to Booting Grub Using bootx64.efi
Note: This section refers to the files stored in
/dev/sda6
.
One of the above instructions is to copy the grubx64.efi
file to the bootx64.efi
file. If the grubx64.efi
is changed during some future Kali update/upgrade, then this new file will not be copied to bootx64.efi
. One way to avoid this problem would be to replace the bootx64.efi
file with a rEFInd version. This new version would silently boot Grub from the grubx64.efi
file. Below are the steps needed to make the change.
-
Boot to Kali linux.
-
Open a window to enter commands.
-
Enter the following commands to remove any previous versions of rEFInd that may have been downloaded.
cd ~/Downloads rm -rf refind_*_amd64.deb refind
-
Use a web browser to download and save rEFInd to your
Downloads
folder from the following SourceForge website.https://sourceforge.net/projects/refind/
-
Enter the following command to install rEFInd.
cd ~/Downloads dpkg-deb -xv refind_*_amd64.deb refind sudo refind/usr/share/refind-*/refind-install --usedefault /dev/sda6 sudo umount -q /tmp/refind_install rm -rf refind_*_amd64.deb refind cd ~
-
Enter the following command to open
refind.conf
file in thegedit
editor.sudo nano /boot/efi/EFI/BOOT/refind.conf
-
Add the following lines to the end of the
refind.conf
file.menuentry Kali { loader /EFI/kali/grubx64.efi icon /EFI/refind/icons/os_linux.png enabled } scanner manual showtools timeout -1 screensaver -1
-
Exit
nano
and save the changes.
References
Separating EFI partitions of Ubuntu 20.04 and Mac OSX on Macbook Pro
Fully Move Grub to New Partition
Grub2/Setup
A gdisk Walkthrough
The rEFInd Boot Manager
The rEFInd Boot Manager: Installing rEFInd
refind-install
How to extract a .deb file without opening it on Debian or Ubuntu Linux
What is the difference between grubx64 and shimx64?
How To Add Apt Repository In Ubuntu