jasonwryan.com

Miscellaneous ephemera…

Replacing Grub With Syslinux

With the announcement late last month that Grub 2.00 has been released I thought that it was time to stop procrastinating and do something about moving away from Grub Legacy, which is no longer actively developed. Not that there is anything wrong with Grub Legacy’s functionality; it has always done whatever I asked of it (admittedly, not a lot) and done so without complaint.

I have used Grub2 before, when I was running Ubuntu on my home desktop, and it is the bootloader on my Debian Squeeze server. I can’t, however, say that I have ever really understood—or appreciated—its mutliple file, “need to reconfigure after making any changes” type of complexity. So, I thought that I would give Syslinux a shot.

Syslinux isn’t a single bootloader, rather it is a collection of lightweight bootloaders, with Extlinux responsible for booting ext2, ext3, ext4 and btrfs filesystems. As the Arch Wiki Syslinux page notes, since Syslinux 4, Extlinux has been merged with Syslinux.

Installing Syslinux is ridiculously easy. It is literally a five step process. First, install the package:

1
pacman -S syslinux

After installing syslinux pacman will helpfully tell you what to do next:

==> If you want to use syslinux as your bootloader
==> edit /boot/syslinux/syslinux.cfg and run
==> # /usr/sbin/syslinux-install_update -i -a -m
==> to install it.

pacman says

Arch user Matthew Gyurgyik has written an ingenious script, syslinux-install_update that automates the process of writing the MBR and installing the relevant files to /boot/syslinux/. The script also checks if, as is the case with my desktop, there is a RAID array present, and if so passes the install command the --raid flag:

RAID mode. If boot fails, tell the BIOS to boot the next device in the boot sequence (usually the next hard
disk) instead of stopping with an error message. This is useful for RAID-1 booting.

man syslinux

After running the script, you should receive a message advising you that Syslinux has been sucessfully installed on both drives:

Detected RAID on /boot - installing Syslinux with --raid
Syslinux install successful
Boot Flag Set - /dev/sda1
Boot Flag Set - /dev/sdb1
Installed MBR (/usr/lib/syslinux/mbr.bin) to /dev/sda
Installed MBR (/usr/lib/syslinux/mbr.bin) to /dev/sdb

If you are moving from Grub Legacy, configuring Syslinux is similarly painless. There are two sections to a basic /boot/syslinux/syslinux.cfg, the defaults and the prompt entries.

I set up my defaults to be essentially invisible:

1
2
3
4
# General settings
DEFAULT Arch
PROMPT 0
TIMEOUT 0

And then copy across the relevant lines from my /boot/grub/menu.lst:

1
grep root= /boot/grub/menu.lst >> /boot/syslinux/syslinux.cfg

Then it is just a matter of adding the relevant entries under LABEL:

1
2
3
4
5
LABEL Arch
   MENU LABEL Arch Linux
   LINUX ../vmlinuz-linux
   APPEND root=/dev/mapper/vgroup-lvroot cryptdevice=/dev/md1:vgroup ro
   INITRD ../initramfs-linux.img

You then add entries for Fallback, and any other images that you may wish to boot from.

And that, in their entirety, is steps two and three. You then move to steps four and five:

1
2
pacman -Rsn grub
shutdown -r now

And you reboot with Syslinux. Done.

The beauty of Syslinux, from my perspective, is that it is simple to install and configure, with just the one config file and the options all well documented and easy to understand. If you want a menu with a background image, you can have that. If, like me, you just want to get on and boot your default, it does that.

Additionally, if you want or need to boot into Fallback, or want to dual boot, you can just hold down Shift at boot time and enter the desired Label at the prompt. Syslinux has Tab completion, so you only need enter a couple of letters, hit Tab and you will see all of the available Labels to boot. Brilliant.

Notes

Creative Commons Flickr image by custer_fluck

Comments