I want to install Ubuntu 16.04 on an ubs-stick and run it on a Destop-PC that has Windows on it. I can't use a live USB because I need to install drivers for the graphic card. So far I have tried lots of things for example I have installed Ubuntu to a USB Stick using a Live DVD. The problem is that the PC has UEFI and secure boot enabled and I can not see and therefor also not select the USB to boot from it.That's all I see in the bios setup.I can not change to legacy mode and I also can't diable secure boot, because I'm afraid the windows will not run anymore and I can't do any harm to it (not my Computer). I did't find any fastboot in the bios but I disabled it in Windows 10. I have also created a live usb with rufus that I can boot from the UEFI. I wanted to install the Ubuntu from there to a second USB but when I run the live USB the Ubuntu doesn't show the hard drive of the PC but just the other USB stick. And on the installation menu there is a warning that other operating systems are installed and they maybe can't start after the installation. So basically I need a way to install Ubuntu on an USB and make it boot in UEFI. Can someone help me or tell me how it's done?
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,
sudo cp -r ubuntu BOOTand 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.efion the ESP of the USB flash drive, while keeping its follow-on
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.