I am not asking how to boot the LiveCD from a USB.
I have 2 Ubuntu installations, one on my computer's internal hard drive and another on a USB drive.
Is there a way to add a GRUB2 menu entry (to the GRUB on my internal hard drive) to boot the Ubuntu OS which I have installed to the USB flash drive and have this same menu entry still work after I've upgraded the Linux kernel on the USB installation?
Each time you upgrade kernel on external, you can run this to update boot stanza in grub on the internal drive.
But you can also add a boot stanza to grub2's 40_custom that boots the partition, not the specific kernel. Ubuntu installs links in / (root) to boot the most recent install. Adjust example below if necessary to your drive & partition. Boot drive with grub is always hd0, but then other drives are in BIOS reported order which may vary.
Edit with:
then, add:
Update: older installs put links in /, but newer ones now use /boot. Changed example to show /boot
While above works, I find the drive may change when plugging in a flash drive or any other USB device. So I am converting to use labels.
I found out how to use the UUID of the drive, useful if you have multiple drives plugged in at boot time. Credits to oldfred for his note about
/vmlinux
and/initrd.img
symlinks.Add this to the file
/etc/grub.d/40_custom
, replacingUUID=XXXX-YYYY
with the partition UUID (get UUID with commandblkid
)To boot from Ubuntu Live USB menu entry in
/etc/grub.d/40_custom
should look like that (ReplaceDRIVE_UUID
with your partition's uuid):To apply changes run: