uefi boot usb tutorial

Post tutorials, HOWTO's and other useful resources here.
User avatar
dreadbird
Samurai
Samurai
Posts: 182
Joined: 08 Dec 2024, 04:30
Distribution: porteus5

uefi boot usb tutorial

Post#1 by dreadbird » 01 Jan 2025, 05:29

thought ide post a quick tutorial for getting porteus to boot on a usb drive with uefi bios boot option

in windows open command prompt as administrator

diskpart
list disk
select disk n

convert gpt

clean
create partition efi size=2000

now try to format this to fat32 with windows partition manager or gparted in linux.

then copy porteus EFI boot and porteus folder to your usb drive.

the key is getting the drive as a gpt disk which you should be able to do with diskpart.


The rest of the usb you can format as fat32 or if you go to linux ext4. the reason I used 2000mb is so you can have a working install with modules in porteus up to 2GB. then you can have other modules loaded from somewhere else.

when you boot porteus will boot off the usb. no need to run the install scripts. very easy

User avatar
Ed_P
Contributor
Contributor
Posts: 8954
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

uefi boot usb tutorial

Post#2 by Ed_P » 01 Jan 2025, 07:12


User avatar
dreadbird
Samurai
Samurai
Posts: 182
Joined: 08 Dec 2024, 04:30
Distribution: porteus5

uefi boot usb tutorial

Post#3 by dreadbird » 01 Jan 2025, 09:47

Nice looks like a implementation of the mbr of the drive as well as creating a gpt boot section. yours is a little more cleaner than mine.

I managed to create the efi partition. so what you can do is also make a second partition and use the install porteus on windows or linux script for the second drive. then if youre on csm you can boot off the second partition. otherwise uefi will load your porteus as well.

I did that because I game on windows and it was annoying to switch from csm to secure boot all the time. the anticheat will kick your out if youre on csm.

then if you wanted you can also install grub2 to the efi partition then change the script to point to the first or second drive as well. this is partly why I did it this way I was messing with grub2 and how it works.

pterid
White ninja
White ninja
Posts: 19
Joined: 01 Feb 2025, 20:13
Distribution: Porteus 5.01 Xfce

uefi boot usb tutorial

Post#4 by pterid » 23 Feb 2025, 16:13

Hi dreadbird,

I just want to say a big thanks for this tutorial! It works very robustly on my newer Windows laptop (bought 2022), which has no CSM. My previous attempt using a normal FAT32 partition did not boot at all. It seems that newer machines are getting stricter about the presence of a real EFI-marked partition.

Some notes from my journey:
  • I had a 32GB stick, so I made a 4GB EFI partition. that way, I have room for a larger save.dat file (2 GB).
  • You can boot into Porteus from another device (e.g. CD) and use Porteus Installer to copy the files over, but ignore its outdated plea to install a bootloader - it is not needed!
  • I split the remainder of the stick between an ext4 partition (for modules etc) and a FAT32 partition (for saving files for easy transfer to Windows).
  • The ext4 partition gets mounted on startup as editable only by root for some reason.
  • Theoretically, I think I could put my save.dat file in the ext4 partition, but given the above permissions issue, I don't want the extra complication. It is at least good as a temporary scratch space when I want to enlarge my save.dat file, and a place for optional modules.

User avatar
Ed_P
Contributor
Contributor
Posts: 8954
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

uefi boot usb tutorial

Post#5 by Ed_P » 23 Feb 2025, 19:02

pterid wrote:
23 Feb 2025, 16:13
I made a 4GB EFI partition
1 GB should be more than enough but if your using it for transferring files to Windows 4GB maybe fine.
pterid wrote:
23 Feb 2025, 16:13
I think I could put my save.dat file in the ext4 partition
If /porteus is on the ext4 partition you don't need a save.dat file. Changes are saved in the /porteus/changes folder. And optional modules load fine from all formats, mine are on my NTFS hardrive.

pterid
White ninja
White ninja
Posts: 19
Joined: 01 Feb 2025, 20:13
Distribution: Porteus 5.01 Xfce

uefi boot usb tutorial

Post#6 by pterid » 23 Feb 2025, 20:18

