The Syslinux configuration file, {{ic|syslinux.cfg}}, should be created in the same directory where you installed Syslinux. In our case, {{ic|/boot/syslinux/}}.

+

The Syslinux configuration file, {{ic|syslinux.cfg}}, should be created in the same directory where you installed Syslinux. In our case, {{ic|/boot/syslinux/}} for BIOS systems and {{ic|/$esp/EFI/syslinux/}} for UEFI systems.

The bootloader will look for either {{ic|syslinux.cfg}} (preferred) or {{ic|extlinux.conf}}

The bootloader will look for either {{ic|syslinux.cfg}} (preferred) or {{ic|extlinux.conf}}

Revision as of 18:55, 11 January 2014

Syslinux is a collection of boot loaders capable of booting from hard drives, CDs, and over the network via PXE. It supports the FAT, ext2, ext3, ext4, and Btrfs file systems.

Note:

Syslinux (as of version 6.02, in both BIOS and UEFI) cannot access files from partitions other than its own (unlike GRUB). This feature (called multi-fs) is yet to be implemented upstream. If you want to help with the multi-fs feature, contact upstream.

If you are upgrading from Syslinux 4.xx (or 5.xx) to 6.xx version, please re-install (not update) Syslinux BIOS manually (not using the install script) once by following #Manual install. The install script may not properly upgrade Syslinux to 6.xx version.

BIOS Systems

Syslinux boot process

Stage 1 : Part 1 - Load MBR - At boot, the BIOS loads the 440 byte MBR boot code at the start of the disk (/usr/lib/syslinux/bios/mbr.bin or /usr/lib/syslinux/bios/gptmbr.bin).

Stage 1 : Part 2 - Search active partition. The Stage 1 MBR boot code looks for the partition that is marked as active (boot flag in MBR disks). Let us assume this is the /boot partition for example.

Stage 2 : Part 1 - Execute volume boot record - The Stage 1 MBR boot code executes the Volume Boot Record (VBR) of the /boot partition. In the case of syslinux, the VBR boot code is the starting sector of /boot/syslinux/ldlinux.sys which created by extlinux --install command. Note ldlinux.sys is not same as ldlinux.c32.

Stage 2 : Part 2 - Execute /boot/syslinux/ldlinux.sys - The VBR will load rest of /boot/syslinux/ldlinux.sys. The sector location of /boot/syslinux/ldlinux.sys should not change, otherwise syslinux will not boot.

Note: In the case of Btrfs, the above method will not work since files move around resulting in changing of the sector location of ldlinux.sys. Therefore, in BTRFS the entire ldlinux.sys code is embedded in the 64 KB space following the VBR and is not installed at /boot/syslinux/ldlinux.sys unlike the case of other filesystems.

Stage 3 - Load /boot/syslinux/ldlinux.c32 - The /boot/syslinux/ldlinux.sys will load the /boot/syslinux/ldlinux.c32 (core module) that contains the rest of core part of syslinux that could not be fit into ldlinux.sys (due to file-size constraints). The ldlinux.c32 should be present in every syslinux/extlinux installation and should match the version of ldlinux.sys installed in the partition. Otherwise syslinux will fail to boot. See http://bugzilla.syslinux.org/show_bug.cgi?id=7 for more info.

