linux - How to use Syslinux to chainload Ubuntu installation?

07
2014-07
  • Noverull

    I try my best to detail my question. If it would run out of your patience, go to lastest paragraph.

    I downloaded Ubuntu 13.04 from its official site and extracted files to a folder ubuntu\ on USB stick( Z: for example). So files are now in Z:\ubuntu\

    Before that, I downloaded Syslinux 5.10( 6.00 has bugs) and used it to install boot code to USB stick with this command:

    syslinux.exe --mbr --active --directory /boot/syslinux/ --install Z:

    Then I copied chain.c32 and required libs to Z:\boot\syslinux and added to syslinux.cfg( unimportant part is ignored):

    COM32 chain.c32

    APPEND isolinux=/ubuntu/isolinux/isolinux.cfg

    Syslinux booted successfully but failed to boot Ubuntu, saying:

    Err: option 'maps' requires a sector'', but I didn't know what it meant.

    Then I tried loading Ubuntu's isolinux configure using:

    config /ubuntu/isolinux/isolinux.cfg /ubuntu

    But only got message saying:

    Loading gfxboot... Failed: No such file or directory

    I tried again with:

    config /ubuntu/isolinux/isolinux.cfg /ubuntu/isolinux/

    And it said:

    Failed to load COM32 file gfxboot.c32

    But I could see LABELs with [TAB] Key:

    boot:

    live live-install check memtest hd mainmenu help

    So I tried booting Ubuntu via command line:

    boot: live

    And it showed that:

    Loading /casper/vmlinuz failed: No such file or directory

    I think Syslinux recognizes Z:\ as root directory /, not Z:\ubuntu\, so it failed to load vmlinz. So I moved files to Z:\ and reboot. Though syslinux still failed to load gfxboot but I booted into Ubuntu successfully with

    config /isolinux/isolinux.cfg /isolinux/

    boot: live

    I don't understand why it could not load gfxboot.c32 when it read isolinux configure correctly. Maybe syslinux I use and isolinux Ubuntu uses are not the same, and the bootcode and gfxboot are not compatible.

    Syslinux Wiki mentions that CONFIG can restart the boot loader using a different configuration file and set new home directory using:

    CONFIG /path/to/cfg/file/configfile.cfg /path/to/new/base/dir

    I followed the guide but filed to let Syslinux set Z:\ubuntu\ as root directory. Maybe I misundertood this guide.

    So my question is, how to put Ubuntu or other Operation System into a standalone folder and configure syslinux properly to set direcotry where Ubuntu or other OS is as root directory so that I could boot the OS successfully?

  • Answers
  • Szymon Szydełko

    Ok, after assembling facts and re-re-reading question and our discussion: You can't install Operating system to "folder" (That is, you can't install Linux to folder like /ubuntu/, you need to install it to/folder). Linuxes want a full featured partition: they need to put/usr,/var`, on root of what they see as filesystem. (chrooting aside)

    Also, Linux can't be installed on FAT-32. This file system lack symlinks and some other facilities which are bedrock of Linux operation.

    You need ext3/4, xfs or other supported real filesystem. However, you can just install ubuntu on usb like on any normal hdd - just setup: fat32 or ext2 partition for boot{manager,loader} and kernel image, and ext4 for operating system. You'll be able to apt-get programs on in, save documents and whatnot.


  • Related Question

    linux - Dynamic SYSLINUX menu?
  • nonoitall

    Is it possible to have a menu in SYSLINUX that will automatically list all of the files in a given directory and allow the user to choose one to boot from as a kernel?


  • Related Answers
  • gerth

    With the last versions of Syslinux (4.xx), you have an ls.c32 module with which you can list a directory. You still need to enter the commandline for booting your kernel yourself.

  • Josh

    One option would be to write a script, which you could run manually or could be set to run automatically (perhaps at shutdown), which looks through the directory and rebuilds the syslinux config file for you. This gives you more control to specify exactly what arguments, etc. might be needed, and to have some default options that show up regardless of the contents of the directory.