Skip to main content
Topic: Simplifying boot with Syslinux (Read 2007 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Simplifying boot with Syslinux

Those who want to avoid unnecessary cruft in their system would probably want to apply the same principle on their boot manager. One of the lightweight alternatives to unnecessarily complicated GRUB is Syslinux. It supports EFI boot, but unfortunately, so far doesn't support chainloading on EFI. This means it cannot boot Windows boot loader, for example. However, if you have dual boot on EFI, you can simply have a separate entry in EFI for the Windows boot loader and start it by entering BIOS setup on boot and manually activating its entry. Otherwise, Syslinux is very "out of the way" and minimal. Here's how to set it up.

0. Prepare Artix LiveUSB. This might seem redundant, but whenever you are tinkering with boot managers there is a chance that you will make your system unbootable. Booting into LiveUSB then makes it easy to recover your system.

1. Remove GRUB, install syslinux:
Code: [Select]
# pacman -R grub
# pacman -S syslinux

2. Copy Syslinux files to /boot/syslinux. For EFI boot on 64-bit systems:
Code: [Select]
# cp -r /usr/lib/syslinux/efi64/* /boot/syslinux

3. Edit /boot/syslinux/syslinux.cfg. Some notable parts:
Code: [Select]
DEFAULT arch
PROMPT 0        # Set to 1 if you always want to display the boot: prompt
TIMEOUT 50
DEFAULT line sets the menu item which will be activated when booting automatically or when no action is performed before the timeout expires.

PROMPT 1 will always show the "boot:" prompt on boot.

TIMEOUT sets the timeout (in tenths of seconds - 50 is 5 seconds) after which the default menu item will be activated.

Code: [Select]
UI menu.c32
#UI vesamenu.c32
The UI line sets the corresponding menu - text mode menu (menu.c32) or the graphical menu (vesamenu.c32). Commenting out both disables the menu - the default menu item will be activated, or (if PROMPT 1 is used) "boot:" prompt will be shown.

Code: [Select]
LABEL arch
    MENU LABEL Artix Linux
    LINUX ../vmlinuz-linux
    APPEND root=/dev/sda3 rw
    INITRD ../initramfs-linux.img
You should most definitely edit the APPEND line. First, get the UUID of your root (/) partition:
Code: [Select]
# lsblk -f
NAME   FSTYPE FSVER LABEL       UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1 vfat   FAT16             A0AB-F0B2                              92,5M    74% /boot
├─sda2
├─sda3 ntfs                     AED6511BD650E55D
├─sda4 ext4   1.0   Artix /     55df8766-94c6-467a-b5a2-76f1c7843b1f   10,7G    67% /
├─sda5 swap   1                 12d5894a-0918-418e-94b4-a8b92265fed3                [SWAP]
├─sda6 ext4   1.0   Artix /home 58f73e6d-51a9-473b-afbf-010cbe0d0e60   42,2G    52% /home
└─sda7 ntfs                     D0F816EFF816D396
sr0
In this example, UUID will be 55df8766-94c6-467a-b5a2-76f1c7843b1f . Then, change the corresponding line in /boot/syslinux/syslinux.cfg to read
Code: [Select]
APPEND root=UUID=55df8766-94c6-467a-b5a2-76f1c7843b1f  rw
If you want hibernate support, take note of the swap partition UUID and add it as well. In this example, swap partition UUID is 12d5894a-0918-418e-94b4-a8b92265fed3, so we will change the item to
Code: [Select]
APPEND root=UUID=55df8766-94c6-467a-b5a2-76f1c7843b1f  rw resume=UUID=12d5894a-0918-418e-94b4-a8b92265fed3

4. Add the entry for Syslinux to EFI:
Code: [Select]
# efibootmgr --create --disk /dev/sda --part 1 --loader /syslinux/syslinux.efi --label SYSLINUX --verbose
You can verify that the entry is created using the command:
Code: [Select]
# efibootmgr -v
Make sure that the ordering is correct ("BootOrder:" line). For more information, see the wiki.

That's it! Verify that everything works as it should by rebooting, and use the LiveUSB if anything goes south.

See also:
1. https://syslinux.org/
2. https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface#efibootmgr
3. https://wiki.archlinux.org/title/Syslinux

Re: Simplifying boot with Syslinux

Reply #1
And how does it manage encrypted disks? I.e. can it open a LUKS container in case of encrypted /boot as GRUB does?

Re: Simplifying boot with Syslinux

Reply #2
I haven't yet used disk encryption (TBH, I don't see the need), but from the wiki entry on dm-crypt it is part of the kernel. Syslinux supports setting the command line of the kernel through the APPEND directive in syslinux.cfg. initrd should be regenerated automatically from a pacman hook, so relevant modules should also be configured in /etc/mkinitcpio.conf. Installing Syslinux doesn't change this, but it does eliminate the need for GRUB update hook activation.

A web search for "LUKS Syslinux" gives this thread, for example.

Re: Simplifying boot with Syslinux

Reply #3
I have a fully encrypted setup (boot files are stored on the LUKS1 root partition) and I just tried setting up SYSLINUX to account for that.

Unfortunately, contrary to GRUB2 which supports decrypting a drive before it loads vmlinuz and initramfs, SYSLINUX does not support that. For reference, you might want to see https://unixsheikh.com/tutorials/real-full-disk-encryption-using-grub-on-artix-linux-for-bios-and-uefi.html
Quote
This setup is not possible using other boot loaders such as systemd-boot or syslinux, because neither of those support loading encryption modules (as of writing).

Best,
Matt

 

Re: Simplifying boot with Syslinux

Reply #4
Of course, boot partition needs to be unencrypted with Syslinux. But, like I said, Syslinux supports passing parameters to the kernel through the kernel command line (APPEND directive), as well as loading the initrd (containing kernel modules), so it is possible to use Syslinux for the situation where boot partition is unencrypted and other partitions are encrypted.

Again, I don't see the need for partition encryption, as it merely slows down anyone wanting to gain access to my files if he already has physical access to the hard disk. No encryption method is perfect or unbeatable.

https://forum.artixlinux.org/index.php/topic,2852.msg18674.html#msg18674

For me, the benefits of having a simple configuration file controlling the boot loader, and not having to update GRUB every time there is a kernel update outweigh the downsides of not being able to have full disk encryption or chainload on EFI.