Stage 4 - Search and Load configuration file - Once Syslinux is fully loaded, it looks for /boot/syslinux/syslinux.cfg (or /boot/syslinux/extlinux.conf in some cases) and loads it if it is found. If no configuration file is found, you will be dropped to a syslinux boot: prompt. This step and rest of non-core part of syslinux (/boot/syslinux/*.c32 modules, excluding lib*.c32 and ldlinux.c32) require /boot/syslinux/lib*.c32 (library) modules to be present (http://www.syslinux.org/wiki/index.php/Common_Problems#ELF). The lib*.c32 library modules and non-core *.c32 modules should match the version of ldlinux.sys installed in the partition.

Automatic Install

Note: The syslinux-install_update script is Arch specific, and is not provided/supported by Syslinux upstream. Please direct any bug reports specific to the script to the Arch Bug Tracker and not upstream.

The syslinux-install_update script will install Syslinux, copy *.c32 modules to /boot/syslinux, set the boot flag and install the boot code in the MBR. It can handle MBR and GPT disks along with software RAID.

1. If you use a separate boot partition make sure that it is mounted. Check with lsblk; if you do not see a /boot mountpoint, mount it before you go any further.

3. Create or Edit /boot/syslinux/syslinux.cfg by following #Configuration.

Note:

When you reboot your system now, you will have a Syslinux prompt. To automatically boot your system or get a boot menu, you still need to create a configuration file.

If you have just cloned your disk to say /mnt/clone, install syslinux by issuing from the Arch installation medium:

# syslinux-install_update.sh -i -a -m -c /mnt/clone

Manual install

Note:

If you are unsure of which partition table you are using (MBR or GPT), you can check using the following command

# blkid -s PTTYPE -o value /dev/sda
gpt

If you are trying to rescue an installed system with a live CD, be sure to chroot into it before executing these commands. If you do not chroot first, you must prepend all file paths (not /dev/ paths) with the mount point.

Your boot partition, on which you plan to install Syslinux, must contain a FAT, ext2, ext3, ext4, or Btrfs file system. You should install it on a mounted directory—not a /dev/sdXY device. You do not have to install it on the root directory of a file system, e.g., with device /dev/sda1 mounted on /boot. You can install Syslinux in the syslinux directory:

After this, proceed to install the Syslinux boot code (mbr.bin or gptmbr.bin) to Master Boot Record 440-byte boot code region (not to be confused with MBR aka msdos partition table) of the disk, as described in the next section.

An alternate MBR which Syslinux provides is: altmbr.bin. This MBR does not scan for bootable partitions; instead, the last byte of the MBR is set to a value indicating which partition to boot from. Here is an example of how altmbr.bin can be copied into position:

In this case, a single byte of value 5 is appended to the contents of altmbr.bin and the resulting 440 bytes are written to the MBR on device sda. Syslinux was installed on the first logical partition (/dev/sda5) of the disk.

For syslinux, kernel and initramfs files need to be in the ESP, as syslinux does not (currently) have the ability to access files outside its own partition (i.e. outside ESP in this case). For this reason, it is recommended to mount ESP at /boot.

The automatic install script /usr/bin/syslinux-install_update does not support UEFI install.

The configuration syntax of syslinux.cfg for UEFI is same as that of BIOS.

Create or edit $esp/EFI/syslinux/syslinux.cfg by following #Configuration.

Note: The config file for UEFI is $esp/EFI/syslinux/syslinux.cfg, not /boot/syslinux/syslinux.cfg. Files in /boot/syslinux/ are BIOS specific and not related to UEFI syslinux.

Configuration

The Syslinux configuration file, syslinux.cfg, should be created in the same directory where you installed Syslinux. In our case, /boot/syslinux/ for BIOS systems and /$esp/EFI/syslinux/ for UEFI systems.

The bootloader will look for either syslinux.cfg (preferred) or extlinux.conf

Tip:

Instead of LINUX, the keyword KERNEL can also be used. KERNEL tries to detect the type of the file, while LINUX always expects a Linux kernel.

TIMEOUT value is in units of 1/10 of a second.

Examples

Basic configuration

This is a simple configuration file that will show a boot: prompt and automatically boot after 5 seconds.

Note: The partition in question needs to be whatever you have as / (root), not /boot.

Graphical boot menu

Syslinux also allows you to use a graphical boot menu. To use it, copy the vesamenu COM32 module to your Syslinux folder:

# cp /usr/lib/syslinux/bios/vesamenu.c32 /boot/syslinux/

Note: If you are using UEFI make sure to copy from /usr/lib/syslinux/efi64/ (efi32 for i686 systems), otherwise you will be presented with a black screen. In that case, boot from a live medium and use chroot to make the appropriate changes.

This config uses the same menu design as the Arch Install CD. The background file can be found there too. To make sure that your system can boot with this config, check that it is pointing to the correct partition.

Since Syslinux 3.84, vesamenu.c32 supports the MENU RESOLUTION $WIDTH $HEIGHT directive.
To use it, insert MENU RESOLUTION 1440 900 into your config for a 1440x900 resolution.
The background picture has to have exactly the right resolution, however, as Syslinux will otherwise refuse to load the menu.

Auto boot

If you do not want to see the Syslinux menu at all, comment out all UI commands and make sure there is a DEFAULT set in your syslinux.cfg.

Security

Syslinux has two levels of bootloader security: a menu master password, and a per-menu-item password. In syslinux.cfg, use

MENU MASTER PASSWD passwd

to set a master bootloader password, and

MENU PASSWD passwd

within a LABEL block to password-protect individual boot items.

Chainloading

If you want to chainload other operating systems (such as Windows) or boot loaders, copy the chain.c32 module to the Syslinux directory (for details, see the instructions in the previous section). Then create a section in the configuration file:

/boot/syslinux/syslinux.cfg

...
LABEL windows
MENU LABEL Windows
COM32 chain.c32
APPEND hd0 3
...

hd0 3 is the third partition on the first BIOS drive - drives are counted from zero, but partitions are counted from one.

Note: For Windows, this skips the system's own boot manager (bootmgr), which is required for a few important updates (eg.) to complete. In such cases it may be advisable to temporarily set the MBR boot flag to the Windows partition (eg. with GParted), let the update finish installing, and then reset the flag to the syslinux partition (eg. with Windows's own DiskPart).

If you are unsure about which drive your BIOS thinks is "first", you can instead use the MBR identifier, or if you are using GPT, the filesystem labels. To use the MBR identifier, run the command

Chainloading other Linux systems

Chainloading another bootloader such as Windows' is pretty obvious, as there is a definite bootloader to chain to. But with Syslinux, it is only able to load files residing on the same partition as the configuration file. Thus, if you have another version of Linux on a separate partition, without a shared /boot, it becomes necessary to employ Extlinux. Essentially, Extlinux can be installed on the partition superblock and be called as a separate bootloader from the MBR installed by Syslinux. Extlinux is part of the Syslinux project and is included with the syslinux package.

The following instructions assume you have Syslinux installed already. These instructions will also assume that the typical Arch Linux configuration path of /boot/syslinux is being used and the chainloaded / is on /dev/sda3.

From a booted Linux (likely the partition that Syslinux is set up to boot), mount the other root partition to your desired mount point. In this example this will be /mnt. Also, if a separate /boot partition is used on the second operating system, that will also need to be mounted. The example assumes this is /dev/sda2.

Using memtest

Note: If you are using pxelinux, change name from memtest.bin to memtest since pxelinux treats the file with .bin extension as a boot sector and loads only 2KB of it.

HDT

HDT (Hardware Detection Tool) displays hardware information. Like before, the .c32 file has to be copied from /boot/syslinux/.
For PCI info, copy /usr/share/hwdata/pci.ids to /boot/syslinux/pci.ids and add the following to your configuration file:

Hiding the menu

Use the option:

/boot/syslinux/syslinux.cfg

MENU HIDDEN

to hide the menu while displaying only the timeout. Press any key to bring up the menu.

Pxelinux

Note: Syslinux at present has no UEFI networking stack, so you will be unable to use syslinux-efi-gitAUR (as is possible with #GRUB) and still expect to be able to tftp your kernel and initramfs; pxelinux still works fine for legacy PXE booting

We also created the pxelinux.cfg directory, which is where pxelinux searches for configuration files by default. Because we do not want to discriminate between different host MACs, we then create the default configuration.

Note: You will need to change nbd_host and/or nfsroot, respectively, to match your network configuration (the address of the NFS/NBD server)

The pxelinux configuration syntax identical to syslinux; refer to the upstream documentation for more information.

The kernel and initramfs will be transferred via TFTP, so the paths to those are going to be relative to the TFTP root. Otherwise, the root filesystem is going to be the NFS mount itself, so those are relative to the root of the NFS server.

No Default or UI found on some computers

Certain motherboard manufacturers have less compatibility for booting from USB devices than others. While an ext4 formatted USB drive may boot on a more recent computer, some computers may hang if the boot partition containing the kernel and initrd are not on a FAT16 partition. To prevent an older machine from loading ldlinux and failing to read syslinux.cfg, use cfdisk to create a FAT16 partition (<=2GB) and format using dosfstools:

# mkfs.msdos -F 16 /dev/sda1

then install and configure Syslinux.

Missing operating system

If you get this message, check if the partition that contains /boot has the boot flag enabled. If the flag is enabled, then perhaps this partition starts at sector 1 rather than sector 63 or 2048. Check this with fdisk -l. If it starts at sector 1, you can move the partition(s) with gparted from a rescue disk. Or, if you have a separate boot partition, you can back up /boot with

# cp -a /boot /boot.bak

and then boot up with the Arch install disk. Next, use cfdisk to delete the /boot partition, and recreate it. This time it should begin at the proper sector, 63. Now mount your partitions and chroot into your mounted system, as described in the beginners guide. Restore /boot with the command

# cp -a /boot.bak/* /boot

Check if /etc/fstab is correct, run:

# syslinux-install_update -iam

and reboot.

You will also get this error if you are trying to boot from a md RAID 1 array and created the array with a too new version of the metadata that Syslinux does not understand. As of August 2013 by default mdadm will create an array with version 1.2 metadata, but Syslinux does not understand metadata newer than 1.0. If this is the case you will need to recreate your RAID array using the --metadata=1.0 flag to mdadm.

Windows boots up, ignoring Syslinux

Solution: Make sure the partition that contains /boot has the boot flag enabled. Also, make sure the boot flag is not enabled on the Windows partition. See the installation section above.

The MBR that comes with Syslinux looks for the first active partition that has the boot flag set. The Windows partition was likely found first and had the boot flag set. If you wanted, you could use the MBR that Windows or MS-DOS fdisk provides.

Menu entries do nothing

You select a menu entry and it does nothing, it just "refreshes" the menu. This usually means that you have an error in your syslinux.cfg file. Hit Tab to edit your boot parameters. Alternatively, press Esc and type in the LABEL of your boot entry (e.g. arch).

Cannot remove ldlinux.sys

The ldlinux.sys file has the immutable attribute set, which prevents it from being deleted or overwritten. This is because the sector location of the file must not change or else Syslinux has to be reinstalled. To remove it, run:

White block in upper left corner when using vesamenu

Problem:
As of linux-3.0, the modesetting driver tries to keep the current contents of the screen after changing the resolution (at least it does so with my Intel, when having Syslinux in text mode). It seems that this goes wrong when combined with the vesamenu module in Syslinux (the white block is actually an attempt to keep the Syslinux menu, but the driver fails to capture the picture from vesa graphics mode).

If you have a custom resolution and a vesamenu with early modesetting, try to append the following in syslinux.cfg to remove the white block and continue in graphics mode:

APPEND root=/dev/sda6 rw 5 vga=current quiet splash

Chainloading Windows does not work, when it is installed on another drive

If Windows is installed on a different drive than Arch and you have trouble chainloading it, try the following configuration: