1

I have a linux installation (full installation not live) in a USB stick. When I set it up it uses BIOS to boot but now I need to change it to UEFI because some newer machines only boot in UEFI. I have read thru many articles like this and this and followed the instructions but still it did not work. This is how my usb looks like using fdisk -l

Disk /dev/sdb: 238.5 GiB, 256087425024 bytes, 500170752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x281a9f52

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1          411648 143362047 142950400  68.2G 83 Linux
/dev/sdb2       143362048 159897599  16535552   7.9G  5 Extended
/dev/sdb3       159897600 500170751 340273152 162.3G  7 HPFS/NTFS/exFAT
/dev/sdb4  *         2048    411647    409600   200M ef EFI (FAT-12/16/32)
/dev/sdb5       143364096 159897599  16533504   7.9G 82 Linux swap / Solaris

where sdb1 is the linux installation, sdb2 & sdb5 is the swap, sdb3 is storage, sdb4 is the EFI partition I created.

I booted from my desktop, inserted my USB stick, then did the following:

$ sudo mount /dev/sdb1 /mnt
$ sudo mkdir -p /mnt/boot/efi
$ sudo mount /dev/sdb4 /mnt/boot/efi
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /proc /mnt/proc
$ sudo mount --bind /sys /mnt/sys
$ sudo mount --bind /run /mnt/run
$ modprobe efivars
$ sudo chroot /mnt
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu-usb --recheck --no-floppy --debug

Grub seems to installed successfully and I got the following output:

BootCurrent: 0001
Timeout: 2 seconds
BootOrder: 0002,0001,001B,001A,0000,0019,0017,0018,001C,0021
Boot0000* Windows Boot Manager
Boot0001* UBUNTU
Boot0010  Setup
Boot0011  Boot Menu
Boot0012  Diagnostic Splash Screen
Boot0013  Lenovo Diagnostics
Boot0014  Startup Interrupt Menu
Boot0015  Rescue and Recovery
Boot0016  MEBx Hot Key
Boot0017* USB CD
Boot0018* USB FDD
Boot0019* ATAPI CD0
Boot001A* ATA HDD0
Boot001B* USB HDD
Boot001C* PCI LAN
Boot001D* IDER BOOT CDROM
Boot001E* IDER BOOT Floppy
Boot001F* ATA HDD
Boot0020* ATAPI CD
Boot0021* PCI LAN
Boot0002* ubuntu-usb
Installation finished. No error reported.

I then unmounted the filesystems and /mnt and reboot with the USB but it did not boot with UEFI. It can still boot on motherboard that supports BIOS but not in those only support UEFI.

  • Maybe the following link can help, Create boot-loading systems for external drives – sudodus Aug 16 '18 at 5:34
  • These are the steps I have already taken. It doesn't work for me. – albertma789 Aug 16 '18 at 5:54
  • 1
    Do you have Secure Boot enabled when trying to boot in UEFI mode? Some systems display an error message when Secure Boot rejects a UEFI bootloader, others just skip it and try the next item in boot order. If you get no error message, that might be the explanation. – telcoM Aug 16 '18 at 6:00
  • nope secure boot is disabled. I tried in a few different machines and none worked. – albertma789 Aug 16 '18 at 6:33
  • Let us hope that you find a tweak that will work, so that your system will work in UEFI mode (as well as in BIOS mode). But probably it is easier to start with a fresh system and make sure that it works, and after that install your favourite application programs and other things to customize your system. The easiest method might be to create a persistent live system with a casper-rw partition. But I can understand that you might prefer an installed system (in your USB drive). – sudodus Aug 16 '18 at 6:41
1

This still uses a DOS partition table which won't work on UEFI only systems for booting purposes. Further strictly it should work on CSM systems but from experience it doesn't always.

Convert your partition table to GPT using the tool gdisk It will convert to GPT automatically and then you can check if it looks right with p.

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.