1

I have made a LiveCD using this guide plus additional searches on internet, and I have made a functional system using packages from Ubuntu xenial repositories: it can boot, the system can be used, wireless worked on all notebooks I have tested and it can be installed with Ubiquity (I am impressed).

The problem is: I was able to boot only in BIOS mode. On UEFI mode, nothing appears, not even GRUB rescue, so something is completely wrong.

I have tried to copy the boot and EFI directly from the Ubuntu's ISO, which didn't work. The Ubuntu's ISO has some files, particularly casper/vmlinuz.efi, EFI/BOOT/bootx64.efi and EFI/BOOT/grubx64.efi which, no matter what I do, I was not able to create or find. I've found only vmlinuz, which hasn't the .efi extension, and the other two, I have no idea how to create those files.

To boot the computer in BIOS mode, I am using isolinux, which works. I tried with syslinux to boot on UEFI mode too, but had no success, so I am trying to use GRUB, as is done in the Ubuntu's LiveCD.

What are the required steps to make the LiveCD I have made to boot in UEFI mode, as the Ubuntu one does? I believe I would need to create special files. If yes, how do I create them?

Thank you.

  • 1
    Are you trying to create your own iso file (basically your own linux distro), or are you trying to copy, clone or backup your tweaked Ubuntu system? What I mean is: Do you want to solve exactly the problem you are asking about, or anther problem, and create your own iso file (alias image from scratch) because it is a way to solve that other problem? – sudodus Mar 18 '17 at 5:37
  • I am trying to create my own ISO file. It would have some proprietary software (most prominently Nvidia drivers), because one computer which needs it don't work without them configured since boot time, because the video card overheats in seconds, even with Server version. Additionally, if I learn how to make this ISO boot with UEFI, then any ISO I create will work later. – FurretUber Mar 18 '17 at 14:17
  • I see. I have managed to do what you do in BIOS mode, and I know a few work-arounds, but I have never created an iso file, that can boot in UEFI mode. - One of the work-arounds is to make an installed system, that can boot in both UEFI mode and BIOS mode, and install the software you want (in this case obviously in one computer (that does not get overheated), and then clone it (for example with Clonezilla) or simply move the drive to the cumbersome computer. You could use Ubuntu's OEM feature to give the different cloned copies their own network IDs. – sudodus Mar 18 '17 at 14:38
  • Link: help.ubuntu.com/community/Installation/UEFI-and-BIOS - You can start from one of the compressed image files, or you can 'only' use the link in order to create your own system in a similar way. – sudodus Mar 18 '17 at 14:40
3

Broadly speaking, you need to install an EFI-mode boot loader for Linux on the USB drive you've prepared. This boot loader should be stored as EFI/BOOT/bootx64.efi on the EFI System Partition (ESP), which is a FAT partition on the disk. There's a chance that the disk you've prepared lacks an ESP, so you may need to create it. (Even an ordinary FAT partition is usually sufficient, so if the disk has a FAT partition, you might not need a separate ESP.)

The tricky thing about this is that the boot loader you write to the disk must be properly configured to boot the installation on the disk. GRUB taken from the Ubuntu installation .iso file won't work without changes, because it's configured to boot the Ubuntu installer, not the installation you've created on the USB drive. Thus, you must know enough about the boot loader to know how to configure it, and enough about your installation to know what values to put in the boot loader's configuration file.

Unfortunately, GRUB 2 is a very difficult boot loader to configure; its configuration file format is rather complex, and is usually created by specialized scripts. Even the binary may need to be modified for your specific situation, since the main configuration file (grub.cfg) is normally located on the Ubuntu root (/) or /boot partition, meaning that the binary must be modified for your particular installation.

I've written a page on EFI boot loaders for Linux that covers many alternatives, most of which are easier to configure than GRUB 2. My own rEFInd is likely to be the easiest to set up and configure, since it tries to auto-detect Linux kernels when it starts, and it can usually figure out what options to pass to the kernel to get the system booted. Thus, configuration file changes needed to boot with rEFInd are minimal, and sometimes non-existent.

One big caveat in this is Secure Boot. If you want the computer to boot with Secure Boot active, you must provide either Shim (shimx64.efi) or PreLoader (preloader.efi) as the boot loader (renamed to EFI/BOOT/bootx64.efi), with your follow-on boot loader renamed appropriately for Shim or PreLoader. Furthermore, depending on the boot loader in question, you might need to add keys or hashes to the firmware whenever you boot your disk on a new computer. In this case, it's probably worth going to the hassle of using GRUB 2 on the new computer, since Ubuntu provides all the pieces necessary to get a computer to boot Ubuntu without messing with keys or hashes.

| improve this answer | |
  • Hello Rod, I have read your guide and it was extremely helpful to me. Gladly, I have found why I was being unable to boot using the Ubuntu's files: the commands I was using to create the ISO were BIOS only, because the guide in Ubuntu's wiki is based on Ubuntu 9.04. After I found informations here and here, I corrected the command line, making the ISO bootable both in BIOS and UEFI mode. It works even with Secure Boot enabled. – FurretUber Mar 18 '17 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.