Ubuntu/Debian Linux/Unix Howto Setup Install Syslinux Bootable USB with EFI and MBR from Command Line/CLI Terminal

There aren't too many simple guides that show you how to use commands to setup your USB or other drive as a normal bootable drive where you can easily boot custom kernels or whatever OS you would like.

1. Get the tools we need:

We install "syslinux" for MBR and "syslinux-efi" for EFI and "MBR" as we need a tool that embeds the actual MBR into our USB:

sudo apt install syslinux syslinux-efi mbr

2.) Format the Drive as VFAT/FAT:

This assumes your USB is partitioned and is partition 1 on drive sdj /dev/sdj1

mkfs.vat /dev/sdj1

#you may need to mark the partition as bootable in fdisk by hitting the "b" flag

3.) Install MBR onto the drive

Install the MBR on /dev/sdj

sudo install-mbr /dev/sdj

Now install syslinux to the partition

sudo syslinux -i /dev/sdj1

Download syslinux 6.04

https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/Testing/6.04/syslinux-6.04-pre1.zip

Extract it.

Install the EFI syslinux:

Mount it first:

mount /dev/sdj1 /mnt/sdj1

cd /mnt/sdj1

mkdir -p EFI/BOOT

#copy the EFI32 and EFI64 binaries to EFI/BOOT directory on your USB

BOOTIA32.efi BOOTX64.efi ldlinux.e32 ldlinux.e64

#file locations from .zip file linked above

./efi64/com32/elflink/ldlinux/ldlinux.e64

./efi64/efi/syslinux.efi #rename this to BOOTX64.efi

 

4.) Create your syslinux.cfg:



add this to syslinux.cfg in the root:

 DEFAULT realtechtalk
  SAY Now booting the kernel from realtechtalk.com SYSLINUX...
 LABEL realtechtalk
  KERNEL kernelfs
  APPEND initrd=initrd.img

 #you can  add extra kernel flags after initrd=initrd.img by adding a specify a flag. eg initrd=initrd.img ro quiet nosplash

More from Syslinux Documentation

Congrats you should now have an MBR and EFI compatible Bootable USB!


Tags:

ubuntu, debian, linux, unix, howto, install, syslinux, bootable, usb, efi, mbr, cli, terminalthere, aren, guides, commands, custom, kernels, os, quot, embeds, sudo, apt, format, vfat, assumes, partitioned, partition, sdj, dev, mkfs, vat, cfg, default, booting, kernel, realtechtalk, label, kernelfs, append, targetdev, nvme, initrd, initramfs, tar, gz,

Latest Articles

  • CentOS 7 / 8 cannot boot with with mdadm RAID array solution
  • How To Add Default Gateway in Linux using the ip route command routing
  • Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist Solution for Centos8 yum package install error
  • md mdadm array inactive how to start and activate the RAID array
  • Loaded: masked (Reason: Unit hostapd.service is masked.) Solution in Linux Debian Mint Ubuntu
  • Linux Mint Ubuntu Ubiquity Installer Bug EFI Installed To Wrong Partition Solution
  • Libreoffice Impress How To Change The Color of Links
  • ecryptfs How To Backup / Migrate Linux Mint Ubuntu Debian system ecryptfs properly and restore access
  • i915 nouveau Nvidia GPU not starting lightdm Xorg failing solution for Could not determine valid watermarks for inherited state
  • br0: received packet on bond0 with own address as source address Linux Solution Mint Debian Redhat CentOS bridge bridging
  • Debian Mint Ubuntu Howto Disable Network Manager
  • AMD GPU Xorg Won't Start [3576284.324] (EE) Segmentation fault at address 0x0 [3576284.325] (EE) Fatal server error: [3576284.325] (EE) Caught signal 11 (Segmentation fault). Server aborting
  • symbol 'grub_calloc' not found grub boot error solution / fix
  • /var/log/journal huge/too large solution in Debian Mint Ubuntu Linux Howot Fix
  • Libreoffice Calc Opens CSV Spreadsheet File as Asian Language/Chinese Characters Solution Fix
  • RTL8821AU Setup Configure Wifi Realtek 8821 in Linux Debian Mint Ubuntu Howto
  • How To Tell Which Repository a Package Comes From Debian Mint Ubuntu
  • How To Reload All Kernel Modules And List Required Moduels for Each Device - Linux Mint Debian Ubuntu Troubleshooting
  • Debian Ubuntu Mint How To Change Default Display Manager
  • Ubuntu Mint Debian Howto Execute Command / Script / Program Upon Wakeup From Sleep