Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Booting Debian Live USB in UEFI mode.

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Locked
Message
Author
Desmond86
Posts: 1
Joined: 2015-08-28 17:03

Booting Debian Live USB in UEFI mode.

#1 Post by Desmond86 »

As you probably know Debian LIVE ISOs is not (U)EFI bootable since there is no EFI bootloader on them.
But you can boot it from the EFI shell instead. You will need a flash drive of at least 1 GB.
  • Download Live ISO: https://www.debian.org/CD/live/
  • Format USB flash drive as FAT32.
  • Extract the ISO to the flash drive.
  • Download UEFI shell: https://svn.code.sf.net/p/edk2/code/tru ... Shell/X64/
  • On the USB drive create a EFI folder and a BOOT sub folder, then copy Shell.efi to EFI\BOOT\Bootx64.efi
  • Using a text editor, create a file called liveboot.nsh on the root of the USB drive and paste the following into the file:
  • Code: Select all

    live\vmlinuz initrd=live\initrd.img append boot=live components
  • Reboot PC and enter the UEFI Boot Menu, usually by pressing F8 or F12.
  • Select the name of your USB flash drive (If you have CSM enanbled in BIOS you will see it twice, but one will have a UEFI: prefix, select that.).
  • When EFI shell has loaded just type liveboot.nsh and press enter, it should then boot Debian.
This works similarly on any distro that has a EFI stub enabled kernel which most distros have, but you will have to figure out location of linux and initrd files and what boot parameters you need, you can find those by looking at grub or isolinux config files.
There is many distros that has no official UEFI support but they work fine in UEFI mode when booted from the EFI shell.
Last edited by Desmond86 on 2015-08-29 15:40, edited 1 time in total.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Booting Debian Live USB in UEFI mode.

#2 Post by Head_on_a_Stick »

Awesome, thanks for this!
:)
deadbang

tannenba
Posts: 14
Joined: 2011-11-28 03:48

Re: Booting Debian Live USB in UEFI mode.

#3 Post by tannenba »

Hello,

I followed this instruction and tried to boot my HP Envy and got "the selected boot image did not authenticate"
I also tried with secure boot off and received the same message. I am going nuts trying to find a live distro to
boot with the efi on to work on damaged laptops, etc, without messing with the bios.

Suggestions?

josephg
Posts: 82
Joined: 2009-01-03 14:01
Location: surrey england

Re: Booting Debian Live USB in UEFI mode.

#4 Post by josephg »

tannenba wrote:I am going nuts trying to find a live distro to boot with the efi on to work on damaged laptops, etc, without messing with the bios.

Suggestions?
have you tried http://sysresccd.org
Last edited by josephg on 2016-08-30 16:41, edited 1 time in total.

tannenba
Posts: 14
Joined: 2011-11-28 03:48

Re: Booting Debian Live USB in UEFI mode.

#5 Post by tannenba »

Not yet..Used a USB boot of Ubuntu which already has UEFI boot. Boots on all my systems.

tannenba
Posts: 14
Joined: 2011-11-28 03:48

Re: Booting Debian Live USB in UEFI mode.

#6 Post by tannenba »

tannenba wrote:Not yet..Used a USB boot of Ubuntu which already has UEFI boot. Boots on all my systems.
Just tried RescueCD and it works fine. Thanks

wordpress
Posts: 1
Joined: 2016-09-02 16:26

Re: Booting Debian Live USB in UEFI mode.

#7 Post by wordpress »

Desmond86 wrote:As you probably know Debian LIVE ISOs is not (U)EFI bootable since there is no EFI bootloader on them.
But you can boot it from the EFI shell instead. You will need a flash drive of at least 1 GB.
  • Download Live ISO: https://www.debian.org/CD/live/
  • Format USB flash drive as FAT32.
  • Extract the ISO to the flash drive.
  • Download UEFI shell: https://svn.code.sf.net/p/edk2/code/trunk/edk2/ShellBinPkg/UefiShell/X64/
  • On the USB drive create a EFI folder and a BOOT sub folder, then copy Shell.efi to EFI\BOOT\Bootx64.efi
  • Using a text editor, create a file called liveboot.nsh on the root of the USB drive and paste the following into the file:
  • Code: Select all

    live\vmlinuz initrd=live\initrd.img append boot=live components
  • Reboot PC and enter the UEFI Boot Menu, usually by pressing F8 or F12.
  • Select the name of your USB flash drive (If you have CSM enanbled in BIOS you will see it twice, but one will have a UEFI: prefix, select that.).
  • When EFI shell has loaded just type liveboot.nsh and press enter, it should then boot Debian.

