Brief: This tutorial shows the steps for actually installing Ubuntu Linux on an external US drive with the bootloader installed on the USB. It is NOT live USB set up. This USB will work as portable operating system and can be used on any computer system.
Let me recall a few things.
A live USB is used for testing the distribution. It is also used for installing Linux on computer hard disk. Normally, any changes you made to your live distribution is lost and this limits the usage of the live USB.
Several of It’s FOSS readers requested a tutorial on installing Linux on a USB. Not the regular live USB with persistence but the actual Ubuntu installed on a USB disk.
This means having a portable Ubuntu Linux on a USB that you can plug it in to any computer, use it, save your work on the USB like it was an actual hard disk.
The procedure does not seem very different from installing Ubuntu on actual hard disk. And this is where people make mistakes.
Problem with bootloader on UEFI systems
The one major problem with this setup is bootloader installation on UEFI systems. A system can only have one active ESP partition at a time and it causes issues.
While installing Linux, even if you choose the USB as the destination for bootloader, the existing ESP partition is still used for placing the EFI file for the new distribution.
This means that the Linux installed on the external USB will be the last one to update and control the bootloader. This may create several problems like:
This fails the entire idea of having a portable Linux USB, right?
Worry not. I’ll share a neat trick for installing Ubuntu or other Linux distributions on a USB without messing up with the bootloader of the host system and the system on the USB.
Before you start following the tutorial, read it entirely and then go about doing it on your system.
Things to know before installing Linux on a USB
If you have a desktop PC, you may remove the hard disk and that could solve the problem but things will be difficult when it is a laptop. Removing the disk is out of question here.
An easier way out is to remove the ESP flag from the ESP partition before installing Linux on the USB and put it back after installation. This way, you fool the Ubuntu installer into thinking that there is no existing ESP partition and it will create and use a new ESP partition on the USB. The original ESP partition on the hard disk is untouched.
Clever trick, I know. Let me clear a few more doubts and add some suggestions:
About the slower experience with Linux on USB, if your system has a thunderbolt port, I advise getting a thunderbolt SSD. I have a SanDisk SSD and when I used installed Linux on it, the experience was very smooth, almost like the SSD on the system.