Different Ways to Install Syslinux from Archlinux
Recently, I migrated a computer from a 2TB hard disk to a 4TB hard disk, which means I had to switch from DOS partition layout to GPT. However, this PC was not booting with UEFI. On another PC I am booting with UEFI. Which means, I am managing different bootloader scenarios, all with Syslinux. In this post I want to collect my notes to keep an overview over my setups.
I am usually using Arch Linux, which means that in some scenarios
syslinux-install_update
can be used. Arch Linux also has a Wiki page
on Syslinux.
GPT partition table with UEFI
Let’s start with the probably most common scenario nowadays, UEFI with a GPT partition table.
For UEFI you need an EFI System partition, this is a partition type that you
can set with fdisk
or other partitioning programs. Syslinux needs to be
copied into a folder EFI/syslinux
on this disk (to be honest, I am not
sure if it really must be in a EFI
folder or if this is only convention).
If you have mounted your EFI System partition at /boot
you can use
the following commands:
mkdir -p /boot/EFI/syslinux
cp -r /usr/lib/syslinux/efi64/* /boot/EFI/syslinux
Then, you can register the boot loader on UEFI with (assuming /dev/sdXY
here):
efibootmgr --create --disk /dev/sdX --part Y --loader /EFI/syslinux/syslinux.efi --label "Syslinux" --verbose
From here on, you can configure /boot/EFI/syslinux/syslinux.cfg
as usual.
According to the Gentoo wiki the latest added entry gets highest priority, thus on the next boot Syslinux should be automatically started.
Note: Gentoo also specifies that backslashes instead of forward slashes must
be used for --loader
, but the Arch Wiki uses forward slashes.
According to the output of
efibootmgr -v
on my PC they get automatically converted to backslashes.
GPT partition table with BIOS
Let’s assume you have a GPT partition table, but are still using standard BIOS booting.
For this, you need to set a legacy boot flag on the boot partition in your
GPT partition table. This can be done with parted
:
> print # to list partitions and their numbers
> set 1 legacy_boot on # to set legacy_boot on partition number 1
Again, I am assuming that you mounted your partition to /boot
. We can now
copy all Syslinux files over to the partition.
mkdir /boot/syslinux
cp /usr/lib/syslinux/bios/*.c32 /boot/syslinux/
Then, we install Syslinux:
extlinux --install /boot/syslinux
And finally, we need to install the gptmbr.bin
boot loader (assuming
/dev/sdX
is your disk containing the boot partition):
dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/bios/gptmbr.bin of=/dev/sdX
DOS partition table with UEFI
Not sure if I am running this anywhere, but it seems to be the same installation as GPT with UEFI.
DOS partition table with BIOS
In this mode, we can use syslinux-install_update
from Arch. For this,
/boot
must be mounted. Then, execute:
syslinux-install_update -i -a -m