This comprehensive guide walks you through the process of setting up an Ubuntu Desktop 24.04.1 LTS system within VirtualBox on macOS, focusing on the challenges you might encounter when dealing with the EFI (Extensible Firmware Interface) bootloader.
Prerequisites
To follow this guide, you'll need:
- A macOS system with VirtualBox installed
- A stable internet connection
- Ubuntu Desktop 24.04.1 LTS ISO file
Installing VirtualBox and Ubuntu
Before diving into the EFI-related issues, make sure you have VirtualBox installed on your macOS system and that you have created a new Ubuntu virtual machine. If you haven't done this yet, follow the steps outlined in the official VirtualBox documentation:
https://www.virtualbox.org/manual/ch01.html#createvm-ubuntu
Setting Up the EFI Bootloader
When creating a new Ubuntu virtual machine, the VirtualBox installation process automatically creates a VMDK (Virtual Machine Disk) file for the operating system. However, this setup does not include an EFI system partition. To resolve this issue, you'll need to manually create an EFI partition and install the EFI bootloader.
Creating the EFI Partition
First, you need to create an EFI partition within the Ubuntu virtual machine. To do this, follow these steps:
- Start your Ubuntu virtual machine and boot from the ISO file.
- Once you reach the GRUB bootloader, press 'e' to enter the GRUB command-line.
- Navigate to the 'linux' line and add the following parameters at the end:
linux /vmlinuz boot=casper quiet splash --
initrd /initrd.img
set vmlinuz_bootargs="root=UUID= ro quiet splash"
linux16 /vmlinuz-5.13.0-26-generic boot=casper quiet splash --
initrd16 /initrd.img-5.13.0-26-generic
Replace with the UUID of your Ubuntu virtual machine. You can find this value by running the following command in a terminal:
sudo blkid | grep vda
Press 'Enter' to continue.
sudo fdisk /dev/sda
Assuming you're using a single hard drive, 'sda' should be the correct choice. Use the 'n' key to create a new partition and follow the prompts to create a new EFI partition. Set the file system type to 'FAT32' and write the changes to the disk.
Installing the EFI Bootloader
Now that you've created the EFI partition, you need to install the EFI bootloader:
- Install the 'grub-efi' package:
sudo apt-get update
sudo apt-get install grub-efi
sudo grub-install --target=x86_64-efi --boot-directory=/boot/efi
If the EFI bootloader is working correctly, you should be able to boot your Ubuntu system using the EFI partition.
In this guide, we've walked through the process of setting up an Ubuntu Desktop 24.04.1 LTS system within VirtualBox on macOS, focusing on the challenges you might encounter when dealing with the EFI bootloader. By creating an EFI partition and installing the EFI bootloader, you'll be able to boot your Ubuntu virtual machine using the EFI bootloader.
References
For further reading, check out the following resources: