You are not logged in.

#1 2016-04-08 14:59:02

mxfm
Member
Registered: 2015-10-23
Posts: 163

[SOLVED] Bootable USB UEFI

Hello,

My problem is that I cannot boot from usb UEFI from computers which do not support option to choose EFI loader upon startup. Since I want to boot from machines without pre-installtion, efibootmgr is not helpful. So far all adivice boil down to copy grub loader to other locations, but it does not help.

Currently, I have following structure in EFI partition (all are grubx64.efi copies):
shell.efi
shellx64.efi
shellx64_v1.efi
shellx64_v2.efi
EFI/Boot/bootx64.efi
EFI/Boot/loader.efi
EFI/Boot/Microsoft/Boot/bootmgfw.efi
EFI/Boot/Microsoft/Boot/bootmgr.efi
EFI/Boot/Microsoft/Boot/bootx64.efi
EFI/Boot/grub/grubx64.efi
EFI/Microsoft/Boot/bootmgfw.efi
EFI/Microsoft/Boot/bootmgr.efi
EFI/Microsoft/Boot/bootx64.efi

Partition layout:

Model: StoreJet Transcend (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
1      1049kB  281MB   280MB   fat16        boot  boot, esp
2      281MB   11.6GB  11.3GB  ext4         root
3      11.6GB  16.9GB  5369MB  ext4         home
4      16.9GB  500GB   483GB   ntfs         ntfs  msftdata

Thanks in advance.

Last edited by mxfm (2016-04-11 06:50:16)

Offline

#2 2016-04-08 20:30:21

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,535

Re: [SOLVED] Bootable USB UEFI

You should follow the idea of Arch Iso. In all of the cases MBR (legacy mode) and UEFI can live side by side.

Last edited by TheSaint (2016-04-09 12:33:49)


do it good first, it will be faster than do it twice the saint wink

Offline

#3 2016-04-09 08:17:40

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: [SOLVED] Bootable USB UEFI

TheSaint wrote:

You should follow the idea of Arch Iso. In all of the cases MBR (llegacy mode) and UEFI can live side by side.

Can you be more specific? AFAIK MBR and UEFI cannot coexist. In any way, UEFI should work, so it should be fixed instead of fallbaking to MBR.

Offline

#4 2016-04-09 08:56:40

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,842
Website

Re: [SOLVED] Bootable USB UEFI

mxfm wrote:

AFAIK MBR and UEFI cannot coexist. In any way

You are mistaken.

To use GRUB on a USB stick installation in both UEFI & non-UEFI modes:

# grub-install --target=i386-pc --recheck /dev/sdX
# grub-install --target=x86_64-efi --efi-directory=/boot --removable

This presumes that the ESP is mounted to /boot, replace X with the letter assigned to your USB stick drive.

Last edited by Head_on_a_Stick (2016-04-09 09:07:45)


Jin, Jîyan, Azadî

Offline

#5 2016-04-09 12:49:18

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,535

Re: [SOLVED] Bootable USB UEFI

I haven't proposed grub in specific. Better to get to know more details
About grub, it can share the same files (I think) as long as the ESP is mounted on /boot, for the MBR mode. The only difference is the way the BIOS start to read, either from the sector zero or from a recognized file in ESP.


do it good first, it will be faster than do it twice the saint wink

Offline

#6 2016-04-09 13:00:16

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: [SOLVED] Bootable USB UEFI

Head_on_a_Stick wrote:
mxfm wrote:

AFAIK MBR and UEFI cannot coexist. In any way

You are mistaken.

Let's see.

Head_on_a_Stick wrote:

To use GRUB on a USB stick installation in both UEFI & non-UEFI modes:

# grub-install --target=i386-pc --recheck /dev/sdb

Installing for i386-pc platform.
grub-install: error: cannot open directory `/boot/grub/i386-pc': No such file or directory.

And if I switch grub package to i686 version, it will complain about missing libraries (32 bit versions I guess).

Head_on_a_Stick wrote:
# grub-install --target=x86_64-efi --efi-directory=/boot --removable

This presumes that the ESP is mounted to /boot, replace X with the letter assigned to your USB stick drive.

grub-install: warning: disk does not exist, so falling back to partition device /dev/sdb1.
grub-install: warning: disk does not exist, so falling back to partition device /dev/sdb1.
grub-install: warning: disk does not exist, so falling back to partition device /dev/sdb1.
grub-install: error: disk `hostdisk//dev/sdb1' not found.

Offline

#7 2016-04-09 13:08:49

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,842
Website

Re: [SOLVED] Bootable USB UEFI

mxfm wrote:

Let's see

Please provide a detailed explanation of all the steps you have taken before running my posted commands.

Start with how you brned the ISO image to the installation media and provide the *exact* steps taken and commands used.

Those commands work just fine on my system:

empty@Arch ~ % sudo grub-install --recheck --target=i386-pc /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
empty@Arch ~ % sudo grub-install --target=x86_64-efi --efi-directory=/boot --removable
Installing for x86_64-efi platform.
Installation finished. No error reported.

Jin, Jîyan, Azadî

Offline

#8 2016-04-09 13:11:47

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,842
Website

Re: [SOLVED] Bootable USB UEFI

mxfm wrote:

And if I switch grub package to i686 version, it will complain about missing libraries (32 bit versions I guess).

What does this mean?

The "target=i386-pc" bit specifies the non-UEFI version of GRUB, it has nothing to do with the system architecture.


Jin, Jîyan, Azadî

Offline

#9 2016-04-09 13:27:40

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: [SOLVED] Bootable USB UEFI

Head_on_a_Stick wrote:

Please provide a detailed explanation of all the steps you have taken before running my posted commands.

Start with how you brned the ISO image to the installation media and provide the *exact* steps taken and commands used.

Those commands work just fine on my system:

empty@Arch ~ % sudo grub-install --recheck --target=i386-pc /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
empty@Arch ~ % sudo grub-install --target=x86_64-efi --efi-directory=/boot --removable
Installing for x86_64-efi platform.
Installation finished. No error reported.

Eh, forgot about sudo. Please ignore previous post. I have external USB disk (no ISO image, it is completely irrelevant here) with installed Arch in /dev/sdb2. In /dev/sdb1 I have EFI partition mounted as /boot. Full partition information was provided in the first message.

The problem is follows. I can boot from external USB disk at my computer, but cannot boot from other computers. Installing loader through efibootmgr is not an option, because it requires 'pre-installation', but I want to boot from USB disk 'on fly', like it is the case with MBR. In this thread I receive advice to install both MBR and UEFI grub loaders (although I don't quite understand how installing MBR loder will help to fix UEFI loader...)

Regarding the commands. After trying to install i386 I have:

Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.

Regarding installing for x86_64-efi - I have successfull installation (just like when I install Arch on my computer). I did not consider --removable option when was installing Arch. I will try to boot from other computers and will see whether this option helps.

Offline

#10 2016-04-09 14:05:17

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,842
Website

Re: [SOLVED] Bootable USB UEFI

mxfm wrote:

[I can boot from external USB disk at my computer, but cannot boot from other computers. Installing loader through efibootmgr is not an option, because it requires 'pre-installation', but I want to boot from USB disk 'on fly', like it is the case with MBR.

The "--removable" flag copies the GRUB bootloader to the default .efi loader location at $ESP/EFI/BOOT/BOOTX64.EFI -- this will boot without an NVRAM entry.

mxfm wrote:

In this thread I receive advice to install both MBR and UEFI grub loaders (although I don't quite understand how installing MBR loder will help to fix UEFI loader...)

I gave that advice because in the OP you claimed:

I cannot boot from usb UEFI from computers which do not support option to choose EFI loader upon startup

This is somewhat ambiguous and I decided that you might have meant that the machines in question did not support UEFI booting.

mxfm wrote:

Regarding the commands. After trying to install i386 I have:

Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.

I think you have specified a partition number with that command -- you should just use the drive letter.

Always post the *exact* commands you have used along with any output.


Jin, Jîyan, Azadî

Offline

#11 2016-04-09 14:23:40

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: [SOLVED] Bootable USB UEFI

Head_on_a_Stick wrote:

The "--removable" flag copies the GRUB bootloader to the default .efi loader location at $ESP/EFI/BOOT/BOOTX64.EFI -- this will boot without an NVRAM entry.

The file existed before I applied --removable flag, it didn't help. Is EFI naming case sensitive?

Head_on_a_Stick wrote:

This is somewhat ambiguous and I decided that you might have meant that the machines in question did not support UEFI booting.

OK, I see.

Head_on_a_Stick wrote:

I think you have specified a partition number with that command -- you should just use the drive letter. Always post the *exact* commands you have used along with any output.

OK

sudo grub-install --recheck --target=i386-pc /dev/sdb
Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists. 

Actually I am not suprised that this is not working because the disk is labelled as gpt...

Offline

#12 2016-04-09 16:23:50

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,842
Website

Re: [SOLVED] Bootable USB UEFI

mxfm wrote:

Is EFI naming case sensitive?

No, the FAT filesystem used by the ESP is case-insensitive.

Try changing the boot order for attached devices from the firmware ("BIOS") options in the target machines.

Be aware that some firmwares will boot $ESP/EFI/Microsoft/Boot/bootmgfw.efi in preference to the BOOTX64.EFI variant.

mxfm wrote:
sudo grub-install --recheck --target=i386-pc /dev/sdb
Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists. 

Actually I am not suprised that this is not working because the disk is labelled as gpt...

You need to create a BIOS boot partition to hold GRUB's core.img when booting in non-UEFI mode.

This can be created in sectors 34-2047 (these will be empty in an optimally aligned disk) and will be type "EF02" in gdisk; it should *not* have a filesystem.


Jin, Jîyan, Azadî

Offline

#13 2016-04-09 17:41:19

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: [SOLVED] Bootable USB UEFI

Head_on_a_Stick wrote:

No, the FAT filesystem used by the ESP is case-insensitive.

Try changing the boot order for attached devices from the firmware ("BIOS") options in the target machines.

Be aware that some firmwares will boot $ESP/EFI/Microsoft/Boot/bootmgfw.efi in preference to the BOOTX64.EFI variant.

The problem is that BIOS does not detect UEFI loaders. I also placed grub loader to that place (I have written this in the first message), nothing helped.

Head_on_a_Stick wrote:

You need to create a BIOS boot partition to hold GRUB's core.img when booting in non-UEFI mode.

This can be created in sectors 34-2047 (these will be empty in an optimally aligned disk) and will be type "EF02" in gdisk; it should *not* have a filesystem.

Thanks for the suggestion, will try.

Offline

#14 2016-04-10 08:21:43

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: [SOLVED] Bootable USB UEFI

Head_on_a_Stick wrote:

You need to create a BIOS boot partition to hold GRUB's core.img when booting in non-UEFI mode.

This can be created in sectors 34-2047 (these will be empty in an optimally aligned disk) and will be type "EF02" in gdisk; it should *not* have a filesystem.

Well, it worked, thanks. However, booting in UEFI mode on second computer still not works. Will try on others.

Offline

#15 2016-04-11 06:51:02

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: [SOLVED] Bootable USB UEFI

Thanks for the suggestions, booting from UEFI and MBR works.

Offline

Board footer

Powered by FluxBB