How to make an USB Ubuntu installation more compatible with different computers?

I always have a keychain USB-drive with me and noticed a while back that Ubuntu can easily be installed on it. I've successfully used this drive to test other people's hardware for them and copy files from dead Windows installations or just check my own emails in a secure operating system while travelling.

So far, this method has worked very well, but not every single time. Some hardware will recognise the USB-drive, but refuse to boot from it. On others, the system boots, but has serious performance/display issues, which can make it unusable.

I've tried to compile a list of all compatibility options that have helped to increase the rate of a successful boot and operation of this drive, but I am not sure what else could be done to prevent issues or what would be other useful choices in general in this case. So far, I've noted down these points:

  • Use the vanilla Ubuntu ISO, rather than e.g. the slimmer Xubuntu, because Xubuntu in some cases doesn't load a laptop's WiFi drivers correctly while vanilla Ubuntu does.

  • Use a 64-bit ISO (for Europe/North America), because it's more likely to encounter 64-bit processors in these regions today and some newer UEFI-versions will not boot 32-bit Ubuntu systems while they do 64-bit.

  • Reserve some space on the drive to create a swap partition, because some machines may have low RAM (or lower than it's supposed to be) and very slow USB-swap is still better than a complete crash.

  • Enter the nomodeset parameter into /etc/default/grub, because the system will boot with many different GPUs and this should prevent display issues.

As well as two small tips on the side:

  • Some Windows 10 installations will not fully shut down and prevent entering the BIOS/boot menu. If that happens, boot the Windows system first and try either the Restart option instead of a normal shutdown or hold down Shift while pressing Shutdown to circumvent those Windows/UEFI boot-mechanics.

  • Updates take a long time over USB (by Ubuntu's standards), especially on USB 2.0, so I suggest to disable all automatic updates and rather update the system manually when there is enough time/bandwidth available to do so.

Are there other setup options that would be beneficial in this scenario?

Would you suggest other kernel parameters or system configurations that could increase compatibility while not limiting the usage on such a minimal installation?


Solution 1:

Full Install to USB - BIOS/UEFI

Perhaps one computer uses UEFI and the older computer BIOS. If you would like your USB drive to be able to boot from multiple computers, both BIOS and UEFI:

  • Use mkusb to make a Live system on the Installer USB (2GB or larger).

  • Use mkusb to make a Persistent system on the Target 128GB USB using default settings with ~25GB persistence, (remaining NTFS partition is used as Windows accessible data partition).

enter image description here

  • As soon as mkusb finishes, open GParted and delete sdx4, the ISO9660 partition and expand sdx5 into the recovered space, sdx being the device name of the Target drive.

enter image description here

  • Unplug or remove HDD before proceeding further, (optional but recommended, highly recommended in UEFI mode).

  • Boot Installer drive, select Try.

  • Insert Target drive

Start Install Ubuntu...

  • Select Something else.

  • Select sdx5, (on the target drive), and click Change.

enter image description here

  • Select Use as: ext4, Format and Mount point: /.

Don't touch any other partitions (unless adding a /home partition).

  • Select sdx5 as Device for boot loader installation.

  • Complete installation.

  • Copy grub.cfg from sdx5/boot/grub and paste to sdx3/boot/grub, overwriting the existing grub.cfg file.

  • Boot the target drive and run sudo update-grub to add all drives to boot menu.

  • Do not install any propriety drivers, (ie Nvidia), on pre-18.04 installs.

Solution 2:

Multiple Boot for Greater Compatibility.

A second method to make your drive more comparable with a greater number of computers, is to create a drive as suggested above, then divide the expanded partition into parts, (sdb5 in this case).

You can then install Ubuntu on one part and a lighter version(s) of 'buntu on the other(s).

  • Divide sdb5 into as many ext4 partitions as you have OS. Size should be about 8GB each or larger.

  • Boot Live mkusb installer and insert the target drive.

  • At partitioning selected "Something else".

  • Choose sdb5 for /.

  • Install bootloader to sdb5.

  • Leave all other partition's format boxes unchecked.

  • Repeat this with sdb6, sdb7, etc, and the OS's you choose to install.

  • After the last install Cut grub.cfg from sdx6/boot/grub and paste to sdx3/boot/grub, overwriting the existing grub.cfg file.

  • Boot the flash drive and do an update-grub. This will add all the OS to grub.

You can add a few OS ISO's if you wish:

  • Create a folder in the NTFS partition sdb1 named isos.

  • Add a few ISO's.

  • Edit sdb3/boot/grub adding menuentries similar to the following:

    menuentry "xubuntu-18.04.1-desktop-amd64 Partition 6" {
     set isofile="/isos/xubuntu-18.04.1-desktop-amd64.iso"
     set root='(/dev/sda,msdos2)'
     search --no-floppy --fs-uuid --set=root XXXX-XXXX
     loopback loop ($root)$isofile
     linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
     initrd (loop)/casper/initrd.lz
    }
    
  • Substitute your sixth, (seventh and eighth), partition's UUID for XXXX-XXXX

  • vmlinuz may need to be vmlinuz.efi for some versions.

  • Each ISO can have it's own casper-rw and home-rw persistence files if desired, but it starts to get a little more complicated as you need to add the "persistent-path" to each menuentry.