Erik
2019-Sep-30 23:09 UTC
[syslinux] [extlinux] Failed to load ldlinux.c32 with btrfs subvolume
I am new to syslinux/extlinux. Can I boot from a linux btrfs subvolume? I am getting "Failed to load ldlinux.c32" when I attempt to boot from a btrfs subvolume. Setup: 1) I have a USB disk with one partition. The partition is marked "active". 2) I make a btrfs filesystem with "mkfs.btrfs /dev/sdd1". I mount the partiton and execute "btrfs su create root". 3) I set the default volume with "btrfs set-default 257 ." for the "root" subvolume". I unmount/mount /dev/sdd1 and then untar a Linux Debian/Buster (Testing) OS with all the latest updates and the extlinux package. 4) I "mount --bind" "proc sys dev dev/pts run" onto the mounted /dev/sdd1 and chroot to it. 5) I execute "extlinux --install /". Now I have a /ldlinux.c32 file present. I also copy the linux kernel vmlinuz-5.2.0-2-686-pae and initrd.img-5.2.0-2-686-pae to /. 6) I make a /extlinux.conf file. Here it is: # vim: ft=conf Default linux LABEL linux LINUX /vmlinuz-5.2.0-2-686-pae INITRD /initrd.img-5.2.0-2-686-pae APPEND ipv6.disable=1 rw fsck.mode=skip systemd.restore_state=0 root=/dev/sda1 rootflags=subvol=/root,noatime,nospace_cache,clear_cache 7) I unmount everything and attempt to boot the USB disk. I receive "Failed to load ldlinux.c32" on the console. extlinux: 6.04 (bf6db5b4) Note: I am able to successfully boot a btrfs subvolume if I place the extlinux.conf at / when I mount the disk with "mount -o subvolid=0 /dev/sdd1 /mnt". I "cd /mnt" and "mv root/ldlinux.c32|extlinux.conf|vmlinuz-5.2.0-2-686-pae|initrd.img-5.2.0-2-686-pae" files to /mnt. One special problem with this setup is that symbolic links are not followed. For example, if I symlink /mnt/vmlinuz -> /mnt/root/boot/vmlinuz-5.2.0-2-686-pae, extlinux will not find the Linux kernel by following the symlink. I have to copy the Linux kernel and initrd.img to /. I would like to get the subvolume setup working so I do not have to change extlinux.conf with the new Linux kernel and initrd.img filenames when I upgrade. Any suggestions would be much appreciated. Thank you for your help, Erik ?--
H. Peter Anvin
2019-Oct-01 21:52 UTC
[syslinux] [extlinux] Failed to load ldlinux.c32 with btrfs subvolume
On 2019-09-30 16:09, Erik via Syslinux wrote:> I am new to syslinux/extlinux. Can I boot from a linux btrfs subvolume? I am > getting "Failed to load ldlinux.c32" when I attempt to boot from a btrfs > subvolume.I can confirm this as a problem. The algorithm for btrfs subvolume search seems to be completely braindead, and at least in the current Linux kernels there are ioctls that perform the entire subvolume identification for us; unfortunately they were added quite recently (kernel 4.18), but perhaps that is recent enough to do something saner than what we have now. Even worse, due to *another* bug, we don't even execute the subvolume search code (which appears to only search for the default subvolume for some reason, too) at all. Either way, *in general*, I recommend putting /boot on a separate partition anyway; there are some BIOSes which have problems accessing disks beyond some point, and putting /boot on a smallish separate partition at the beginning of the disk avoids that problem. That being said, there is absolutely no question that this is a problem, and it needs to be fixed. There is also no reason to use the subvolume name (which consumes precious space in the very early boot code) as we currently do; storing the subvolume ID is far more efficient. If I'm reading the code correctly, it currently expects the root of the btrfs mount tree to be the default subvolume, so the problem occurs when the root of the tree of the mounted device is not the default subvolume. You could work around this by using "btrfs subvolume set-default" around the call to extlinux. You might even want to consider if that doesn't make sense in general for the preferred root of your filesystem. -hpa
erik at Broadlux.com
2019-Oct-01 22:32 UTC
[syslinux] [extlinux] Failed to load ldlinux.c32 with btrfs subvolume
Great. I also tried the "btrfs subvolume set-default ..." approach without using rootflags=subvol=/root. It did not work with the same error message. Thank you for your help. On 10/1/19 2:52 PM, H. Peter Anvin wrote:> On 2019-09-30 16:09, Erik via Syslinux wrote: >> I am new to syslinux/extlinux. Can I boot from a linux btrfs subvolume? I am >> getting "Failed to load ldlinux.c32" when I attempt to boot from a btrfs >> subvolume. > I can confirm this as a problem. The algorithm for btrfs subvolume search > seems to be completely braindead, and at least in the current Linux kernels > there are ioctls that perform the entire subvolume identification for us; > unfortunately they were added quite recently (kernel 4.18), but perhaps that > is recent enough to do something saner than what we have now. > > Even worse, due to *another* bug, we don't even execute the subvolume search > code (which appears to only search for the default subvolume for some reason, > too) at all. > > Either way, *in general*, I recommend putting /boot on a separate partition > anyway; there are some BIOSes which have problems accessing disks beyond some > point, and putting /boot on a smallish separate partition at the beginning of > the disk avoids that problem. > > That being said, there is absolutely no question that this is a problem, and > it needs to be fixed. There is also no reason to use the subvolume name (which > consumes precious space in the very early boot code) as we currently do; > storing the subvolume ID is far more efficient. > > If I'm reading the code correctly, it currently expects the root of the btrfs > mount tree to be the default subvolume, so the problem occurs when the root of > the tree of the mounted device is not the default subvolume. You could work > around this by using "btrfs subvolume set-default" around the call to > extlinux. You might even want to consider if that doesn't make sense in > general for the preferred root of your filesystem. > > -hpa
Ady Ady
2019-Oct-02 15:46 UTC
[syslinux] [extlinux] Failed to load ldlinux.c32 with btrfs subvolume
> I am new to syslinux/extlinux. Can I boot from a linux btrfs subvolume?See: syslinux.org/wiki/index.php?title=Filesystem#Btrfs Please note that you need at least 6.04-pre1. Unfortunately, 6.04-pre2 and 6.04-pre3 are not helpful for troubleshooting; avoid them. Hopefully the above helps in some way(?). Regards, Ady.
Apparently Analagous Threads
- extlinux: Failed to load ldlinux.c32 with btrfs subvolume
- extlinux| Failed to load ldlinux.c32 with btrfs subvolume
- [extlinux]Failed to load ldlinux.c32 with btrfs subvolume
- [extlinux] Failed to load ldlinux.c32 with btrfs subvolume
- [patch] 6.03 extlinux/main.c typos