This works similarly on any distro that has a EFI stub enabled kernel which most distros have, but you will have to figure out location of linux and initrd files and what boot parameters you need, you can find those by looking at grub or isolinux config files.
There is many distros that has no official UEFI support but they work fine in UEFI mode when booted from the EFI shell.
That was very helpful . Thank you for the tuturial, you literally saved me hours of headache.

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Booting Debian Live USB in UEFI mode.

#8 Post by Dai_trying »

Thanks for this great little tutorial, I had to change the name of the startup file to startup.nsh and then it worked as expected, I could not run the file as liveboot.nsh from the command-line as stated it said it was not a command, but it works great and I have tried it with a few different iso's successfully. :D

User avatar
f.r3d
Posts: 75
Joined: 2016-07-28 16:39
Location: France
Has thanked: 4 times

Re: Booting Debian Live USB in UEFI mode.

#9 Post by f.r3d »

@Desmond86

Great tutorial! But what method do you recommend to extract the .iso on the usb drive? Because if you use cp (as is recommended by Debian documentation) you cannot modify the partition that was newly created. I removed the "hidden" flag of the partition thanks to gparted but I cannot create new folders on it (even as root) since the partition has the exact same size as the .iso. Moreover gparted does not recognise the partition as a result that you cannot resize it...
Debian 11 Gnome 64bit
Thinkpad T460
4X Intel Core i7-6600U / 8GB Ram / Intel HD Graphics 520 / 256GB SSD /

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Booting Debian Live USB in UEFI mode.

#10 Post by Dai_trying »

I don't know what is recommended by others, but I used rufus (in win 10) and created it in "iso mode" and not "dd mode" this allowed easy editing of the usb stick.

fsmithred
Posts: 1873
Joined: 2008-01-02 14:52

Re: Booting Debian Live USB in UEFI mode.

#11 Post by fsmithred »

@f.r3d

If you can't delete the partition to create a new fat32 partition, then in gparted, go to Device -> Create partition table, give it a new msdos partition table and then create a fat32 partition. Make it bigger than the iso. Add the boot flag, etc.

To copy the iso to the usb...

Code: Select all

mkdir iso
mount whatever.iso iso/
mkdir usb
mount /dev/sdX1 usb/
rsync -av iso/ usb/
(Make sure to include the trailing slashes on the rsync command)

Then add the other items to the usb. When you're finished, 'umount usb' and 'umount iso'.

Bonus:
If you want to make a multi-boot usb with this method, instead of copying the files to the root of the usb device, create a directory for each OS you want to add, and copy each iso's files to its own directory. Then create a separate script for each. Change the paths in the script to match the actual paths where you put the files. You have to add one option to the boot command - "live-media-path=".

Example: Make a directory called 'debian' on the usb stick and copy the contents of a debian-live iso to that directory:

Code: Select all

rsync -av iso/ usb/debian/
And the contents of debian.nsh would be

Code: Select all

