You are not logged in.

#1 2013-06-04 22:51:22

jwhendy
Member
Registered: 2010-04-01
Posts: 621

[SOLVED] Loading syslinux installation from Win7 / EasyBCD

Hi,


Per the last update instructions, I scanned for packages with files in /bin and /sbin and among them was grub. Half without thinking, I uninstalled grub (legacy), thinking I used syslinux. Wrong! I use syslinux on my personal laptop, but this is my dual booting work laptop. So... my time is limited before I'll need to reboot into Windows and won't be able to boot Arch without fixing the bootloader.

I used this article (well, I wrote that article after going through the process) to set up dual boot on a Windows 7 machine with MBR/full disk encryption. I just looked through the manual installation instructions for syslinux and just want to get some input before I go for the install. Here's my current partition setup:

Disk /dev/sda: 250.1 GB, 250059350016 bytes, 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xb745d9a7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   265111551   132554752    7  HPFS/NTFS/exFAT    # Windows 7 partition
/dev/sda2       265111552   265373695      131072   83  Linux    # dedicated /boot partition, ext2
/dev/sda3       265373696   326813695    30720000   83  Linux   # / partition for Arch, encrypted with LUKS/dm-crypt
/dev/sda4       326815744   488394751    80789504    7  HPFS/NTFS/exFAT    # NTFS Truecrypt partition for shared files between Win7/Arch

My process for installing grub legacy was (after the Arch install, without having used the automatic install process during installation):

 # mkdir /mnt/boot/grub
# cp -a /usr/lib/grub/i386-pc/* /mnt/boot/grub/
# grub
# root (hd0,1)
# setup (hd0,1)

So I'm looking to make sure I understand the syslinux equivalent to this, which is that I installed grub to the first disk (sda), second partition (sda2, my dedicated /boot partition).

Is this as simple as booting from an Arch installation disk, mounting my boot partition, and doing (from within live Arch disk terminal):

# mount /dev/sda2 /path/to/sda2
# mkdir /path/to/sda2/syslinux
# extlinux --install /path/to/sda2/syslinux
# umount /dev/sda2 
# dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/mbr.bin of=/dev/sda2

Again, I just want to verify this before attempting. I've not tried this sort of setup with syslinux. I won't mark sda2 as bootable since I need to use Windows' bootloader so that it is unlocked during boot up; trying to load it from a Linux bootloader will fail as it's encrypted.

Thanks for any corrections/reassurance!

Last edited by jwhendy (2013-06-13 22:09:53)

Offline

#2 2013-06-05 23:59:56

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

Update: I went ahead and installed syslinux, but EasyBCD on Windows doesn't appear to be picking it up. It appears that EasyBCD copies the mbr for the given linux boot loader to Windows. I did the following:

- boot Arch live CD
- mount my root partition (/dev/sda3)
- mount proc, sys, and dev
- mount boot partition (/dev/sda2) to /mnt/boot
- chroot in
- install syslinux with

# extlinux --install /boot/syslinux

- umount /boot
- install the altmbr to my boot partition:

# printf '\x2' | cat /usr/lib/syslinux/altmbr.bin - | dd bs=440 count=1 iflag=fullblock conv=notrunc of=/dev/sda2

Is this how I'm supposed to do it if [alt]mbr.bin is not going to be written to the actual MBR (sda), but written to a separate partition instead? Somehow EasyBCD still brings me to a grub prompt when I boot up -- I can't tell where it's finding it since I moved /boot/grub to /boot/grub.bk and have reformated /dev/sda2 prior to the above. I think EasyBCD is keeping a clone of the grub MBR perhaps and still trying to use it despite adding a syslinux entry...

Thanks for any help!

Offline

#3 2013-06-07 00:27:30

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

https://wiki.archlinux.org/index.php/Sy … ux_systems

I wrote this part, and you have to scroll down a ways to get to it, as the syslinux page is getting quite long.  Basically you use extlinux with the "-i" switch and then give it an argument of where the syslinux config is you want it to use (ie. /mnt/boot/syslinux or /boot/syslinux or /mnt/syslinux or etc.).  It uses the location of the config directory to determine what partition to write to, and then takes care of it.

Offline

#4 2013-06-07 14:57:37

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

@WonderWoofy: I do appreciate the input, and I agree that it's documented... but that's not really my question. Take a look at post #2; I think you'll find that I did what you describe:
- mount Arch root partition to /mnt
- mount /dev/sda2 (boot partition) to /mnt/boot
- run:

# extlinux --install /boot/syslinux

My question is whether this is sufficient or whether I need to dd the file /usr/lib/syslinux/mbr.bin (or altmbr.bin) somewhere as well?

It's also hard for me to figure out if I have a syslinux issue or an issue with EasyBCD, which I need to use to chainload syslinux since my computer has an encrypted MBR via McAfee Endpoint Encryption (work). I used EasyBCD fine with grub... so I think it should be fine with syslinux. I just can't tell if syslinux is for sure installed correctly. Post #2 has my most recent and documented attempt -- is there anything in it that diverges from what you're advising? Or does it look like I did everything correctly?

In this post and the other, you haven't discussed writing mbr.bin to a partition... so I'm not sure if you're just omitting that or if you're suggesting that it's not actually necessary.

Thanks!
John

Offline

#5 2013-06-07 15:02:40

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

I see what you are saying now.  No do not dd to the MBR, as you will overwrite the windows bootloader (is this what is called EasyBCD?).  The idea is that you now need to use the configuration of the windows bootloader to tell it to chainload to a partition (your linux partition).  So the installation of extlinux to the partition should be complete.  I'm unsure of what exactly it writes the the partition boot record, but that command is the for a partition the equivalent of doing a dd to the MBR. I am unsure that dd'ing the PBR is actually even a reliable thing to do... as I have not ever seen a good example of this.  I would imagine you would actually have to find the precise offset somehow.

Anyway, now your syslinux adveture is over (as long as you have a config file and everything set up already). Now you need to venture into the world of the windows bootloader.  Good luck!

Offline

#6 2013-06-07 15:13:16

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

@WonderWoofy: Thanks! So as long as I just do `extlinux --install /path/to/mounted/dev/sda2`, I'm done? I thought every bootloader still needed something written somewhere to start things up?

If not, I think I'll try re-formatting /dev/sda2 and re-installing syslinux just to make sure the beginning of /dev/sda2 is not goofed up from dd-ing to it. I definitely am not going to dd to the actual MBR (/dev/sda), but with grub I did setup(hd0,1) and grub wrote whatever it did to the second partition of the first disk (/dev/sda2) and that worked great for me.

If I definitely don't need to do anything above and beyond `extlinux --install`, then I'll focus my energy on EasyBCD. Thanks!

Offline

#7 2013-06-07 16:32:14

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

It should be fine to dd the filesystem to /dev/sda2 then use extlinux to install it.  I cannot see how this would goof anything up, and if you did indeed happen to manage that, it would tell you about it when you tried to install extlinux to the partition.  You do need to ensure that you are using a filesystem that is compatible with extlinux.  Offhand I cannot think of what those filesystems are, but I am fairly certain that it can handle ext{2,3,4} (four is what I am the most iffy about) and I think it can handle vfat. If you are using something of questionable comaptibility it is probably best to look into the documentation and see what is up.  Worst case, you can simply use the grub-legacy package from the AUR and do it that way.  I also think you can force grub2 to install the the PBR, but I am not certain on that... grub2 freaks me out in how little control it makes me feel like I have.

Though I think that this EasyBCD sounds like it might freak me out even more in how much automagic setup it tries to do for the user (I googled it real quick out of curiousity).

Offline

#8 2013-06-07 19:20:59

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

It should be fine to dd the filesystem to /dev/sda2 then use extlinux to install it.

Just to make sure I'm clear on this...
- You're suggesting to do either:

# dd if=/usr/lib/syslinux/mbr.bin bs=440 count=1 of=/dev/sda2
# printf '\x5' | cat /usr/lib/syslinux/altmbr.bin - | dd bs=440 count=1 iflag=fullblock conv=notrunc of=/dev/sda2

- And after doing that, do:

# mount /dev/sda2 /mnt
# extlinux --install /mnt/syslinux

?

Or do I do them in the opposite order?

I'm wondering if since I don't have a menu.c32, perhaps that's why it's just sitting there with a blinking cursor. I have a basic syslinux.cfg... but no menu.c32. I don't think I'll need chain.c32 since I'm not going to be loading anything else, just using EasyBCD to chain syslinux.

I really appreciate the help! I'll give a whirl to adding the syslinux menu and see if that helps; knowing which order to do the above two steps would be great. The wiki has `extlinux --install` first and then `dd ...`. Your comment kind of made it seem like I should do it the other way around. I posted on the EasyBCD support forum but I'm not sure that the answer really helped much. I can't tell if he's distinguishing between the MBR and the partition boot sector because dd-ing mbr.gin to the partition won't work, or if he was just correcting my terminology?

