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

  • How to allow SSH root user access in Linux/Debian/Mint/RHEL/Ubuntu/CentOS
  • Ansible Tutorial - Playbook How To Install From Scratch and Deploy LAMP + Wordpress on Remote Server
  • Ceph Install Errors on Proxmox / How To Fix Solution
  • Proxmox Update Error https://enterprise.proxmox.com/debian/pve bullseye InRelease 401 Unauthorized [IP: 144.217.225.162 443]
  • QEMU/KVM How to Hot-add A Virtual Disk .raw/.qcow2 via QEMU Monitor Commands
  • Proxmox How To Enable Ceph Distributed Storage Cluster with OSD and Pools
  • pulseaudio issue on QEMU/KVM guest VM when microphone is replugged/unplugged pulseaudio: pa_threaded_mainloop_lock failed pulseaudio: Reason: Invalid argument
  • Ubuntu Linux Mint - Volume Control Stopped Working
  • Proxmox Services Won't Start Failed to start The Proxmox VE cluster filesystem. Proxmox VE firewall. PVE Status Daemon. Proxmox VE scheduler. PVE Cluster HA Resource Manager Daemon. PVE Local HA Resource Manager Daemon.
  • Proxmox Guide FAQ / Errors / Howto
  • Virtualbox Vbox Issue Cannot Enable Nested Virtualization Button is Grayed/Greyed Out and Unclickable HowTo Solution
  • Virtualbox VBOX Howto Port Forward To Guests
  • Linux Ubuntu Debian Centos Mint - How To Check if Intel VT-x or AMD-V Hardware Virtualization is Enabled?
  • Linux Howto Zip Multiple Files and Directories
  • Windows Cannot Format USB drive Device Media is Write Protected Error Solution
  • Linux Mint 20 cannot install snapd missing solution
  • Virtualbox VBOX How To Install Guest-Utils/GuestUtils so drag and drop and clipboard works Ubuntu Mint Debian Linux
  • How to install Kubernetes with microk8s and deploy apps on Debian/Mint/Ubuntu Linux
  • vi how to delete everything to the end of the line or the rest of the line from the cursor
  • Cisco Howto Configure Console Port/Terminal/Comm Server with Async Cable Setup