You are not logged in.

#1 2016-12-27 00:08:01

AntiMS
Member
Registered: 2016-12-26
Posts: 9

[Solved] Extlinux in a subdirectory on a pendrive

I've got a USB 2.0 pendrive with syslinux and a single vfat partition. Syslinux is installed to <pendriveroot>/boot/syslinux. I've got a syslinux.cfg in there along with all of the *.c32 modules.

I just got a USB 3.0 pendrive (for Christmas wink ) and was wanting to migrate what I've got on my old pendrive to the new one. Being sick of the 4GB file size limit on vfat, I figured I'd also switch from vfat to ext4 and from syslinux to extlinux.

My old pendrive has the *.c32 module files and syslinux.cfg in boot/syslinux . (Oddly, it also has an ldlinux.sys and an ldlinux.c32 in the root of the drive. I'm not actually sure if these are necessary for it to boot properly.)

I wanted to mirror this structure on the new pendrive (except boot/extlinux rather than boot/syslinux.)

I'm only concerned with BIOS systems so far. (I'll deal with UEFI at some point, probably, but I don't really have any UEFI boxes I have to deal with at the moment.)

This is the first time I've dealt with extlinux rather than syslinux. It's entirely possible I'm missing something fairly simple.

What I've done so far is:
1. Deleted the factory-default partition and added a new partition of type "Linux" with the bootable flag set
2. Formatted the partition ext4 with default options
3. Mounted the partition to /mnt/usb
4. Created the directory /mnt/usb/boot/extlinux (along with its parent)
5. Installed extlinux with: extlinux --install /mnt/usb/boot/extlinux
6. Copied /usr/lib/syslinux/bios/*.c32 to /mnt/usb/boot/extlinux/
7. Copied the syslinux.cfg (with its nice menu and all) from my old pendrive to my new pendrive as /mnt/usb/boot/extlinux/extlinux.conf
8. Copied everything else relevant from my old pendrive to my new pendrive (various miscellaneous kernels, initramfs's, disk images, etc)
9. Set up the mbr with: dd bs=440 count=1 if=/usr/lib/syslinux/bios/mbr.bin of=/dev/sdb

At least everything I've run into so far indicates what I've done so far is roughly correct, though I could easily be missing something.

Booting from the new pendrive, I get the message:

SYSLINUX 6.03 EDD 6.03* Copyright (C) 1994-2014 H. Peter Anvin et al

Failed to load ldlinux.c32
Boot failed: please change disks and press a key to continue.

Copying ldlinux.c32 to the root of the drive removes the error message and gets me to a "boot:" prompt, but it doesn't seem to find my config file, and who knows if it *would* find the *.c32 modules in boot/extlinux.

In short, what I want is a working extlinux on my pendrive confined to boot/extlinux. Given that putting ldlinux.c32 on the root of the drive removes the message, I'd guess that putting the *.c32 files and extlinux.conf at the root of the drive would fix it, but I'd like not to have to resort to that if possible.

Thanks in advance for your help!

Last edited by AntiMS (2016-12-30 21:11:33)

Offline

#2 2016-12-27 21:23:50

Awebb
Member
Registered: 2010-05-06
Posts: 6,309

Re: [Solved] Extlinux in a subdirectory on a pendrive

Syslinux works well with ext4.

Partition -> ext4 -> pacstrap+arch-chroot -> syslinux -> arch on a stick.

Offline

#3 2016-12-28 20:14:06

AntiMS
Member
Registered: 2016-12-26
Posts: 9

Re: [Solved] Extlinux in a subdirectory on a pendrive

Huh. Are you saying I shouldn't even be using the extlinux command?

That is:

syslinux --directory boot/syslinux --install /dev/sdb1

Rather than:

extlinux --install /mnt/usb/boot/extlinux

?

All rightey. I'll try it out and see what happens. Thanks!

Offline

#4 2016-12-28 20:31:35

AntiMS
Member
Registered: 2016-12-26
Posts: 9

Re: [Solved] Extlinux in a subdirectory on a pendrive

Well, using the "syslinux" command rather than "extlinux" gives me "syslinux: invalid media signature (not an FAT/NTFS volume?)"

So, it looks like the "extlinux" command is indeed necessary for my use case.

Thanks for your input, though. smile

Last edited by AntiMS (2016-12-28 20:36:09)

Offline

#5 2016-12-28 20:44:23

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,560
Website

Re: [Solved] Extlinux in a subdirectory on a pendrive

Is there a reason you're not just following the wiki?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2016-12-28 21:32:56

AntiMS
Member
Registered: 2016-12-26
Posts: 9

Re: [Solved] Extlinux in a subdirectory on a pendrive

Trilby wrote:

Is there a reason you're not just following the wiki?

Well, I had a working Syslinux installation going on a previous pendrive which worked out fine. I was really hoping to mostly move that straight over with little modification.

The only differences between what I was doing and and what was mentioned directly on the wiki page were:

  • I was using the directory "<usbroot>/boot/extlinux/" rather than "<usbroot>/syslinux/" for my syslinux installation (where my ldlinux.sys, *.c32, and configuration live)

  • and I was mounting my pendrive at "/mnt/usb" rather than "/boot"

(It's also true that what I've done follows the "manual install" path rather than the "syslinux-install_update" script.)

I wouldn't think the latter would make a difference (and I'm 99% certain when I set up my previous pendrive with syslinux, I had it mounted at "/mnt/usb") . To be honest, I didn't think the former could make a difference either, and I'm pretty sure I'd read somewhere that "<usbroot>/boot/extlinux" was a valid location, but obviously it's not working, so I figured that might be the problem.

So, I tried switching to "<usbroot>/syslinux/". I backed up my config file, deleted my "<usbroot>/boot/extlinux" (had to "chattr -i ldlinux.sys" in there), made my "<usbroot>/syslinux" directory, ran my "extlinux --install /mnt/usb/extlinux", and copied my configuration and /usr/lib/syslinux/bios/*.c32 into /mnt/usb/syslinux. On booting from that pendrive, it's finding my ldlinux.c32 now, but not my configuration. (I tried putting my configuration both at "<usbroot>/syslinux/syslinux.cfg" and at "<usbroot>/syslinux/extlinux.conf" which are the two locations mentioned on the wiki page.)

Offline

#7 2016-12-28 21:47:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,560
Website

Re: [Solved] Extlinux in a subdirectory on a pendrive

AntiMS wrote:

The only differences between what I was doing and and what was mentioned directly on the wiki page were...

You haven't mentioned using dd to install the MBR.  This is one of the things the syslinux-install_update script does for you.  But if you want to do it manually, go for it ... but then you must actually do all the steps, not just one of them.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2016-12-28 21:49:43

AntiMS
Member
Registered: 2016-12-26
Posts: 9

Re: [Solved] Extlinux in a subdirectory on a pendrive

Trilby wrote:

You haven't mentioned using dd to install the MBR.  This is one of the things the syslinux-install_update script does for you.  But if you want to do it manually, go for it ... but then you must actually do all the steps, not just one of them.

I mentioned that in my first post. Point #9 in the list.

Edit: Oh, or are you suggesting it might need to be done *again*?

Last edited by AntiMS (2016-12-28 21:52:52)

Offline

#9 2016-12-28 21:53:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,560
Website

Re: [Solved] Extlinux in a subdirectory on a pendrive

Sorry, you certainly did include that.  *headdesk*

But it looks like you are thinking extlinux and syslinux are different things.  You are using the extlinux tool to install syslinux as your bootloader.  Does syslinux read an extlinux.cfg?  I know it will read a syslinux.cfg.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2016-12-28 21:56:55

AntiMS
Member
Registered: 2016-12-26
Posts: 9

Re: [Solved] Extlinux in a subdirectory on a pendrive

Yeah, to be honest, I wasn't really 100% clear on whether syslinux and extlinux were two different things. Heh. (Apparently they were at one time but extlinux eventually got merged into syslinux... whatever. Lol.) Thanks for clearing it up for me. smile

I've tried "<usbroot>/syslinux/syslinux.cfg" and "<usbroot>/syslinux/extlinux.conf" (and a few others), but I haven't tried "<usbroot>/syslinux/extlinux.cfg" yet. It only takes a sec to try it, so I'll see what that does.

Edit: Tried it. No dice. sad

Last edited by AntiMS (2016-12-28 22:00:33)

Offline

#11 2016-12-29 05:05:21

AntiMS
Member
Registered: 2016-12-26
Posts: 9

Re: [Solved] Extlinux in a subdirectory on a pendrive

Well, the source of syslinux itself seems to indicate the path "<usbroot>/syslinux/syslinux.cfg" should work fine (as well as several others I've already tried.)

These two files seem to be the relevant parts:
http://repo.or.cz/syslinux.git/blob/ref … adconfig.c
http://repo.or.cz/syslinux.git/blob/ref … chconfig.c

I tried moving my config to the root of the pendrive named "syslinux.cfg" just to see what would happen. It displayed my boot menu, but none of the options worked. The first one only reset the countdown. The others seemed to do "nothing". All of the paths in my config file are absolute paths relative to the root of the pendrive.

Oy. Not sure quite what's going on here.

Offline

#12 2016-12-30 21:10:33

AntiMS
Member
Registered: 2016-12-26
Posts: 9

Re: [Solved] Extlinux in a subdirectory on a pendrive

I figured it out!

After some digging, I found this bit on the Syslinux wiki (via this Syslinux mailing list post).

It turns out the "64bit" feature of ext4 (which is on by default in newer versions of mke2fs) breaks Syslinux.

The fix was just to reformat my partition with:

mke2fs -O ^64bit /dev/sdb1

And then of course re-setup Syslinux mostly from scratch (except that the mbr.bin didn't need to be written to the MBR again since reformatting the partition didn't touch the MBR.)

So, I'm all set up, now. Thanks everybody for your input. big_smile

I'll mark this thread "[solved]".

Edit: Aaaaaand I just noticed the warning about the "64bit" feature at the top of https://wiki.archlinux.org/index.php/Syslinux . :facepalm: Oh well. Thanks everybody.

Last edited by AntiMS (2016-12-30 21:13:17)

Offline

Board footer

Powered by FluxBB