The easiest way to install Lubuntu on any USB pendrive is to boot your Lubuntu Live CD/DVD, enter the live session, and use the Installer icon present on the desktop. Make sure first that your Internet connection is up and running.
After you get to the window with the 3 options for installing Ubuntu/Lubuntu, choose the 3rd one which says Something else. This way you'll be able to access the partition table for both your hard disk and the USB pendrive. Choose the medium where you want to install Lubuntu, which of course has to be the USB device, and after that delete your entire USB partition if you haven't done it already.
Next you should create 2 new partitions on the USB pendrive: the first one will be the root partition formatted as linux ext4 with foreslash / as startup or mounting point, and the second one has to be a small Linux swap partition (around 1-2 GB in size). After you are finished with partitioning the USB select the root partition and press NEXT to start installing Lubuntu on the USB pendrive. DO not leave any free space on your pendrive, be it raw free space or fat32 formatted free space!!!
Most important thing is to choose to install the bootloader on your USB and not on your HDD device. While still facing the partition table for your USB, select from the drop-down menu at the bottom of window to place bootloader on the USB pendrive. Make sure you select the entire USB and not your new root partition for installing the bootloader / grub. This way your new bootable Lubuntu usb pendrive will be 'completely independent of it's host'.
I strongly recommend you download and burn on a CD/DVD Lubuntu 12.04.4 LTS iso image or Lubuntu 13.10 because lots of users have experienced nasty errors when trying to install this new Ubuntu 14.04 and all its derivatives, Lubuntu 14.04 included.
On a last note, to be able to boot from USB you have to either change your BIOS settings to do so or you can just press your default BIOS key for the boot menu (which is usually F12) and select to boot from the USB pendrive. I prefer to press F12 to get to the boot menu because I find it more convenient for me.
There are many ways to do this, but the procedure I recommend, in broad strokes, is this:
- Start with an EFI-based x86-64 (AMD64) computer. Don't bother trying to install in BIOS/CSM/legacy mode, since this will complicate your GRUB installation and configuration, particularly if the target system boots with Secure Boot active.
- Unplug all the hard disks from the computer you'll be using for the installation.
- Plug in the target USB flash drive and an Ubuntu x86-64 (AMD64) installation medium and boot to the latter. Note that you must install an Ubuntu of the same architecture as the target computer's firmware. This is normally AMD64. Do not use the i386 version of Ubuntu.
- Install normally. Use automatic partitioning or set things up manually, as you see fit; but if the latter, be sure to create an EFI System Partition (ESP).
- Once Ubuntu is installed, using any convenient computer, mount the ESP from the USB flash drive,
cd
to its EFI
directory, type sudo cp -r ubuntu BOOT
and then sudo mv BOOT/shimx64.efi BOOT/bootx64.efi
. (Or issue equivalent commands in another OS.) The point here is to install Shim as EFI/BOOT/bootx64.efi
on the ESP of the USB flash drive, while keeping its follow-on grubx64.efi
and grub.cfg
files accessible.
At this point, the USB drive should be bootable on any EFI-based computer of the same architecture as the target system (AMD64 in this example), give or take hardware incompatibility issues.
An important warning: The computer you use for the installation may no longer boot its OS, even after you plug its hard disk back in, because it may have wiped its NVRAM boot variables after you unplugged its hard disk. If the computer was running Windows, it will probably boot to Windows; but if it had been running Ubuntu or some other Linux, you may need to use the efibootmgr
command to create a new boot entry or Boot Repair to completely re-install GRUB. There are ways around this problem, but they're surrounded by a swirl of conditionals -- if the disk is set up this way, then that; if the computer boots in this way, then this other thing. Dealing with these would double or triple the length of the procedure I've just presented. Repairing the broken boot afterwards is likely (but not certain) to be simpler, and is certainly simpler for me to describe. OTOH, there's a chance that this will create a new mess of a problem, so you should be aware of the possibility.
Best Answer
It should be the same as any install to a second drive. And you do want an efi partition on the flash drive and grub installed to that drive.
But when I installed a second Ubuntu to my HDD, it overwrote the efi partition on my SSD. So backup main drive's efi partition. You can then just copy efi partition from main drive to flash drive if it still overwrites. I am sure I did select to install grub to my sdb drive in Something Else install.
Create efi partition with gpt partitioning on flash drive drive first.
Is it still possible to install Ubuntu to an external harddrive with UEFI?
How to use manual partitioning during installation?
"Install alongside" option missing. How do I install Ubuntu beside Windows using "Something Else"?