Booting Debian Live USB in UEFI mode.

Share your own howto's etc. Not for support questions!

Booting Debian Live USB in UEFI mode.

Postby Desmond86 » 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.
Last edited by Desmond86 on 2015-08-29 15:40, edited 1 time in total.
Desmond86
 
Posts: 1
Joined: 2015-08-28 17:03

Re: Booting Debian Live USB in UEFI mode.

Postby Head_on_a_Stick » 2015-08-28 21:15

Awesome, thanks for this!
:)
“Controlling complexity is the essence of computer programming."Brian Kernighan

Please read before posting How to report a problem
User avatar
Head_on_a_Stick
 
Posts: 6491
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Booting Debian Live USB in UEFI mode.

Postby tannenba » 2016-08-12 19:41

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?
tannenba
 
Posts: 11
Joined: 2011-11-28 03:48

Re: Booting Debian Live USB in UEFI mode.

Postby josephg » 2016-08-26 12:11

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.
josephg
 
Posts: 82
Joined: 2009-01-03 14:01
Location: surrey england

Re: Booting Debian Live USB in UEFI mode.

Postby tannenba » 2016-08-26 14:08

Not yet..Used a USB boot of Ubuntu which already has UEFI boot. Boots on all my systems.
tannenba
 
Posts: 11
Joined: 2011-11-28 03:48

Re: Booting Debian Live USB in UEFI mode.

Postby tannenba » 2016-08-26 21:12

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
tannenba
 
Posts: 11
Joined: 2011-11-28 03:48

Re: Booting Debian Live USB in UEFI mode.

Postby wordpress » 2016-09-02 17:06

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.
wordpress
 
Posts: 1
Joined: 2016-09-02 16:26

Re: Booting Debian Live USB in UEFI mode.

Postby Dai_trying » 2016-09-19 09:13

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
Dai_trying
 
Posts: 294
Joined: 2016-01-07 12:25

Re: Booting Debian Live USB in UEFI mode.

Postby f.r3d » 2017-01-05 08:58

@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 8.8 Gnome 64bits
LDLC Aurore BB5-I3-8-S1 Slim (Clevo W55xEU)
Intel Core i3-3120M / Intel HD Graphics 4000 / RAM 8 Go / Samsung SSD 840 120Go
User avatar
f.r3d
 
Posts: 30
Joined: 2016-07-28 16:39
Location: France

Re: Booting Debian Live USB in UEFI mode.

Postby Dai_trying » 2017-01-06 08:36

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.
Dai_trying
 
Posts: 294
Joined: 2016-01-07 12:25

Re: Booting Debian Live USB in UEFI mode.

Postby fsmithred » 2017-01-21 23:52

@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.)
fsmithred
 
Posts: 1859
Joined: 2008-01-02 14:52

Re: Booting Debian Live USB in UEFI mode.

Postby stevepusser » 2017-01-23 01:00

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
The MX Linux repositories: Backports galore! If we don't have something, just ask and we'll try--we like challenges. New packages: AzPainter 2.0.6, Pale Moon 27.4.0, Liquorix kernel 4.11-9, mpv 0.25.0, Kodi 17.3, Ksnip 1.3.1, Mesa 13.0.6
User avatar
stevepusser
 
Posts: 8427
Joined: 2009-10-06 05:53

Re: Booting Debian Live USB in UEFI mode.

Postby theteju » 2017-01-27 12:54

I have never used rsync command. Is it okay to use "DD" command to copy iso to the usb?
theteju
 
Posts: 6
Joined: 2017-01-21 15:11

Re: Booting Debian Live USB in UEFI mode.

Postby fsmithred » 2017-02-01 18:23

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.
fsmithred
 
Posts: 1859
Joined: 2008-01-02 14:52


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable