0

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?

  • What you're asking is really unclear, but I think this will put you in the right direction, if it doesn't help it'll at least give you some clarification so that you can improve your question https://help.ubuntu.com/community/UEFI – Sumeet Deshmukh Apr 20 '17 at 05:25
  • https://askubuntu.com/questions/16988/how-do-i-install-ubuntu-to-a-usb-key-without-using-startup-disk-creator and https://askubuntu.com/questions/421676/run-full-ubuntu-installation-from-uefi-bootable-usb-stick?rq=1 – Ben Creasy Oct 19 '18 at 03:22

1 Answers1

0

There are many ways to do this, but the procedure I recommend, in broad strokes, is this:

  1. 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.
  2. Unplug all the hard disks from the computer you'll be using for the installation.
  3. 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.
  4. 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).
  5. 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.

Rod Smith
  • 44,284
  • 7
  • 63
  • 105
  • Thank you so much for this description!! I will try it in the next days, when I find a suitable computer to try it on. One more question: If I partition manually do I also need to unplug the hard disk. And also with the manual partitioning I know the EFI System Partition, but how does the other partition look? ext4? and what is the mounting point for it and do I set the boot to it? – Jennifer Mack Apr 20 '17 at 20:18
  • The point of removing the hard disk is to eliminate the risk of the installer putting GRUB there, rather than on the USB drive. There are other ways to do this, but they pose their own risks and uncertainties. As for partitioning, there are countless possibilities, including questions on this site about it. See here or here, for instance. For a USB drive, a single ext4 root (/) partition is good. – Rod Smith Apr 21 '17 at 13:46
  • I have tried this today, but I couldn't get it to work. I used a usb with gpt partion table. It has 2 partitions one fat32 with boot flag and one ext4 without a boot flag. In the installation menu I couldn't set a mounting point for the fat32 partition and for the ext4 I set it to (/). For the grub I put it to the fat32 partition, but when I look at the USB after installation I can't see any files in the fat32 partition. Also I do not know how to mount this partition to its EFI directory. I am new to all of this, so I am sorry I need more details on how to set the partitions exactly. – Jennifer Mack Apr 23 '17 at 22:23
  • If you do the install in EFI mode, the ESP should be marked as such in the installer's partition list, and it should mount at /boot/efi automatically, although that's not obvious from the summary list. The fact that it was empty after installation suggests you ran into a problem somewhere, and you'll have to either repeat the process and fix that or manually install a boot loader. My own rEFInd is likely to be easy to install: Download the .zip file, unpack it, and run sudo ./refind-install --usedefault /dev/sdc1 (or whatever the ESP is). – Rod Smith Apr 24 '17 at 14:48
  • There's a bug in the Ubuntu installer which ignores the target partition and forces the bootloader to install to /dev/sda - see https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/704763 – Ben Creasy Oct 24 '18 at 00:28