UEFI and Legacy - at the same time?

Post here if you are a new Porteus member and you're looking for some help.
RMorris
White ninja
White ninja
Posts: 8
Joined: 20 Dec 2019, 00:55
Distribution: Chrome

UEFI and Legacy - at the same time?

Post#1 by RMorris » 22 Jul 2021, 23:01

Hello again,

Is it possible to prepare a single USB stick as bootable in BOTH Legacy and UEFI systems.
I would like to prepare a USB stick that will run on machines that are configured differently. Some have their BIOS set to UEFI boot, and some to Legacy.
How do go about setting this up?

Apologies if this has been asked before. The search tool on this forum gives me intermittent results - (http error 500).

Thank you,

Richard.

User avatar
Ed_P
Contributor
Contributor
Posts: 6334
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 4.0 & 5.0rc3 ISOs
Location: Western NY, USA

UEFI and Legacy - at the same time?

Post#2 by Ed_P » 23 Jul 2021, 04:02

RMorris wrote:
22 Jul 2021, 23:01
Is it possible to prepare a single USB stick as bootable in BOTH Legacy and UEFI systems.
Yes. :)

This is how I do it.

1. Format the drive as FAT32.

Code: Select all

Run GParted to partition & format the USB drive with a msdos Partition table.  
  View > Device Information to check Partition Table type.                      
  Use GParted's Device > Create Partition Table if Partition Table shows as GPT. 

Or under Windows use:                                                         
   diskpart          * Run Command Prompt with Admin Rights.                    
   list disk                                                                    
   ....                                                                          
   select disk 1     * Note: disk nbr is the nbr of the USB disk                
   clean                                                                       
   exit
2. Copy all files and folders in the ISO to the formatted USB drive.

3. Run the Porteus-installer for the system you are using.

Added in 14 hours 35 minutes 19 seconds:
BTW

If you are running Porteus on your harddrive and creating the USB system, you can not run the Porteus-installer-for Linux.com if your system is running with the copy2ram cheatcode.

and

If you are running Porteus as a live ISO the files and folders to copy to the USB drive are in the /mnt/isoloop/ folder.

Added in 12 minutes 23 seconds:
If the USB drive is larger than 32 GB create 2 partitions on the drive with the 1st one 32 GB or less. FAT 32 only supports drives 32 GB or less and is required for UEFI support. The 2nd partition, however you format, it will not be accessible by Windows.
Ed

RMorris
White ninja
White ninja
Posts: 8
Joined: 20 Dec 2019, 00:55
Distribution: Chrome

UEFI and Legacy - at the same time?

Post#3 by RMorris » 26 Jul 2021, 09:07

Excellent!
Thank you for your detailed response.
I now have a working USB that boots in Uefi or Legacy Bios computers.
I'm still playing with the "FROM" cheat code but I'm sure I will figure it all out.

Regards,

Richard.

User avatar
Bicephale
Full of knowledge
Full of knowledge
Posts: 100
Joined: 28 Dec 2010, 19:10
Distribution: Live CDs
Location: Quebec/Qc, Canada

UEFI and Legacy - at the same time?

Post#4 by Bicephale » 02 Aug 2021, 01:45

RMorris wrote:
22 Jul 2021, 23:01
Is it possible to prepare a single USB stick as bootable in BOTH Legacy and UEFI systems.
M'yeah, like in do it ONCE so we don't have to multiply one same task multiple times after each new update.
RMorris wrote:
22 Jul 2021, 23:01
I would like to prepare a USB stick that will run on machines that are configured differently.
The 1st distribution to work both on my CherryTrail laptop and i3 table PC was 'Linuxium', then i learned that Fedora and few others could be easily patched bt copying 1 single file found in x86 .ISO image-files while their x64 counterpart lacks it - go figure why. My best results so far were with XUbuntu but i was hoping to compare with porteus, provided i can install HardInfo, for example...
RMorris wrote:
22 Jul 2021, 23:01
How do go about setting this up?
Benefit from 2rd-party GNU FREE software like rEFind, for example. Always keeping in mind that those newbies who need to get seduced were (still are) Windows users to begin with - and this means the CLi vs GUi buttons war is a dead end IMO!
RMorris wrote:
22 Jul 2021, 23:01
Apologies if this has been asked before.
Well something similar was many years ago, back then it was about booting from USB. Last night i checked and verified that the PlOP boot-menu item is dead - didn't even try to find out why. Missing file i guess...

