Setting up SYSLINUX

tested on stretch, artful, Slackware 14.2, Slackware current

Installation

See syslinux-install. Recent versions of EXTLINUX are also capable to read XFS partitions. XFS support is only available since v5.01. Ubuntu has v6.03 but slackware has v4.07.

extlinux --version # 6.04

fdisk -l
disk=/dev/sda
disk=/dev/nvme0n1

bootable flag

Assuming MBR

fdisk -l $disk | grep ^Disklabel

make sure the needed partition has the bootable flag, for the mbr.bin bootcode to work,

fdisk -l $disk

bios / csm / legacy

eventually backup the partition table

Put the primary boot-code in place

dd if=/usr/share/syslinux/mbr.bin of=$disk
# conv=notrunc

Deploy the secondary boot-code

mkdir /boot/syslinux/
extlinux --device ${disk}p1 --install /boot/syslinux

for multiboot protocol support

cp -f /usr/share/syslinux/libcom32.c32 /boot/syslinux/
cp -f /usr/share/syslinux/mboot.c32 /boot/syslinux/

# menu
cp -f /usr/share/syslinux/libutil.c32 /boot/syslinux/
cp -f /usr/share/syslinux/menu.c32 /boot/syslinux/

efi

mkdir /boot/efi/EFI/syslinux
cp -r /usr/share/syslinux/efi64/* /boot/efi/EFI/syslinux

gdisk -l /dev/sda
efibootmgr --create --disk /dev/sda --part 1 --loader /EFI/syslinux/syslinux.efi --label "SYSLINUX"
efibootmgr -v

and check BootOrder: – you should see your new entry in first position

Setup

assuming serial console (for both bare-metal or KVM guest)

There are two kinds of boot prompts, the command-line based one and the menu, which looks as cool as the one from LILO.

For the command-line prompt and timeout

    vi /boot/syslinux/syslinux.cfg
    vi /boot/efi/EFI/syslinux/syslinux.cfg

serial 0 115200
console 1
nohalt 1

default Linux
prompt 1
timeout 30

label Linux
        linux /vmlinuz
        append root=/dev/nvme0n1p1 ro console=tty0 console=ttyS0,115200n8 mitigations=off

label XEN
        kernel mboot.c32
        append /xen.gz dom0_mem=2048M,min:2048M,max:2048M noreboot=true loglvl=info guest_loglvl=info smt=1 ept=exec-sp com1=115200,8n1 console=com1,vga --- /vmlinuz root=/dev/nvme0n1p1 ro console=hvc0 earlyprintk=xen mitigations=off

label PVH
    kernel mboot.c32
    append /xen.gz dom0=pvh dom0_mem=1024M,max:2048M noreboot=true loglvl=info guest_loglvl=info smt=1 ept=exec-sp com1=115200,8n1 console=com1,vga --- /vmlinuz root=/dev/nvme0n1p1 ro console=hvc0 earlyprintk=xen mitigations=off

tune the root partition accordingly

    # /dev/sda1
    # /dev/vda1

note hvc0 although we want serial (XEN handles it) — and don’t forget to also tune agetty.

moar syslinux options

for the menu to show up

    default menu.c32
    prompt 0
    menu title SYSLINUX

moar xen options

    # loglvl=all
        # pv-linear-pt=true
    # dom0_mem=512M,max:1024M
    # dom0_max_vcpus=1 dom0_vcpus_pin

in case you’re going for a PVH dom0, also add those as micro-kernel arguments

    # dom0=pvh dom0_mem=1024M,max:2048M
    # 4096M 8192M 10240M 12288M

moar linux options

    # nomodeset
    # vga=791
        # ipv6.disable=1
    # vt.default_utf8=0

in case you are having file-based virtual disks, checkout how many guests you are supposed to run there and eventually provision more loop devices to start with

    # max_loop=128

bloated systems

    # ubuntu-only
    # netcfg/do_not_use_netplan=true

    # debian/ubuntu
    # Linux
    # net.ifnames=0 biosdevname=0 initrd=/boot/initrd.img
    # XEN (mboot.c32)
    # net.ifnames=0 biosdevname=0 --- /boot/initrd.img

hybrid mbr

without the need for a BIOS boot partition

write down the partition numbers you wanna clone to MBR

fdisk -l $disk

==> we want ALL the partitions to be cloned in case the whole system (/etc/fstab) goes MBR

prepare the hybrid records

gdisk $disk

r
h

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 1 2 3
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): N

Creating entry for GPT partition #1 (MBR partition #1)
Enter an MBR hex code (default 83):
Set the bootable flag? (Y/N): Y

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default 82):
Set the bootable flag? (Y/N): N

Creating entry for GPT partition #3 (MBR partition #3)
Enter an MBR hex code (default 8E):
Set the bootable flag? (Y/N): N

o
w

partprobe $disk
fdisk -l $disk
fdisk -t dos -l $disk

in case of GPT/MBR

dd if=/usr/share/syslinux/gptmbr.bin of=$disk
# conv=notrunc

Ready to go

ls -lF /boot/syslinux/*.{cfg,sys,c32}
ls -lF /xen.gz
ls -lF /boot/xen*
ls -lF /boot/vmlinuz

shutdown -r now

Troubelshooting

multiboot for netbsd

fails

cp -i /usr/lib/syslinux/modules/bios/libcom32.c32 /tftpboot/
cp -i /usr/lib/syslinux/modules/bios/mboot.c32 /tftpboot/

vi /tftpboot/pxelinux.cfg/default

label NetBSD multiboot
com32 mboot.c32
append netbsd7/amd64/binary/kernel/netbsd-INSTALL.gz

but this is what I get so far

Invalid Multiboot image: neither ELF header nor a.out kludge found

Resources

EXTLINUX https://wiki.syslinux.org/wiki/index.php?title=EXTLINUX

Mboot.c32 http://www.syslinux.org/wiki/index.php?title=Mboot.c32

Installing Slackware Using GPT with a BIOS motherboard https://docs.slackware.com/howtos:slackware_admin:installing_with_gpt_without_uefi

How to install extlinux (syslinux) as a bootloader http://shallowsky.com/linux/extlinux.html

How to boot Linux with extlinux https://superuser.com/questions/743802/how-to-boot-linux-with-extlinux

Syslinux https://wiki.archlinux.org/index.php/syslinux

chain.c32

3.2 TFTP Server and PXE Booting http://docs.adaptivecomputing.com/adaptivehpc/archive/Content/Topics/tftp_server_and_pxe_booting.html

Comboot/chain.c32 https://wiki.syslinux.org/wiki/index.php?title=Comboot/chain.c32

Doc/chain https://wiki.syslinux.org/wiki/index.php?title=Doc/chain

Why does using ‘chain.c32’ to PXE boot from a system’s local drive fail? https://access.redhat.com/solutions/43157

multiboot

msc-thesis/dfly-multiboot.md https://github.com/erszcz/msc-thesis/blob/master/dfly-multiboot.md

Mboot.c32 http://www.syslinux.org/wiki/index.php/Mboot.c32

efi

UEFI https://wiki.syslinux.org/wiki/index.php?title=Install#UEFI

UEFI Systems https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems

xen

1 Xen Hypervisor Command Line Options https://xenbits.xen.org/docs/4.13-testing/misc/xen-command-line.html

kernel parms

https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html

https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/l1tf.html

serial line

https://wiki.syslinux.org/wiki/index.php?title=Config#SERIAL

https://wiki.syslinux.org/wiki/index.php?title=Common_Problems#Serial

https://www.kernel.org/doc/html/latest/admin-guide/serial-console.html

https://wiki.xenproject.org/wiki/Xen_FAQ_Console

https://wiki.xenproject.org/wiki/Xen_Serial_Console

hybrid

https://www.rodsbooks.com/gdisk/hybrid.html

https://superuser.com/questions/1286123/how-do-i-get-the-mbr-partition-table-with-newest-fdisk


https://ravada.readthedocs.io/en/latest/docs/config_console.html

https://ostechnix.com/how-to-enable-virsh-console-access-for-kvm-guests/

https://tldp.org/HOWTO/Remote-Serial-Console-HOWTO/configure-boot-loader-syslinux.html

https://tldp.org/HOWTO/Remote-Serial-Console-HOWTO/rhbootdisk.html

https://wiki.alpinelinux.org/wiki/Enable_Serial_Console_on_Boot

https://wiki.archlinux.org/title/working_with_the_serial_console


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun