You are not logged in.

#1 2021-07-22 22:10:22

dakota
Member
Registered: 2016-05-20
Posts: 417

[SOLVED] Chainloading Syslinux Fails to Boot

I have a hard disk with 4 partitions.

I use partitions 1/2 as my 'live' system and partitions 3/4 as my 'last known good state'. Before upgrading, I rsync partitions 1/2 to 3/4, then upgrade. If I have issues, I can boot into partitions 3/4 and fix the problem. This has worked well for the last several years.

Now, I would like to duplicate this setup to a different PC. However, when I select my backup partition from the Syslinux boot menu, I get "Booting..." and a flashing cursor, nothing more.

My system is up to date and I have no problem booting into partition 1.

Configuration

1. I got everything working on partitions 1/2
2. I copied partitions 1/2 on to 3/4 using rsync
3. I edited the fstab and syslinux.cfg files on both both partitions 1 and 3
4. I created a backup script that would exclude certain directories from being backed up in the future

lsblk -f
------------------------------
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                           
├─sda1 ext4   1.0         7a33bc7f-6aff-4e5a-8a57-34f0ccfffffc   20.4G    26% /
├─sda2 ext4   1.0         0843168a-da52-4a30-b8f0-164bdf50982e  158.4G    14% /home
├─sda3 ext4   1.0         fd7c0846-ba25-4efa-8dd7-902e2774306b                
└─sda4 ext4   1.0         1b00eea6-cd55-4538-85af-70eabf6b40cf                
sr0 
lsblk -l
------------------------------
NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda    8:0    0 465.8G  0 disk 
sda1   8:1    0    30G  0 part /
sda2   8:2    0   200G  0 part /home
sda3   8:3    0    30G  0 part 
sda4   8:4    0   200G  0 part 
sr0   11:0    1  1024M  0 rom  
cat /etc/fstab #partition 1
------------------------------
# Static information about the filesystems.
# See fstab(5) for details.

## <file system> <dir> <type> <options> <dump> <pass>

## /dev/sda1
UUID=7a33bc7f-6aff-4e5a-8a57-34f0ccfffffc	/         	ext4      	rw,relatime	0 1

## /dev/sda2
UUID=0843168a-da52-4a30-b8f0-164bdf50982e	/home     	ext4      	rw,relatime	0 2

## /dev/sda3
#UUID=fd7c0846-ba25-4efa-8dd7-902e2774306b      /               ext4            rw,relatime     0 1

## /dev/sda4
#UUID=1b00eea6-cd55-4538-85af-70eabf6b40cf      /home           ext4            rw,relatime     0 2

# This note should not appear on the mirrored backup drive.
cat /etc/fstab #partition 3
------------------------------
# Static information about the filesystems.
# See fstab(5) for details.

## <file system> <dir> <type> <options> <dump> <pass>

## /dev/sda1
#UUID=7a33bc7f-6aff-4e5a-8a57-34f0ccfffffc	/         	ext4      	rw,relatime	0 1

## /dev/sda2
#UUID=0843168a-da52-4a30-b8f0-164bdf50982e	/home     	ext4      	rw,relatime	0 2

## /dev/sda3
UUID=fd7c0846-ba25-4efa-8dd7-902e2774306b      /               ext4            rw,relatime     0 1

## /dev/sda4
UUID=1b00eea6-cd55-4538-85af-70eabf6b40cf      /home           ext4            rw,relatime     0 2
cat /boot/syslinux/syslinux.cfg #partition 1
------------------------------
# Config file for Syslinux -
# /boot/syslinux/syslinux.cfg
#
# Comboot modules:
#   * menu.c32 - provides a text menu
#   * vesamenu.c32 - provides a graphical menu
#   * chain.c32 - chainload MBRs, partition boot sectors, Windows bootloaders
#   * hdt.c32 - hardware detection tool
#   * reboot.c32 - reboots the system
#
# To Use: Copy the respective files from /usr/lib/syslinux to /boot/syslinux.
# If /usr and /boot are on the same file system, symlink the files instead
# of copying them.
#
# If you do not use a menu, a 'boot:' prompt will be shown and the system
# will boot automatically after 5 seconds.
#
# Please review the wiki: https://wiki.archlinux.org/index.php/Syslinux
# The wiki provides further configuration examples

DEFAULT arch
PROMPT 0        # Set to 1 if you always want to display the boot: prompt
TIMEOUT 50
# You can create syslinux keymaps with the keytab-lilo tool
#KBDMAP de.ktl

# Menu Configuration
# Either menu.c32 or vesamenu32.c32 must be copied to /boot/syslinux
UI menu.c32
#UI vesamenu.c32

# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
MENU TITLE Arch Linux
#MENU BACKGROUND splash.png
MENU COLOR border       30;44   #40ffffff #a0000000 std
MENU COLOR title        1;36;44 #9033ccff #a0000000 std
MENU COLOR sel          7;37;40 #e0ffffff #20ffffff all
MENU COLOR unsel        37;44   #50ffffff #a0000000 std
MENU COLOR help         37;40   #c0ffffff #a0000000 std
MENU COLOR timeout_msg  37;40   #80ffffff #00000000 std
MENU COLOR timeout      1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07        37;40   #90ffffff #a0000000 std
MENU COLOR tabmsg       31;40   #30ffffff #00000000 std

# boot sections follow
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*

LABEL arch
    MENU LABEL Arch Linux
    LINUX ../vmlinuz-linux
    APPEND root=/dev/sda1 rw
    INITRD ../intel-ucode.img,../initramfs-linux.img

#LABEL arch
#        MENU LABEL Arch Linux
#        COM32 chain.c32
#        APPEND hd0 0

LABEL archfallback
    MENU LABEL Arch Linux Fallback
    LINUX ../vmlinuz-linux
    APPEND root=/dev/sda1 rw
    INITRD ../intel-ucode.img,../initramfs-linux-fallback.img

LABEL archlts
    MENU LABEL Arch Linux LTS
    LINUX ../vmlinuz-linux-lts
    APPEND root=/dev/sda1 rw
    INITRD ../intel-ucode.img,../initramfs-linux-lts.img

LABEL archbackup
    MENU LABEL Arch Linux Backup
    COM32 chain.c32
    APPEND hd0 3

#LABEL windows
#        MENU LABEL Windows
#        COM32 chain.c32
#        APPEND hd0 1

LABEL hdt
        MENU LABEL HDT (Hardware Detection Tool)
        COM32 hdt.c32

LABEL reboot
        MENU LABEL Reboot
        COM32 reboot.c32

LABEL poweroff
        MENU LABEL Poweroff
        COM32 poweroff.c32

Selecting "Arch Linux Backup" should bring up the Syslinux boot menu found on hard drive 0, partition 3... but it never appears.

cat /boot/syslinux/syslinux.cfg #partition 3
------------------------------
# Config file for Syslinux -
# /boot/syslinux/syslinux.cfg
#
# Comboot modules:
#   * menu.c32 - provides a text menu
#   * vesamenu.c32 - provides a graphical menu
#   * chain.c32 - chainload MBRs, partition boot sectors, Windows bootloaders
#   * hdt.c32 - hardware detection tool
#   * reboot.c32 - reboots the system
#
# To Use: Copy the respective files from /usr/lib/syslinux to /boot/syslinux.
# If /usr and /boot are on the same file system, symlink the files instead
# of copying them.
#
# If you do not use a menu, a 'boot:' prompt will be shown and the system
# will boot automatically after 5 seconds.
#
# Please review the wiki: https://wiki.archlinux.org/index.php/Syslinux
# The wiki provides further configuration examples

DEFAULT arch
PROMPT 0        # Set to 1 if you always want to display the boot: prompt
TIMEOUT 50
# You can create syslinux keymaps with the keytab-lilo tool
#KBDMAP de.ktl

# Menu Configuration
# Either menu.c32 or vesamenu32.c32 must be copied to /boot/syslinux
UI menu.c32
#UI vesamenu.c32

# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
MENU TITLE Arch Linux
#MENU BACKGROUND splash.png
MENU COLOR border       30;32   #40ffffff #a0000000 std
MENU COLOR title        1;36;32 #9033ff66 #a0000000 std
MENU COLOR sel          7;37;40 #e0ffffff #20ffffff all
MENU COLOR unsel        37;32   #50ffffff #a0000000 std
MENU COLOR help         37;40   #c0ffffff #a0000000 std
MENU COLOR timeout_msg  37;40   #80ffffff #00000000 std
MENU COLOR timeout      1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07        37;40   #90ffffff #a0000000 std
MENU COLOR tabmsg       31;40   #30ffffff #00000000 std

# boot sections follow
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*

LABEL arch
    MENU LABEL Arch Linux
    COM32 chain.c32
    APPEND hd0 0

LABEL archbackup
    MENU LABEL Arch Linux Backup
    LINUX /boot/vmlinuz-linux
    APPEND root=/dev/sda3 rw
    INITRD /boot/initramfs-linux.img

#LABEL windows
#        MENU LABEL Windows
#        COM32 chain.c32
#        APPEND hd0 1

LABEL hdt
        MENU LABEL HDT (Hardware Detection Tool)
        COM32 hdt.c32

LABEL reboot
        MENU LABEL Reboot
        COM32 reboot.c32

LABEL poweroff
        MENU LABEL Poweroff
        COM32 poweroff.c32
cat /root/backup_mirror.sh #the backup script
------------------------------
#!/bin/bash
echo "mounting backup partitions..."
mount /dev/sda3 /mnt/mirror
mount /dev/sda4 /mnt/mirror/home
echo "backing up with rsync..."
rsync -aAXHzz --progress --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/etc/fstab","/boot/syslinux/syslinux.cfg"} / /mnt/mirror/
echo "unmounting backup partitions..."
umount /mnt/mirror/home
umount /mnt/mirror
echo "all done..."

I installed and edited the bootloader (with partition 1 mounted and me chrooted into it) using:

# syslinux-install_update  -iam
# nano /boot/syslinux/syslinux.cfg

From the Syslinux boot menu, "Hardware Detection Tool", "Reboot", and "Poweroff" all work, so I think the C32 module is being loaded. Also, I have checked that chain.32 exists in my boot directory.

ls /boot
------------------------------
total 105404
drwxr-xr-x  3 root root     4096 Jul 21 12:07 .
drwxr-xr-x 18 root root     4096 Jul 18 14:11 ..
-rw-r--r--  1 root root 34628070 Jul 21 12:07 initramfs-linux-fallback.img
-rw-r--r--  1 root root 10135735 Jul 21 12:07 initramfs-linux.img
-rw-r--r--  1 root root 29783254 Jul 21 12:07 initramfs-linux-lts-fallback.img
-rw-r--r--  1 root root  9764620 Jul 21 12:07 initramfs-linux-lts.img
-rw-r--r--  1 root root  4769792 Jun  8 11:31 intel-ucode.img
drwxr-xr-x  2 root root     4096 Jul 21 22:21 syslinux
-rw-r--r--  1 root root  9604224 Jul 21 12:07 vmlinuz-linux
-rw-r--r--  1 root root  9224128 Jul 21 12:07 vmlinuz-linux-lts
ls /boot/syslinux
------------------------------
total 2388
drwxr-xr-x 2 root root    4096 Jul 21 22:21 .
drwxr-xr-x 3 root root    4096 Jul 21 12:07 ..
-rw-r--r-- 1 root root    1588 Jul 17 21:16 cat.c32
-rw-r--r-- 1 root root   25080 Jul 17 21:16 chain.c32
-rw-r--r-- 1 root root    1228 Jul 17 21:16 cmd.c32
-rw-r--r-- 1 root root    3660 Jul 17 21:16 cmenu.c32
-rw-r--r-- 1 root root    1464 Jul 17 21:16 config.c32
-rw-r--r-- 1 root root    4236 Jul 17 21:16 cptime.c32
-rw-r--r-- 1 root root    4500 Jul 17 21:16 cpu.c32
-rw-r--r-- 1 root root    1748 Jul 17 21:16 cpuid.c32
-rw-r--r-- 1 root root    2748 Jul 17 21:16 cpuidtest.c32
-rw-r--r-- 1 root root    1572 Jul 17 21:16 debug.c32
-rw-r--r-- 1 root root    4200 Jul 17 21:16 dhcp.c32
-rw-r--r-- 1 root root    2956 Jul 17 21:16 dir.c32
-rw-r--r-- 1 root root    2000 Jul 17 21:16 disk.c32
-rw-r--r-- 1 root root    8684 Jul 17 21:16 dmi.c32
-rw-r--r-- 1 root root   12500 Jul 17 21:16 dmitest.c32
-rw-r--r-- 1 root root    3236 Jul 17 21:16 elf.c32
-rw-r--r-- 1 root root    2724 Jul 17 21:16 ethersel.c32
-rw-r--r-- 1 root root   10476 Jul 17 21:16 gfxboot.c32
-rw-r--r-- 1 root root    1576 Jul 17 21:16 gpxecmd.c32
-rw-r--r-- 1 root root  167012 Jul 17 21:16 hdt.c32
-rw-r--r-- 1 root root    3672 Jul 17 21:16 hexdump.c32
-rw-r--r-- 1 root root    1784 Jul 17 21:16 host.c32
-rw-r--r-- 1 root root    1744 Jul 17 21:16 ifcpu64.c32
-rw-r--r-- 1 root root    4112 Jul 17 21:16 ifcpu.c32
-rw-r--r-- 1 root root    4228 Jul 17 21:16 ifmemdsk.c32
-rw-r--r-- 1 root root    1872 Jul 17 21:16 ifplop.c32
-rw-r--r-- 1 root root    1648 Jul 17 21:16 kbdmap.c32
-rw-r--r-- 1 root root    4856 Jul 17 21:16 kontron_wdt.c32
-rw-r--r-- 1 root root  119668 Jul 17 21:16 ldlinux.c32
-r--r--r-- 1 root root   60416 Jul 17 21:16 ldlinux.sys
-rw-r--r-- 1 root root    5076 Jul 17 21:16 lfs.c32
-rw-r--r-- 1 root root  169824 Jul 17 21:16 libcom32.c32
-rw-r--r-- 1 root root   67544 Jul 17 21:16 libgpl.c32
-rw-r--r-- 1 root root  102512 Jul 17 21:16 liblua.c32
-rw-r--r-- 1 root root   23948 Jul 17 21:16 libmenu.c32
-rw-r--r-- 1 root root   23896 Jul 17 21:16 libutil.c32
-rw-r--r-- 1 root root    4668 Jul 17 21:16 linux.c32
-rw-r--r-- 1 root root    2964 Jul 17 21:16 ls.c32
-rw-r--r-- 1 root root    6880 Jul 17 21:16 lua.c32
-rw-r--r-- 1 root root   10896 Jul 17 21:16 mboot.c32
-rw-r--r-- 1 root root    2456 Jul 17 21:16 meminfo.c32
-rw-r--r-- 1 root root   26180 Jul 17 21:16 menu.c32
-rw-r--r-- 1 root root    3312 Jul 17 21:16 pci.c32
-rw-r--r-- 1 root root 1269898 Jul 17 21:16 pci.ids
-rw-r--r-- 1 root root    3492 Jul 17 21:16 pcitest.c32
-rw-r--r-- 1 root root    2964 Jul 17 21:16 pmload.c32
-rw-r--r-- 1 root root    1640 Jul 17 21:16 poweroff.c32
-rw-r--r-- 1 root root    3120 Jul 17 21:16 prdhcp.c32
-rw-r--r-- 1 root root    1476 Jul 17 21:16 pwd.c32
-rw-r--r-- 1 root root   12416 Jul 17 21:16 pxechn.c32
-rw-r--r-- 1 root root    1352 Jul 17 21:16 reboot.c32
-rw-r--r-- 1 root root   13952 Jul 17 21:16 rosh.c32
-rw-r--r-- 1 root root    1608 Jul 17 21:16 sanboot.c32
-rw-r--r-- 1 root root    3020 Jul 17 21:16 sdi.c32
-rw-r--r-- 1 root root   14800 Jul 17 21:16 sysdump.c32
-rw-r--r-- 1 root root       0 Jul 17 21:16 SYSLINUX_AUTOUPDATE
-rw-r--r-- 1 root root    8836 Jul 17 21:16 syslinux.c32
-rw-r--r-- 1 root root    2729 Jul 21 22:21 syslinux.cfg
-rw-r--r-- 1 root root    2936 Jul 17 21:16 vesa.c32
-rw-r--r-- 1 root root    2172 Jul 17 21:16 vesainfo.c32
-rw-r--r-- 1 root root   26728 Jul 17 21:16 vesamenu.c32
-rw-r--r-- 1 root root    1840 Jul 17 21:16 vpdtest.c32
-rw-r--r-- 1 root root    2460 Jul 17 21:16 whichsys.c32
-rw-r--r-- 1 root root    3560 Jul 17 21:16 zzjson.c32

I noticed that the "Hardware Detection Tool" shows only 1 partition, so I checked with gdisk, but everything looks good to me.

gptfdisk /dev/sda
------------------------------
Command (? for help): i
Partition number (1-4): 1
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: 9B3367E1-C8F7-4890-8760-B565F28590DC
First sector: 2048 (at 1024.0 KiB)
Last sector: 62916607 (at 30.0 GiB)
Partition size: 62914560 sectors (30.0 GiB)
Attribute flags: 0000000000000004
Partition name: ''

Command (? for help): i
Partition number (1-4): 2
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: D383EEF3-69AF-49D1-B8C8-BB1767BB9F85
First sector: 62916608 (at 30.0 GiB)
Last sector: 482347007 (at 230.0 GiB)
Partition size: 419430400 sectors (200.0 GiB)
Attribute flags: 0000000000000000
Partition name: ''

Command (? for help): i
Partition number (1-4): 3
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: CA27A61C-E0E2-4A03-8C53-E0A7448E4F59
First sector: 482347008 (at 230.0 GiB)
Last sector: 545261567 (at 260.0 GiB)
Partition size: 62914560 sectors (30.0 GiB)
Attribute flags: 0000000000000000
Partition name: ''

Command (? for help): i
Partition number (1-4): 4
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: 1B937146-425C-472F-8DD6-A77BB5A4F49E
First sector: 545261568 (at 260.0 GiB)
Last sector: 964691967 (at 460.0 GiB)
Partition size: 419430400 sectors (200.0 GiB)
Attribute flags: 0000000000000000
Partition name: ''

Any help would be greatly appreciated.

Cheers,

Last edited by dakota (2021-07-23 14:32:52)


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

#2 2021-07-22 22:54:25

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: [SOLVED] Chainloading Syslinux Fails to Boot

I haven't used bios chainloading for a long time, but don't you have to install syslinux into the bootrecord of the third partition as well?


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#3 2021-07-22 23:39:04

dakota
Member
Registered: 2016-05-20
Posts: 417

Re: [SOLVED] Chainloading Syslinux Fails to Boot

Humph. Well, I certainly didn't do that. sad

It's been a long time since I set up my original system and I've forgotten how I did it, but what you say certainly makes sense. I'll give it a try in the morning when I head back to work.

Volume Boot Record - Wikipedia

Cheers,


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

#4 2021-07-23 14:32:32

dakota
Member
Registered: 2016-05-20
Posts: 417

Re: [SOLVED] Chainloading Syslinux Fails to Boot

Yep. That was the problem. smile

I arch-chrooted in to partition 3, installed the bootloader with...

# syslinux-install_update  -iam

... but then the system wanted to load partition 3 and I couldn't chainload back to partition 1. (I probably shouldn't have used the -a option).

Anyway, once I used parted to set the legacy_boot flag on partition 1 (and remove it from partition 3) everything worked as I expected.

Thanks for your help!

Cheers,


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

Board footer

Powered by FluxBB