WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Howto make a legacy bios/uefi dual boot usb stick with grub2  (Read 55664 times)

aus9

  • Guest
Re: Howto make a legacy bios/uefi dual boot usb stick with grub2
« Reply #45 on: October 07, 2023, 05:07:29 AM »
Hi Juanito

Internal server error so have altered  and split post
AND for hecks sake just move to linuxquestions this is a joke the number of times I have an internal server error
My test PC is a new laptop with Windows 11 pre-installed
bios/uefi settings:
- disabled fast boot & secure boot
- unable to disable uefi
- boot order changed to boot usb before emmc
- emmc means my first detected device (usb) gets /dev/sda* formats


1) Your dual bios legacy/uefi has a misleading line in it
Quote
search --no-floppy --fs-uuid --set=root d4432cde-d21a-4d40-b44b-f097ce72cdba

The reason this should be deleted, IMHO is that you are telling grub where to find the balance of
grub's booting files  ie sdc1

But that was decided by your grub-install commands BEFORE you instructed to create grub.cfg
« Last Edit: October 07, 2023, 05:19:47 AM by aus9 »

aus9

  • Guest
Re: Howto make a legacy bios/uefi dual boot usb stick with grub2
« Reply #46 on: October 07, 2023, 05:09:22 AM »
still more internal server errors....I am not angry ?

cd /mnt/sdb2/EFI/
ls
BOOT/          corepure64.gz  vmlinuz64

aus9

  • Guest
Re: Howto make a legacy bios/uefi dual boot usb stick with grub2
« Reply #47 on: October 07, 2023, 05:09:58 AM »
grub.cfg
top section
loadfont unicode
insmod all_video
set gfxmode=800x600
set gfxterm_font=unicode
terminal_output gfxterm
set timeout=5
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue

aus9

  • Guest
Re: Howto make a legacy bios/uefi dual boot usb stick with grub2
« Reply #48 on: October 07, 2023, 05:12:42 AM »
grub.cfg menu section due to you know what forum errors

menuentry "TC64" {
linux /EFI/vmlinuz64 home=sda1 tce=sda1 waitusb=10:sda1 quiet
initrd /EFI/corepure64.gz
}


I accept that you have attempted to do both legacy and uefi, while I am selfishly doing only uefi

I suggest that anyone who has time......delete the line I allude to and reboot and see if you still boot.
It works for me and good luck

aus9

  • Guest
Re: Howto make a legacy bios/uefi dual boot usb stick with grub2
« Reply #49 on: October 07, 2023, 05:19:12 AM »
I made an error in my comments by pm link on tcedir. ignore them please

I now realize that the line that is misleading is pointing to sdc1 when if it ever had a chance to work....it should have pointed to sdc2,
where your grub.cfg lies
« Last Edit: October 07, 2023, 05:23:09 AM by aus9 »

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 718
Re: Howto make a legacy bios/uefi dual boot usb stick with grub2
« Reply #50 on: October 07, 2023, 06:27:24 AM »
When posting code of something like grub config, you can test to use the code button "#".

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1523
Re: Howto make a legacy bios/uefi dual boot usb stick with grub2
« Reply #51 on: February 08, 2024, 10:55:51 AM »
Juanito's excellent instructions (first post of this thread) are the best I could find anywhere on the internet detailing how to set up a usb stick that can boot in both BIOS and UEFI machines. Thank you, Juanito!

I just did two things differently.

1. I used gdisk instead of fdisk
UEFI requires a GPT partition table. fdisk does support GPT, so I don't think it matters much whether you use gdisk or fdisk. With gdisk, I discovered that I didn't have to specifically request a GPT partition table--it automatically uses GPT when creating partitions. Note that if you use gdisk to add partitions to a disk that already has an existing MBR table, the MBR table gets converted to a GPT table (gdisk warns you about this). Fortunately, in my experience using gdisk on multiple disks, this happens without any loss of partitions or data. (You should backup your data before doing this, of course, just to be safe.)

2. I put a BIOS boot partition on the disk:
Code: [Select]
$ sudo gdisk /dev/sdc
...
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048        52430847   25.0 GiB    8300  Linux filesystem
   2        52430848        52432895   1024.0 KiB  EF02  BIOS boot partition
   3        52432896        53481471   512.0 MiB   EF00  EFI system partition

The BIOS boot partition only needs to be 1MiB in size and you do not need to format it or put anything in it. It just needs to be present, otherwise this step from Juanito's instructions results in an error (something about grub-install having no reliable way to install the target):

Code: [Select]
$ sudo grub-install --target=i386-pc --boot-directory=/mnt/sdc3/EFI/BOOT /dev/sdc

So in this partitioning scheme:
* TCL directories (/boot and /tce) go in /dev/sdc1 (same place as in Juanito's instructions)
* You don't have to do anything with /dev/sdc2 other than create it--grub-install takes care of the rest
* The only file you need to manually create in /dev/sdc3 is /dev/sdc3/EFI/BOOT/grub/grub.cfg
« Last Edit: February 08, 2024, 11:26:07 AM by GNUser »