In these steps, you will add a simple example configuration file to your USB that enables you to directly boot from an Ubuntu ISO file using the loopback feature. The next steps are optional, but will compliment your efforts.
Then install i386-pc, grub-install -d $PWD -force -no-floppy -target=i386-pc -boot-directory=/mnt/USB/boot /dev/sdx Loopback Boot an Ubuntu ISO from your Grub2 USB (Optional) Then install i386-efi, grub-install -d $PWD -force -removable -no-floppy -target=i386-efi -boot-directory=/mnt/USB/boot -efi-directory=/mnt/USBĪ.
Then install x86_64-efi, grub-install -d $PWD -force -removable -no-floppy -target=x86_64-efi -boot-directory=/mnt/USB/boot -efi-directory=/mnt/USBĢ.) Then to install Grub2 32 bit UEFI i386-efi,Ī.
In addition we’ll include the -force option to allow buggy BIOS systems to detect the USB as a Hard Disk.ġ.) To install Grub2 64 bit UEFI x86_64-efi,Ī. When using this, you must also specify -boot-directory and -efi-directory. This next section covers the Grub2 installation of all three architectures (64bit UEFI, 32bit UEFI, BIOS) to your USB flash drive.Īccording to the Grub manual, removable installs require the -removable option (with the exception of i386-pc). mount /dev/sdx1 /mnt/USB Grub2 USB Flash Drive Installation To do this, type the following (replacing x with your actual USB device). To do this type, fdisk -lĢ.) Note which device belongs to your USB.ģ.) Now, to make a directory to be used for the mount point type, mkdir /mnt/USBĤ.) Then you’ll need to mount your USB device, so that you can install Grub2 on it. configure -target=i386 -with-platform=pc -disable-nls & make Locating and mounting your USB Deviceīefore going any further, you’ll need to find your USB device and then mount it.ġ.) First, you’ll need to find out which dev is your USB. Then to configure and make for BIOS systems. configure -target=i386 -with-platform=efi & makeĤ.) Finally to configure and build for Grub2 BIOSĪ. Then to configure and make Grub2 for 32bit UEFI. configure -target=x86_64 -with-platform=efi & makeģ.) Now to configure and then make for Grub2 32 bit UEFI,Ī. Then to configure and make Grub2 for 64Bit UEFI.
First change to the EFI64 directory, cd EFI64ī. To accomplish this, we will create separate containers for each build.ġ.) First create a separate working container for each platform, mkdir EFI64 EFI32 BIOSĢ.) Next to configure and then build for Grub2 64bit UEFI,Ī. In order to support BIOS or UEFI booting from both 32 and 64 bit platforms, Grub2 must be compiled for each architecture. bootstrap Compiling Grub2 for BIOS and UEFI support on 32/64bit platforms Now change to the grub directory, cd grubĬ. To get the latest Grub2 source code, git clone git:///grub.gitī.
sudo suĢ.) Optional Step: To update before proceeding, type apt update & apt upgradeģ.) To install the required packages, apt install git bison libopts25 libselinux1-dev m4 help2man libopts25-dev flex libfont-freetype-perl automake make autotools-dev autopoint libfreetype6-dev texinfo python autogen autoconf libtool libfuse3-3 unifont gettext binutils pkg-config liblzma5 libdevmapper-devĪ.
How to use Linux to Install Grub2 on USB Get the latest Grub2 Source Code and Bootstrap itįirst we need to install required packages, grab the latest Grub2 source code from the repository, and then bootstrap it.ġ.) To gain admin (root) access, open a terminal ctrl+alt+t, then type the following and press Enter.
Once running from your desktop, insert your Flash Drive. Be aware you will be overwriting any existing bootloader and grub.cfg.īefore proceeding, boot into your Linux desktop (Ubuntu was used here). You can control which GRUB will be updated by using sudo chroot /mnt after mounting sdb1 to mnt.Warning: This Guide assumes you are starting with a Fat32 formatted USB. No, update grub should not delete information from the internal drive. Yes, you can get a GRUB menu from USB drive provided you have a full Ubuntu installation in that USB drive.
Sudo grub-install –boot-directory=/mnt/boot /dev/sdb Partion (assuming sdb1) and specify where the rest of grub goes by sudo mount /dev/sdb1 /mnt Ifįor some reason GRUB is not installed, you can mount the USB boot Then GRUB should be installed at the time of Ubuntu installation. How do I install Ubuntu to a USB key? (without using Startup Disk Creator), If you have a full installation of Ubuntu in a 8GB or larger USB drive, See more at