Hi Ed_P, thanks for your reply! I guess we can discuss my case a little bit, I hope it will still be relevant to other readers attracted here by dreadbird's excellent base procedure.
Ed_P wrote:
23 Feb 2025, 19:02
If /porteus is on the ext4 partition you don't need a save.dat file. Changes are saved in the /porteus/changes folder. And optional modules load fine from all formats, mine are on my NTFS hardrive.
I am quite interested in splitting files between the partitions if possible. I'd prefer to keep the EFI partition for its intended purpose, i.e. just boot stuff and not the whole OS. Have you done this yourself and succeeded? If yes, please can you share details of which files you put where, and snippets of any config file edits or scripts needed? (Surely something in the EFI partition must point to the ext4 partition, no?) I have scoured the forums a bit, but not yet found a good report of someone splitting Porteus files in this way. Perhaps we can work together on a nice community-generated tutorial.

User avatar
Ed_P
Contributor
Contributor
Posts: 8954
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

uefi boot usb tutorial

Post#7 by Ed_P » 23 Feb 2025, 22:10

pterid wrote:
23 Feb 2025, 20:18
I have scoured the forums a bit, but not yet found a good report of someone splitting Porteus files in this way.
Have you reviewed the Porteus ISO's USB_INSTALLATION.txt file? :)

Basically: EFI drive (FAT32): EFI/ & boot/, other drive (ext4): porteus/.
And to boot/syslinux/porteus.cfg's APPEND changes=/porteus: add from=/mnt/sd--/ where -- is your drive/partition letter/number. :)

pterid
White ninja
White ninja
Posts: 19
Joined: 01 Feb 2025, 20:13
Distribution: Porteus 5.01 Xfce

uefi boot usb tutorial

Post#8 by pterid » 24 Feb 2025, 00:33

Ed_P wrote:
23 Feb 2025, 22:10
Basically: EFI drive (FAT32): EFI/ & boot/, other drive (ext4): porteus/.
And to boot/syslinux/porteus.cfg's APPEND changes=/porteus: add from=/mnt/sd--/ where -- is your drive/partition letter/number.
Ahhh, thank you, I see! I will try that this week...

The only issue I have is that I do have one machine where the boot stick shows up as sdb, and another where it shows up as sda. So, using the from= cheatcode would reduce the portability of the stick somewhat. But if it's mostly used on one computer, it should be fine.

pterid
White ninja
White ninja
Posts: 19
Joined: 01 Feb 2025, 20:13
Distribution: Porteus 5.01 Xfce

uefi boot usb tutorial

Post#9 by pterid » 24 Feb 2025, 00:43

Ed_P wrote:
23 Feb 2025, 22:10
Basically: EFI drive (FAT32): EFI/ & boot/, other drive (ext4): porteus/.
And to boot/syslinux/porteus.cfg's APPEND changes=/porteus: add from=/mnt/sd--/ where -- is your drive/partition letter/number.
Ahhh, thank you, I see! I will try that this week...

The only issue I have is that I do have one machine where the boot stick shows up as sdb, and another where it shows up as sda. So, using the from= cheatcode would reduce the portability of the stick somewhat. But if it's mostly used on one computer, it should be fine. (And I have deliberately restricted the portability by creating a UEFI-only bootable.)

One question whose answer is not clear from USB_INSTALLATION.txt, nor from cheatcodes.txt:

If I'm referring to the device (from=/dev/sdb2) or the partition root (from=/mnt/sdb2), then should the partition root contain the porteus folder, or contain its contents? e.g. should porteus-v5.0-x86_64.cfg be found at /mnt/sdb2/porteus-v5.0-x86_64.cfg or at /mnt/sdb2/porteus/porteus-v5.0-x86_64.cfg ?

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 4289
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

uefi boot usb tutorial

Post#10 by ncmprhnsbl » 24 Feb 2025, 04:53

pterid wrote:
24 Feb 2025, 00:43
So, using the from= cheatcode would reduce the portability of the stick somewhat.
this is where using UUID: (or to a lesser extent LABEL:) is useful.
eg. from=UUID:STrING-0F-ChARACtERS/path/folder or in your case just from=UUID:STrING-0F-ChARACtERS
to get your unique STrING-0F-ChARACtERS for your drive/partition you can use blkid : (as root)

Code: Select all

blkid /dev/sdb2  (or whatever it's mounted as)
pterid wrote:
24 Feb 2025, 00:43
If I'm referring to the device (from=/dev/sdb2) or the partition root (from=/mnt/sdb2), then should the partition root contain the porteus folder, or contain its contents? e.g. should porteus-v5.0-x86_64.cfg be found at /mnt/sdb2/porteus-v5.0-x86_64.cfg or at /mnt/sdb2/porteus/porteus-v5.0-x86_64.cfg ?
the partition root should contain the porteus folder. ... porteus-v5.0-x86_64.cfg should be found at /mnt/sdb2/porteus/porteus-v5.0-x86_64.cfg
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Ed_P
Contributor
Contributor
Posts: 8954
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

uefi boot usb tutorial

Post#11 by Ed_P » 24 Feb 2025, 06:25

ncmprhnsbl wrote:
24 Feb 2025, 04:53
the partition root should contain the porteus folder. ... porteus-v5.0-x86_64.cfg should be found at /mnt/sdb2/porteus/porteus-v5.0-x86_64.cfg
What if your .cfg file is on /mnt/sda1?

Code: Select all

guest@porteus:/mnt/sda1/porteus$ ls -on
total 112
drwxrwxrwx 2 1000 16384 Aug  8  2024 base/
-rwxrwxrwx 1 1000  1015 Nov 16  2019 make_iso.sh*
drwxrwxrwx 2 1000 16384 Jan 15  2024 modules/
drwxrwxrwx 2 1000 16384 Nov 16  2019 optional/
-rwxrwxrwx 1 1000   681 Nov 16  2019 porteus-v5.0-x86_64.cfg*
-rwxrwxrwx 1 1000   681 Nov 16  2019 porteus-v5.1-x86_64.cfg*
drwxrwxrwx 2 1000 16384 Nov 16  2019 rootcopy/
guest@porteus:/mnt/sda1/porteus$ 
guest@porteus:/mnt/sda1/porteus$ cat porteus-v5.0-x86_64.cfg
### This is the porteus config file.
### You may put cheatcodes here one per line.
### Cheatcodes must start at the beginning of the line (no space before).
### Any line with the "#" character at the start is ignored.
###
### For a list of cheatcodes check /usr/doc/porteus/cheatcodes.txt

### EXAMPLES

## This tells porteus whence to boot
# from=/mnt/sda2/porteus
  :
  :
guest@porteus:/mnt/sda1/porteus$ 
:lol: Those of us with nvme0n1 harddrives.
pterid wrote:
24 Feb 2025, 00:33
I do have one machine where the boot stick shows up as sdb, and another where it shows up as sda.
Yup, that happens. And when it does, before you click on the menu's Graphic Mode or Always Fresh Mode option click on the Tab key and edit the menu's APPEND line.
pterid wrote:
24 Feb 2025, 00:43
I have deliberately restricted the portability by creating a UEFI-only bootable.
:hmmm: And how/why did you do that?

pterid
White ninja
White ninja
Posts: 19
Joined: 01 Feb 2025, 20:13
Distribution: Porteus 5.01 Xfce

uefi boot usb tutorial

Post#12 by pterid » 24 Feb 2025, 21:20

Thank you so much ncmprhnsbl! I now have Porteus on the ext4 partition (and so am rid of the need for save.dat), which I refer to by UUID, so it should work on any UEFI machine. Plus I have my big FAT32 partition for easy file transfer to Windows machines. I think this is just about the optimum Porteus setup for newer hardware. Excellent! I will be giving this one to my mother, who is as sick of Windows' poor performance and spyware as I am. :)

rych
Warlord
Warlord
Posts: 787
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

uefi boot usb tutorial

Post#13 by rych » 25 Feb 2025, 11:12

pterid wrote:
24 Feb 2025, 21:20
which I refer to by UUID
Even if you remove the from= altogether, the /porteus folder will be found automagically (by initrd) on one of your partitions.

Post Reply