debian\live\vmlinuz initrd=debian\live\initrd.img append boot=live components live-media-path=/debian/live
(Note: I just noticed that I used forward slashes on live-media-path. It works like that. I didn't try it with backslashes on that option. The rest of the boot command has backslases as shown here.)

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Booting Debian Live USB in UEFI mode.

#12 Post by stevepusser »

MX 16 64-bit boots from a USB on a UEFI system, even with secure boot on. You have to disable secure boot in order to get an installed version to start, though.

One of the MX developers is planning to do a respin that focuses on recovery tools: https://forum.mxlinux.org/viewtopic.php?f=94&t=41426
MX Linux packager and developer

theteju
Posts: 7
Joined: 2017-01-21 15:11

Re: Booting Debian Live USB in UEFI mode.

#13 Post by theteju »

I have never used rsync command. Is it okay to use "DD" command to copy iso to the usb?

fsmithred
Posts: 1873
Joined: 2008-01-02 14:52

Re: Booting Debian Live USB in UEFI mode.

#14 Post by fsmithred »

theteju wrote:I have never used rsync command. Is it okay to use "DD" command to copy iso to the usb?
If you are using this method you should NOT use dd to copy the iso to the usb. If you do, you will create a single, read-only partition that acts like a live CD, and you won't be able to copy the other files onto the usb.

If you use rsync as I described, you will be copying the contents of the mounted iso to the usb without disturbing the partition table. You will then be able to add files to that partition, and you will also be able to add other partitions if you left space on the device.

Rombersoft
Posts: 2
Joined: 2020-05-11 17:02

Re: Booting Debian Live USB in UEFI mode.

#15 Post by Rombersoft »

Desmond86 wrote: 2015-08-28 17:46 As you probably know Debian LIVE ISOs is not (U)EFI bootable since there is no EFI bootloader on them.
But you can boot it from the EFI shell instead. You will need a flash drive of at least 1 GB.
  • Download Live ISO: https://www.debian.org/CD/live/
  • Format USB flash drive as FAT32.
  • Extract the ISO to the flash drive.
  • Download UEFI shell: https://svn.code.sf.net/p/edk2/code/tru ... Shell/X64/
  • On the USB drive create a EFI folder and a BOOT sub folder, then copy Shell.efi to EFI\BOOT\Bootx64.efi
  • Using a text editor, create a file called liveboot.nsh on the root of the USB drive and paste the following into the file:
  • Code: Select all

    live\vmlinuz initrd=live\initrd.img append boot=live components
  • Reboot PC and enter the UEFI Boot Menu, usually by pressing F8 or F12.
  • Select the name of your USB flash drive (If you have CSM enanbled in BIOS you will see it twice, but one will have a UEFI: prefix, select that.).
  • When EFI shell has loaded just type liveboot.nsh and press enter, it should then boot Debian.
This works similarly on any distro that has a EFI stub enabled kernel which most distros have, but you will have to figure out location of linux and initrd files and what boot parameters you need, you can find those by looking at grub or isolinux config files.
There is many distros that has no official UEFI support but they work fine in UEFI mode when booted from the EFI shell.
So I did not understood what mean "copy Shell.efi to EFI\BOOT\Bootx64.efi" because I already have /EFI/boot/bootx64.efi. And if I replace existing file I get blank screen when boot from usb.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Booting Debian Live USB in UEFI mode.

#16 Post by p.H »

Information in this thread is outdated. Current Debian live images support UEFI boot and even secure boot.

Rombersoft
Posts: 2
Joined: 2020-05-11 17:02

Re: Booting Debian Live USB in UEFI mode.

#17 Post by Rombersoft »

p.H wrote: 2022-02-20 10:18 Information in this thread is outdated. Current Debian live images support UEFI boot and even secure boot.
I'm not agree with you. I have motherboard MSI H510i PRO Wi-Fi. And Debian 11.2 does not boot after install, Debian Live also does not work on my motherboard. But Lubuntu last version works as installed and as live usb.
I'm disapointed because I liked Debian while not bought this motherboard.
Anybody can help me?

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 461 times

Re: Booting Debian Live USB in UEFI mode.

#18 Post by sunrat »

You possibly have a method error in either creating the live device or in booting. Not really related to this topic as what p.H said is a plain fact. UEFI boot of Debian Live has been supported since Debian 9 (Stretch).
Please start a new thread and detail exactly how you created your live boot usb and exactly how you tried to boot it.

This thread now locked as it's 5 years old, not relevant, and it's in the “Docs, Howtos, Tips & Tricks" section which is not for support questions.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

Locked