Basically, contributions that once worked are lost after a while. The project evolves but it also shrinks with permanent loss. Too few too late i'm afraid.

Welcome around brave warrior!! :worthy:

User avatar
babam
Shogun
Shogun
Posts: 239
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 4.0 Xfce K5.11.10
Location: Rainy city

UEFI and Legacy - at the same time?

Post#5 by babam » 31 Aug 2021, 16:49

Ed_P wrote:
23 Jul 2021, 18:50
RMorris wrote:
22 Jul 2021, 23:01
Is it possible to prepare a single USB stick as bootable in BOTH Legacy and UEFI systems.
Yes. :)

This is how I do it.

1. Format the drive as FAT32.

Code: Select all

Run GParted to partition & format the USB drive with a msdos Partition table.
Is on UEFI-Only (no CSM) can boot with msdos Partition table (MBR).

Thanks.
Sorry, my English is bad.

User avatar
Ed_P
Contributor
Contributor
Posts: 6334
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 4.0 & 5.0rc3 ISOs
Location: Western NY, USA

UEFI and Legacy - at the same time?

Post#6 by Ed_P » 31 Aug 2021, 17:14

Yes. :) My USB MBR drive boots on my UEFI machine.
Ed

User avatar
babam
Shogun
Shogun
Posts: 239
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 4.0 Xfce K5.11.10
Location: Rainy city

UEFI and Legacy - at the same time?

Post#7 by babam » 31 Aug 2021, 17:31

Ed_P wrote:
31 Aug 2021, 17:14
Yes. :) My USB MBR drive boots on my UEFI machine.
With CSM enabled?
Sorry, my English is bad.

User avatar
Ed_P
Contributor
Contributor
Posts: 6334
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 4.0 & 5.0rc3 ISOs
Location: Western NY, USA

UEFI and Legacy - at the same time?

Post#8 by Ed_P » 31 Aug 2021, 19:32

The only UEFI setting that I've changed is disable Secure Boot. Everything else is as it was when I bought the machine. The USB drive has an EFI folder on the FAT32 formatted drive so no need to boot in BIOS mode.
Ed

User avatar
Bicephale
Full of knowledge
Full of knowledge
Posts: 100
Joined: 28 Dec 2010, 19:10
Distribution: Live CDs
Location: Quebec/Qc, Canada

UEFI and Legacy - at the same time?

Post#9 by Bicephale » 31 Aug 2021, 19:36

Well, i'm trying to get 32 & 64 + MBR & UEFi + BiOS & GPT and whatever else in all permuttable orders, e.g. using only 1 single bootable USB drive. So far i got a feeling that some combinations ain't meant to be supported for some reason; i recall reading about that on the Mageia web site. More recently i toyed with both versions of the Windows appl. called 'YUMi', 1st to create a UEFi-friendly thumbdrive that another program called 'Rufus' will record back as a .VHD which then can be read by yet another tool known as 'UltraISO'... At that point i use the MBR-Legacy YUMi utility to create a new USB thrumbdrive that i will "patch" by dumping non-existing/non-conflicting items of the .VHD image-file. The resulting thumbdrive boots fine on all 3 machines i have handy for testing, using the legacy menu on my i686 and i3 computers, while the CherryTrail laptop would seem ready to proceed if only its configuration file were plugged right. Preliminary attempts suggested i had to set environment variables 1st, but in the end it seemed to me like scripts in the initialization ramdisk may need revision to account such scenarios, perhaps because of a filesystem-related issue. IMO wait long enough and future releases of YUMi/UUi shall happen to provide further hints on how to fix that once and for all, instead of expecting every single player to danse the same tune again and again... Too bad the GrUB option only copies .ISO files as a whole, contrary to the SysLinux alternative that explodes them in specific directories as illustrated in this post of mine:

YUMi est ton ami, et Universal USB Installer aussi!!

User avatar
Ed_P
Contributor
Contributor
Posts: 6334
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 4.0 & 5.0rc3 ISOs
Location: Western NY, USA

UEFI and Legacy - at the same time?

Post#10 by Ed_P » 31 Aug 2021, 20:01

No YUMi needed to boot Porteus USB drives on my systems.

I do use Grub2Win's grub2 on my Windows system primarily to boot ISO files but it can also boot the Porteus USB drives. This is my grub.cfg's menu file for booting Porteus 4.0. The USB menus are near the bottom, a BIOS boot and a EFI boot from the same drive so I can tweak the porteus.cfg files.

Code: Select all

set timeout=30

# Old Acer hdd
# UUID="674C03B2538FFD01"
#    search --fs-uuid --set=root 674C03B2538FFD01
#    linux  (loop)/boot/syslinux/vmlinuz from=$iso $boot_parms root=UUID=674C03B2538FFD01 

# Set the default variable to the submenu entry you prefer
set default=1

     set linux_folder=/porteus4.0
     if [ -f /boot/syslinux/vmlinuz ]; then linux_folder=""; fi
#    LXQT  MATE  OPENBOX  XFCE
     set iso=/ISOs/Porteus-CINNAMON-v4.0-x86_64.iso
#     set iso=/ISOs/Porteus-OPENBOX-v4.0-x86_64.iso
     set extramods="extramod="

menuentry " Porteus 4.0 ISO - changes="       --class slackware   --class icon-porteus  {

     set boot_parms="volume=33 reboot=cold $extramods$linux_folder/Modules noload=cinnamon changes=EXIT:$linux_folder/changes/porteussave.dat"

     search -f $iso --set=root
     loopback loop $iso
     linux  (loop)/boot/syslinux/vmlinuz from=$iso $boot_parms
     initrd (loop)/boot/syslinux/initrd.xz
     }

menuentry " Porteus 4.0 ISO - AF'" --class slackware   --class icon-porteus  {

     set boot_parms="volume=33 reboot=cold $extramods$linux_folder/Modules;$linux_folder/modsavedat noload=save.dat;cinnamon"

     search -f $iso --set=root
     loopback loop $iso
     linux  (loop)/boot/syslinux/vmlinuz from=$iso $boot_parms
     initrd (loop)/boot/syslinux/initrd.xz
     }

menuentry " Porteus 4.0 ISO - AF+" --class slackware   --class icon-porteus  {

     set boot_parms="volume=33 reboot=cold $extramods$linux_folder/Modules noload=cinnamon"

     search -f $iso --set=root
     loopback loop $iso
     linux  (loop)/boot/syslinux/vmlinuz from=$iso $boot_parms
     initrd (loop)/boot/syslinux/initrd.xz
     }

menuentry " Porteus 4.0 ISO - AF" --class slackware   --class icon-porteus  {

     set boot_parms="volume=33 reboot=cold $extramods "

     search -f $iso --set=root
     loopback loop $iso
     linux  (loop)/boot/syslinux/vmlinuz from=$iso $boot_parms 
     initrd (loop)/boot/syslinux/initrd.xz
     }

menuentry " Porteus 4.0 ISO - AF' backup" --class slackware   --class icon-porteus  {

     set boot_parms="volume=33 reboot=cold $extramods$linux_folder/Modules;$linux_folder/modsavedat noload=mychanges;cinnamon"

     search -f $iso --set=root
     loopback loop $iso
     linux  (loop)/boot/syslinux/vmlinuz from=$iso $boot_parms
     initrd (loop)/boot/syslinux/initrd.xz
     }


menuentry " Porteus 4.0 USB - AF'" --class slackware   --class icon-porteus  {

     set porteus_parms="volume=33 reboot=cold extramod=/Modules;/Modsavedat noload=save.dat;cinnamon" # changes=EXIT:/changes/porteussave.dat"

     set bootdrv=$root
     search -f /boot/syslinux/vmlinuz --set=root
     if [ $root != $bootdrv ]; then
        linux  /boot/syslinux/vmlinuz $porteus_parms
        initrd /boot/syslinux/initrd.xz
     else
        echo "----------------------------------------"
        echo USB drive NOT found.
        echo
        sleep -v -i 10
     fi
     set root=$bootdrv
     }

menuentry " Porteus 4.0 USB - EFI" --class slackware   --class icon-porteus  {

     set bootmgr=/EFI/boot/bootx64.efi          #grubx64.efi    # bootx64.efi

     set bootdrv=$root
     search -f $bootmgr --set=root
     if [ $root != $bootdrv ]; then
        chainloader $bootmgr
     else
        echo "----------------------------------------"
        echo USB drive NOT found.
        echo
        sleep -v -i 10
     fi
     set root=$bootdrv
     }

menuentry " Porteus 4.0 USB - syslinux" --class slackware --class icon-porteus {

     set bootmgr=/boot/syslinux/isolinux.bin

     set bootdrv=$root
     search -f $bootmgr --set=root
     if [ $root != $bootdrv ]; then
        syslinux_source $bootmgr
        syslinux_configfile /boot/syslinux/porteus.cfg
     else
        echo "----------------------------------------"
        echo Porteus drive NOT found.
        echo
        sleep -v -i 10
     fi 
     set root=$bootdrv
     }
Ed

User avatar
Bicephale
Full of knowledge
Full of knowledge
Posts: 100
Joined: 28 Dec 2010, 19:10
Distribution: Live CDs
Location: Quebec/Qc, Canada

UEFI and Legacy - at the same time?

Post#11 by Bicephale » 01 Sep 2021, 11:34

Great, i'll save this on removable media so it can prove handy at a later time. :D

Yet i must explain my perspective starting from the end perhaps. It's about being able to run basic tools on a PC or a LapTop/Tablet independently of its partitioning system and/or 32 vs 64 bits CPU; for example 'HardInfo' (or equivalent) as that would seem like a fair starting point in collecting profiles for later comparisons, e.g. eventually enabling us to decide which Linux distribution has an edge, especially on machines with limited resources... IMO just the need to go through multiple hardware-specific flashing sessions alone may happen to alleviate portability qualities shared by Porteus, its Arch Linux variant or even the 2-yrs old Slax maybe, etc. To be honest i'd expect only stuborn Linux-aware individuals will stick around after a while, at least i find difficult to imagine some elder moms flushing Windows before it flushes them, near the end of 2025 that is!

Actually i sort of wonder if sticking to either YUMi/YUMi-UEFi and/or Grub2Win boot layouts has been discussed previously. After all, people of both entities gave such issues quite a great deal of brainstorming already, so i'd spontaneously want to build on their contribution, even if it's 3rd-party. YUMi offers to edit USB thumbdrives without touching unrelated data also present on those but right now the 2 YUMi flavours ain't inter-changeable as i get an error message if i dare try: "Contains a YUMI legacy installation. You'll have to reformat to use UEFI YUI.", while looking at both structures i'd say maybe the long-term plan leaves room for a future merge, someday.

It turns out we're lucky to still have 32 bits alternatives around, though i read it's not going to be compatible with other trends as the Raspberry Pi. Lets simply assume there's a good reason behind that too...

Wouldn't it make sense to benefit from recent kernel developments and keep what's been implemented over the last decade? Most people won't care enough to register and argue, they'll be happy to go with the next popular trend, or continue to run Windows until it finally breaks down - and it's not reliable enough to repair itself as it is, so... Anyway this can feel taxing to the masses i think.

Not to mention the sun has replaced with the moon while i was writing...

Thank you.

User avatar
Ed_P
Contributor
Contributor
Posts: 6334
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 4.0 & 5.0rc3 ISOs
Location: Western NY, USA

UEFI and Legacy - at the same time?

Post#12 by Ed_P » 01 Sep 2021, 23:53

If your YUMi uses grub2 my menu file should work for you in that that is what you're booting. Not YUMi or the OSs but grub2. But since I've never used YUMi I could be wrong. On my Porteus USB drives I boot directly to Porteus not grub2. Grub2 is on my notebook. And my Porteus USB drive boots on BIOS and UEFI systems, no grub2 needed.
Ed

User avatar
Bicephale
Full of knowledge
Full of knowledge
Posts: 100
Joined: 28 Dec 2010, 19:10
Distribution: Live CDs
Location: Quebec/Qc, Canada

UEFI and Legacy - at the same time?

Post#13 by Bicephale » 04 Sep 2021, 20:20

Sorry, i made a few quick tries but this felt much the same as before and 3 days passed in the meantime already.

That still wasn't in vain as i've noticed a SysLinux cfg-related command and a sample of its syntax.

'GrUB2Win' is never going to become a Linux application but i wouldn't mind for inclusive support as well. When tested it just rejected removable media, as i recall. So i went to my next best available option. Ultimately i'd also wish to seek menu inspiration from Mageia, for example, but not only. In addition i was thinking of collecting Porteus/Slax menu/desktop images, but my other hobby monopolized most of my humble resources recently. So it's set to simmer, hoping i may see the light again...

The day i can compile my own prefered packages ain't arrived! :coffee:

User avatar
Ed_P
Contributor
Contributor
Posts: 6334
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 4.0 & 5.0rc3 ISOs
Location: Western NY, USA

UEFI and Legacy - at the same time?

Post#14 by Ed_P » 04 Sep 2021, 21:53

Bicephale wrote:
04 Sep 2021, 20:20
'GrUB2Win' is never going to become a Linux application
That's 100% true. It's designed to install grub2 on Windows and create grub2 menus.
Bicephale wrote:
04 Sep 2021, 20:20
When tested it just rejected removable media,
That is unfortunate. I thought it had added support for USB drives. Write/post on their forum that it should support installing grub2 onto removable drives that boot on BIOS and UEFI systems.

But to be clear Porteus 4.0 can be installed on a FAT2 USB drive that boots on BIOS and UEFI systems without the need for grub2. Porteus 5.0 is going to do the same.

In all cases the USB drive must be formatted as FAT32.

Added in 1 day 1 hour 10 minutes 42 seconds:
BTW Was the flash drive you tried with grub2win formatted as a FAT32 drive? Grub2win doesn't do disk management things, just grub2 things.
Ed

User avatar
Bicephale
Full of knowledge
Full of knowledge
Posts: 100
Joined: 28 Dec 2010, 19:10
Distribution: Live CDs
Location: Quebec/Qc, Canada

UEFI and Legacy - at the same time?

Post#15 by Bicephale » 07 Sep 2021, 18:58

Hummm... As it is the .ISO image-files do not boot indifferently of hardware, that's what i observed and it's also the reason why i had to look closer. Otherwise there are bootloader experiments i might not have performed, for starters because the PC's UEFi boot menu combined to a USB and/or CD should always find my installed Linux(es) anyway... I addition my perspective is that of an early environment capable of collecting detailed specifications for later customization, though i'm not the one who'd want to build around that. But i think at least i should avoid blocking the path to such scenario, because a boot drive that ALWAYS manages to load Linux in RAM will render preliminary hardware scanning so convenient it could lead to on-demand generation of fully-customized .ISOs with drivers compiled to match that material, no matter if it's 32 or 64 bits, BiOS/Legacy or UEFi, CMS or ESP... There goes the alphabet soup again!

Actually, as a visitor coming from the Windows galaxy it's already a trade-off to open the door to alternatives, not to mention i paid for my license. Not to mention it doesn't have to be about me, i'm simply reasoning in global terms and if find there are missed opportunities in having both 32 and 64 bits support still active though not fully valorized, by providing newbies with a i-fits-them all worry-free USB they can trust to prove bootable not matter what. And it turns out the late CLi environment of GrUB v2.05 has significantly improved, to top it all; while i find the bootloaders got to be kept compatible, since some parameter(s) related to syslinux.cfg is provided.

Nonetheless please tell me more about the future of Porteus; e.g. who's in charge of publishing .ISOs, for example!

FAT32, yes. And i also noticed it limited file-size of .ISOs... I'll leave most of the work to people as those of YUMi who have an edge IMO, not meaning i'd want this at the cost of future exclusions.

All this must be planned from the compilation phase i believe, so i suggest the guy in charge makes his .ISO image-files complementary, much the same as a "32-64-efi" archive that was published by another member weeks ago. All i needed to do was to plug it in, so to speak. After all what other Linux flavours are best suite for diskless situations depending on its Copy2RAM feature?!! Ideally i'd imagine having 2 identical USB drives: 1 for the router implementing a server, 1 for the "client" machine that needs to be serviced, whatever.

But it's not only about what i need, i'm trying to see where more global benefit may equally reside. I don't know what the storage limit for a USB drive on my router but i'm sure it's quite huge compared to 1, 2 or even 4 GB drives. Then the matter of my tablet remaining functional without its detachable keyboard will resurface promptly, etc., etc.

I was passing by because i was about to refer back to previous stuff recorded here. In case i'll be more inspired at last, eventually...

It would be a pleasure to share my successes too! :good:

Post Reply