As far as I know EasyBCD just makes some sort of local copy of the installed bootloader and uses that on Windows startup since I can't get to the encrypted MBR myself from Linux, only when Windows is running.

Thanks again.

Offline

#9 2013-06-07 20:50:23

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

No I'm not suggesting to dd any kind of mbr file to the partition.  I thought you were indicating that you had dd'ed the entire partition to where it was now, as in you moved the filesystem from one place to another.  I would definitely not recommend dd'ing the mbr.bin to the beginning of the partition unless you can find some documentation that indicated that the beginning of a partition is exactly the same as the beginning of a disk (which I don't think it is). 

You do need to copy the necessary support files to the syslinux configuration directory just as you always have.  This is in the wiki actually.  Though I guess typically people are used to using the syslinux-install_update command, which handles this for you.  I guess you only need the supporting files that are specified in your config though, so if your config specifies menu.c32 then you need that in there.  If you are chainloading then I would imagine you need the chain.c32.

Offline

#10 2013-06-10 17:43:42

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

@WonderWoofy: thanks for the clarification. My process was exactly as described above.

- Started with fresh format of /dev/sda2
- Mounted /dev/sda2
- Installed using `extlinux --install /mount/point/of/dev/sda2
- Unmounted /dev/sda2
- dd-ed mbr.bin to /dev/sda2

I'm going to try again but just omit the last step. I'm still a bit confused about this, as I thought a bootloader had to be "installed" somewhere other than just (a) file(s) on the boot partition. What tells the system to boot syslinux, or perhaps more specifically, doesn't some baked in binary need to know to access /dev/sda2 files before /dev/sda2 is even mounted? Without some sort of binary dd'd somewhere, I wouldn't figure that syslinux would know what to do upon boot.

Anyway, I'll give it a whirl without using mbr.bin and see how that goes.


Thanks!
John

Offline

#11 2013-06-10 20:47:04

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

jwhendy wrote:

I'm going to try again but just omit the last step. I'm still a bit confused about this, as I thought a bootloader had to be "installed" somewhere other than just (a) file(s) on the boot partition.

I don't know how else to explain this to you jwhendy.  I'll try again... When you use "extlinux -i /mnt/boot/syslinux" you are telling syslinux where the configuration directory and helper files are located.  From that information it determines the partition the directory is on, and it installs syslinux to that partition for you.  In other words, it is installing itself to the partition boot record, just as you are trying to do with dd.  But I would ahve to imagine that it is not installing mbr.bin to the PBR as that binary is meant for the MBR on a MBR partitioned system.  Essentailly, assuming that the PBR is in the beginning of the partition in the exact same way as the MBR is to the disk, you are then overwriting what the extlinux command just did.  But again, I am not entirely sure how exactly a partition is laid out in that regard.

What tells the system to boot syslinux, or perhaps more specifically, doesn't some baked in binary need to know to access /dev/sda2 files before /dev/sda2 is even mounted? Without some sort of binary dd'd somewhere, I wouldn't figure that syslinux would know what to do upon boot.

I really don't know exactly what you are asking here.  What tells the system to boot syslinux from the partition is your chainloading from the MBR.  But I am unsure if that answer even relates to your question. 

To put it in a different way, extlinux determines the partition location of the config directory specified, and then calls dd (or something like it I don't know) to do that part for you. You are trying to do it twice when you call dd yourself, and I don't think you are dd'ing the right thing, and you possibly might not even be dd'ing to the right place (again, I don't have intimate knowledge of the partition boot record).

Offline

#12 2013-06-13 22:09:08

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] Loading syslinux installation from Win7 / EasyBCD

Writing from my successfully booting syslinux / EasyBCD dual boot system smile Sorry for all the back and forth. I couldn't erase from my mind that since the Wiki specifies in the instructions to dd mbr.bin to the MBR that this file would need to be written somewhere. In the end, you were absolutely right. They system needs one bootloader only, and having Windows boot and then just chainload to the syslinux files installed via `extlinux --install /mnt/path/to/dev/sda2` worked just fine.

Thanks so much for your patience and persistence in getting me to understand. I think I'll add a note on this to the Wiki since it talks about chainloading other systems from syslinux, but not chainloading from an existing system bootloader to an installed instance of syslinux.

Thanks again -- everything's working like a charm!

Offline

Board footer

Powered by FluxBB