2

I want to have with me a Fedora Live UEFI boot USB for emergencies, but I do not want to carry two USB drives. So I want a USB drive with two partitions, one for Fedora Live boot, and another for my stuff. I always have had with me a pen drive like this with Fedora Live 26, and now I want one for Fedora 38 (or so).

The problems:

mediawriter, the standard way to write Live USBs in Fedora, only writes to a USB device, not to a partition.

livecd-iso-to-disk would work, but it has a very long standing bug and does not work.

unetbootin works only for legacy boot, not for UEFI. And new Dell computers only boot UEFI. There is an open request for this since 2015...

dd: I tried several times with dd but failed miserably.

Any ideas? There must be an easy way to do this just with dd !!!

############ EDIT #############

Following some of the links posted by @oldfred, I was able to boot UEFI from a pen drive partition with the following receipt:

Fedora USB LIVE to a partition in a pen drive (say, /dev/sda1):

  1. Using gparted or similar, be sure that the first partition of the pen drive is gpt, and has label <YOURLABEL> (this can be changed non-destructively);

  2. Add boot flag to the partition with:

    parted /dev/sda set 1 boot on
    
  3. Mount /dev/sda1 to a <MountPoint> and extract all ISO content to it with, say, 7z:

    7z x <PATH/TO/ISOFILE.iso> -o<MountPoint>
    
  4. Change <MountPoint>/efi/boot/grub.cfg and <MountPoint>/boot/grub2/grub.cfg to reflect the correct device:

    menuentry 'Fedora-KDE-Live 38 EFI' --class fedora --class gnu-linux --class gnu --class os {
       linuxefi /images/pxeboot/vmlinuz root=live:LABEL=<YOURLABEL>  rd.live.image quiet rhgb
       initrdefi /images/pxeboot/initrd.img
    }   
    

Remark. The corresponding entry in the grub menu of the computer can be added by adding to the file /etc/grub.d/40_custom:

menuentry 'Fedora-KDE-Live 38 EFI' --class fedora --class gnu-linux --class gnu --class os {
    search --no-floppy --label <YOURLABEL> --set=root
    linuxefi /images/pxeboot/vmlinuz root=live:LABEL=<YOURLABEL>  rd.live.image quiet rhgb
    initrdefi /images/pxeboot/initrd.img
}

Remark 2. Unfortunately I was unable to boot from the ISO directly when the ISO is in the pen drive. According to this post there is a bug preventing this since Fedora 33.

1 Answer 1

1

Two ways. I just used grub2's loopmount to boot Fedora. I like to have a lot of ISO, several Ubuntu, gparted,Boot-Repair and others in a folder /ISO in a partition on my systems. I add a link to a text file into 40_custom as I never remember to update grub menu, but text file just works.

Other alternative is create a large enough FAT32 partition, move boot,esp flags to it & extract ISO into it. It will boot from /EFI/Boot/bootx64.efi. Move esp,boot flags back to your standard ESP. You can then have your standard grub do a configfile into that FAT32 partition. Grub will not care that is it not ESP anymore, but you can only directly boot it from UEFI with esp flag.

menuentry 'Live Fedora 38 Beta Cinnamon No Secure' {
set isoname='Fedora-WS-Live-38-1-6'
set iso="/ISO/Fedora-Workstation-Live-x86_64-38-1.6.iso"
loopback loop (hd2,5)$iso
linux (loop)/images/pxeboot/vmlinuz rd.live.image verbose root=live:LABEL=${isoname} iso-scan/filename=$iso
initrd (loop)/images/pxeboot/initrd.img
}

Getting path & parameters correctly are usually the biggest issues. My path is /ISO in partition (hd2,5) as seen when no partitions are mounted.

Shows my typical grub entry as configfile to text file in my /ISO folder.

https://askubuntu.com/questions/1380683/how-to-install-ubuntu-based-os-on-internal-hard-drive-without-a-flash-drive-usin

https://www.linuxbabe.com/desktop-linux/boot-from-iso-files-using-grub2-boot-loader

https://help.ubuntu.com/community/Grub2/ISOBoot

https://askubuntu.com/questions/1251729/20-04-booting-iso-from-grub-menu

https://askubuntu.com/questions/395879/how-to-create-uefi-only-bootable-usb-live-media

I blieve because I use a configfile entry to a text file, that the set grub is remembered and that is why the above entry worked. My text file is /ISO/livecdimage.cfg and has the above boot stanza that works to boot Fedora 38 on my NVMe drive which I boot from and is seen as hd2.

menuentry 'Live ISOs in nvme_data drive' {
search --set=root --label nvme_data
configfile /ISO/livecdimage.cfg
}
9
  • Yes, I want to do exactly what you did in your first alternative, but with the ISO in the Pen drive too (say, also in a /ISO/ folder in the root of the first partition of the Pen Drive). I think the only difference would be to simply erase (hd2,5), getting then simply loopback loop $iso in your sample config file. Unfortunately, this is not working for me (I get the menu, but then a single dead underscore in the top-right). I am fighting with the other links you suggested, without luck (yet). Will report back. Thanks!! May 24, 2023 at 0:34
  • Yet, I did not understand what you meant by "move boot,esp flags". May 24, 2023 at 0:36
  • I just tried your first method (40_custom + grub2-mkconfig), and it works fine. But with legacy BIOS boot, not UEFI, and with the file in a hard disk, not in the pen drive... May 24, 2023 at 1:02
  • Flash drive may be hd0,1. My example of hd2,5 was because I plugged in another external drive. My HDD is normally hd0, NVMe drive is hd1 and is where /ISO is. But when I plugged in another drive it became sdb or hd1 and my NVMe drive then was hd2. I sometimes just experiment with hdx numbers. The boot,esp flags must be on ESP. But you can make another FAT32 for temp boot and extract ISO. If using flash drive, just make one large ESP & extract into it. It originally worked with Ubuntu, for a year or two stopped working & now works again. So version may matter. Will be UEFI boot only.
    – oldfred
    May 24, 2023 at 2:37
  • With some early flash drives, I would just install grub (originally BIOS then UEFI) with removable parameter to get /EFI/Boot/bootx64.efi, manually create a grub.cfg in /EFI/ubuntu to boot ISO in another partition. Then with flash drives over 64GB I would do a full install of light weight flavor (so smaller) and still add multiple ISO in another partition. No real difference than my /ISO in my SSD or HDD or my Flash drives.
    – oldfred
    May 24, 2023 at 2:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .