0

I am currently trying to install Ubuntu 16.04.1 on a USB Stick using EFI so I have a portable OS to carry around and I have the ability to plug it into the laptop I use, which only has a EFI setting or no EFI at all (not both). I figured it was the same process as a external hard drive so I followed similar steps. However, it will only working on the computer in which I installed it on. I have tried adding the flag to the EFI partition "ef00" using gdisk, installing over a virtual machine, I have tried everything I could find that I can do.

I don't know else I can do this. Please help. Thanks in advance.

  • 2
    Gdisk is a partition tool. For full install to any external device you have to partition in advance with an ESP - efi system partition on external. Then copy /EFI/ubuntu from drive seen as sda to external and copy again to /EFI/Boot on external and rename shimx64.efi to bootx64.efi. You also need to edit fstab with correct UUID for external drives' efi partition (ESP). UEFI only boots /EFI/Boot/bootx64.efi from external drives. ubuntuforums.org/showthread.php?t=2338836 – oldfred May 17 '17 at 23:38
  • It helps if you can remove the internal drive from from computer, where you intend to install Ubuntu to the target USB stick. Then the installer will treat the target USB stick as if it were an internal drive. You can try according to the following links and links from them. askubuntu.com/questions/912254/…, askubuntu.com/questions/912254/…, askubuntu.com/questions/911673/…. Alternative: persistent live drive. – sudodus May 18 '17 at 0:56
  • oldfred, I have tried doing that but it keeps trying to boot from a UUID that isn't there. Is there something I am missing. I have done all the steps you listed in your comment. It just brings me to grub rescue saying "error: no such device" and the UUID of the device that isn't present. – Vencorr May 18 '17 at 1:06
  • sododus, I have tried that aswell. No use. It only wanted to boot from the computer I did it on, but non else. I'd rather have a perfectly running Ubuntu OS on the drive then a persistent live drive either. Sorry. – Vencorr May 18 '17 at 1:27
  • 1
    @sododus It is an HP Pavilion 2013 that I am using. I know how to use the boot menu and such. The problem is that after installation, choosing the usb flash drive will either just put me in a boot loop, or skip it. Using an image file didn't work out well for me at all. I don't know what the problem is. This is a perfectly working USB drive. – Vencorr May 18 '17 at 4:12
1

HP rings a bell

Several HP computers with the same and similar age as your computer do not 'want to' boot via grub, if there is a GUID partition table, when accessed via USB. If there is an MSDOS partition table and the boot partition has a boot flag, it works. (Normally booting via grub should not bother about the partition table or boot flag.) My son and some friends have such computers, and I have tested and verified this behaviour more than once.

You can check the partition table with the following command

sudo parted -ls

Unfortunately dd_text_16.04-UEFI-n-BIOS_2017-05-07_intel-4-pendrive-7.8GB.img.xz has a GUID partition table.

Modell: SanDisk Extreme (scsi)
Disk /dev/sdd: 16,0GB
Sektorstorlek (logisk/fysisk): 512B/512B
Partitionstabell: gpt
Disk Flags: 

Nummer  Början  Slut    Storlek  Filsystem       Namn  Flaggor
 1      1049kB  316MB   315MB    fat32                 startbar, esp
 2      316MB   317MB   1049kB                         bios_grub
 3      317MB   7262MB  6946MB   ext2            root
 4      7262MB  7799MB  537MB    linux-swap(v1)

Test

But I think it will work for you from the following image, dd_Lubuntu_16.04.2_amd64_persist-live_mkusb-12.1.4_7.8GB_msdos-pt.img.xz. It has the correct partition structure to boot also in 'middle-age HP computers'.

Modell: SanDisk Extreme (scsi)
Disk /dev/sdd: 16,0GB
Sektorstorlek (logisk/fysisk): 512B/512B
Partitionstabell: msdos
Disk Flags: 

Nummer  Början  Slut    Storlek  Typ       Filsystem  Flaggor
 3      2097kB  130MB   128MB    primary   fat32      startbar
 4      130MB   1072MB  942MB    primary
 2      1072MB  6443MB  5372MB   extended             lba
 5      1073MB  6443MB  5371MB   logical   ext2
 1      6443MB  7799MB  1356MB   primary   ntfs

In linux you install from compressed image files with mkusb. In Windows you can use Win32 Disk Imager.

Final installation

I remember that you don't want a persistent live system, but if you test it and it works, you can create an MSDOS partition table with the relevant partitions and flags in your USB stick. gparted is a good tool for this purpose.

Then you can install Ubuntu into it with Ubuntu's standard installer. It is easiest, particularly in UEFI mode, if you disconnect (unplug) the internal drive.

Select 'Something else' at the partitioning window of the installer. The target USB stick will be seen as an internal drive, when booted from another USB stick, and the installer will install the EFI boot files into it. (Otherwise the EFI stuff will be written into the internal drive and you have to copy it manually, which is possible but tricky.)

Tweaks

This link describes some tweaks for the installed system.

| improve this answer | |
  • I'm going to use the above question as an updated example for other questions if your answer is accepted. – karel May 18 '17 at 7:11
  • @Vencorr, You are welcome. I'm glad it works for you :-) – sudodus May 18 '17 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.