How to boot Linux with extlinux

13,827

Solution 1

Okay, so as you wanted, here are the absolute minimum steps for me to install extlinux:

sudo apt-get install extlinux
sudo extlinux --install /boot/extlinux

And this did it. Couldn't really believe it but that worked. So here is some extra information: My system (uname)

3.13.0-24-generic (Kernel)
#46-Ubuntu SMP .. (Kernel version)
i686 (Processor and machine)

And the

apt-cache policy extlinux
extlinux:
  Installed: 3:4.05+dfsg-6+deb8u1
  Candidate: 3:4.05+dfsg-6+deb8u1
  Version table:
 *** 3:4.05+dfsg-6+deb8u1 0
        500 http://de.archive.ubuntu.com/ubuntu/ trusty/universe i368 Packages
        100 /var/lib/dpkg/status

The /boot/extlinux/extlinux.conf

default l0
prompt 1
timeout 50
include themes/debian/theme.cfg

I think it is the same as yours. And i don't think the debian-theme will vary. So here is my specific linux.cfg:

label l0
    menu label Ubuntu GNU/Linux, kernel 3.13.0-24-generic
    linux /vmlinuz-3.13.0-24-generic
    append initrd=/initrd.img-3.13.0-24-generic root=UUID=61e460f5-878a-4cff-be9c-12239153d59c ro quiet
label l0r
    menu label Ubuntu GNU/Linux, kernel 3.13.0-24-generic (recovery mode)
    linux /vmlinuz-3.13.0-24-generic
    append initrd=/initrd.img-3.13.0-24-generic root=UUID=61e460f5-878a-4cff-be9c-12239153d59c ro single
    text help
    This option boots the system into recovery mode (single-user)
    endtext

Okay, that's it.But here is some other interesting thing i found out about the boot process: I created "myvmlinuz" and "myinitrd.img" as copies of the original files under /boot and edited the extlinux.conf file to the following:

default test
prompt 1
timeout 50
#include themes/debian/theme.cfg
LABEL test
    MENU Test entry
    LINUX /myvmlinuz
    APPEND initrd=/myinitrd.img root=UUID=61e460f5-878a-4cff-be9c-12239153d59c

As far as i understand it, this is the minimum configuration to get a system working. Boots fine for me. Note that / is the root folder of the partition flagged as boot with extlinux on it in these files.

APPEND initrd=/myinitrd.img root=/dev/sda5

did also work. I used different partitions on one disk for / (sda5), /boot (sda1), swap and so on. I created /boot as a primary partition, don't know if that's important. Maybe you can try

cat /usr/lib/extlinux/mbr.bin > /dev/sda

if grub did something bad.

Well, I hope you get it to run, please let me know if it works!

Solution 2

This is a breakdown of a standard "manual" installation, for MBR:

Assuming you are installing Extlinux it on disk disk device /dev/sda:

  • Install a standard MBR on the disk. This MBR will look for and try to boot any partition which has the "boot" flag.
    dd /usr/lib/extlinux/mbr.bin of=/dev/sda bs=440 count=1
  • Set the boot flag on the partition which will contain EXTLINUX
  • Copy extlinux files and used modules to a directory (or root) in the boot partition. Let's use /boot/, for the the sake of the example.
  • Install a bootloader on this partition and point it to the syslinux directory.
    extlinux --install /boot/
  • Make sure the configuration is correct.

So when you boot, the MBR will load the bootable partition bootloader, which will launch EXTLINUX which will read extlinux.conf.

Some steps might be redundant, yet I think it is be nice to write out the steps for having an idea of what happens.

I like EXTLINUX. This is how software should be. I can actually know and understand what is happening and I learned something new about computers by using it.

Solution 3

Here is a good tutorial about Configuring extlinux's auto-update on Debian that should be what you are looking for:

A few days ago, I wrote about how to set up and configure extlinux (syslinux) as a bootloader. But on Debian or Ubuntu, if you make changes to files like /boot/extlinux/extlinux.conf directly, they'll be overwritten.

The configuration files are regenerated by a program called extlinux-update, which runs automatically every time you update your kernel. (Specifically, it runs from the postinst script of the linux-base package: you can see it in /var/lib/dpkg/info/linux-base.postinst.)

[...]

Share:
13,827

Related videos on Youtube

xpt
Author by

xpt

Updated on September 18, 2022

Comments

  • xpt
    xpt 5 months

    EDIT: Just adding my two more cents after this question becomes a "popular" one. I had been a great fan of grub because it was able to boot everything that I used. However, when grub2 came, I really don't like it because it is

    • humongous itself
    • leave loads of junks at my /boot folder that 99.9% are useless to me
    • the "enhanced" syntax is over complicated to me
    • try booting UEFI using grub2 is really a ROYAL PITA
    • I was able to use grub as my CD boot loader, but I don't know if grub2 can do that or not -- I don't care any more, because I found a better alternative.

    The syslinux ecosystem (including extlinux) are now booting everything that I use, CD/DVD, FAT, Ext2/3/4, and even Btrfs. Moreover, it handles MBR/PBR relay or GPT without a hitch. It's small, to the point, and maintain a universal syntax across the board. The extlinux (syslinux) is currently my chosen solution to boot anything I use.

    Now back to OP.

    Anyone knows how to properly boot Linux with extlinux?

    I've exhausted my google search but still unable to figure out what's the proper way to setup extlinux to boot Linux. All hits that I found talk about editing the/boot/extlinux/extlinux.conf file directly. However, there is a big warning inside it that discourages me doing so:

    ## /boot/extlinux/extlinux.conf
    ##
    ## IMPORTANT WARNING
    ##
    ## The configuration of this file is generated automatically.
    ## Do not edit this file manually, use: extlinux-update
    default l0
    prompt 1
    timeout 50
    include themes/debian/theme.cfg
    

    I've run extlinux-update or extlinux -update in all sorts of ways a gazillion time but the file still remains the same. The problem is, this file won't boot anything!

    If I edit it myself, and run extlinux-update again, then BOOM, it gets back to the above boot-nothing version again.

    Anyone knows how to properly setup extlinux under Ubuntu to boot it (without directly editing extlinux.conf)?

    This is the extlinux from latest Ubuntu Trusty BTW:

    % apt-cache policy extlinux
    extlinux:
    Installed: 3:4.05+dfsg-6+deb8u1
    Candidate: 3:4.05+dfsg-6+deb8u1
    Version table:
    *** 3:4.05+dfsg-6+deb8u1 0
    500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
    100 /var/lib/dpkg/status
    
    • ju.kreber almost 9 years
      Did you go trough all the steps mentioned here edoceo.com/howto/extlinux? Editing the main configuration file shouldn't be a problem to experiment a bit. As i know it from grub i guess there are some files in some directories (maybe somewhere in /etc?) which include instructions what should be done into this main config file and running the update command applys these changes. Of course then in your case the file is the same as before. So you'd better be off finding those files and editing them (if they exist, just a guess)
    • xpt
      xpt almost 9 years
      Nice link/info. Thanks. Unfortunately, that also falls into the category of "editing the extlinux.conf file directly", which doesn't help much for my situation.
    • ju.kreber almost 9 years
      Well then please describe your problem a bite more precise. What have you tried already? Have you updated your MBR? Are the bootloader files all present in the /boot/extlinux directory? Then do configure the configuration file in order to load a kernel. Have a look at this: wiki.archlinux.org/index.php/syslinux#Configuration You of course need to tell your extlinux which kernel and initrd to load. And please specify how far the system currently boots. Do you see a promt? Or a message like "no operating system found"?
    • ju.kreber almost 9 years
      By the way, if you say "oh no that falls into the category 'editing the file directly' - so this won't help me" you will never get a result. You should try to understand what you do, not only do it. If your attempts editing this file failed, you'd better be off trying to understand why it failed than saying it definetely won't help you. And as far as i see it, it will help you. Because you did not tell your bootloader what it shall load. It can't guess where your kernel is located. You can run the script "all sorts of ways a gazillion time" and it won't change that.
    • xpt
      xpt almost 9 years
      "Then do configure the configuration file in order to load a kernel. Have a look at this: wiki.archlinux.org/index.php/syslinux#Configuration You of course need to tell your extlinux which kernel and initrd to load" I keep asking where should I do the configuration, and you keep referring back to editing the extlinux.conf file directly. As I explained in OP, such practice is strongly discouraged because there is a big warning inside it and the editing will disappear in any moment. If you want to answer my question, then please at least try to understand what I'm asking.
    • xpt
      xpt almost 9 years
      "And please specify how far the system currently boots. Do you see a promt? Or a message like "no operating system found"? If you know how extlinux.conf should be written, then you should at least know what the symptom is, because it's quite obvious. Please understand that this is not a forum, that encourages participation. I appreciate that you trying to help, but please understand this is a Q&A site. It is not for length back and for discussion, it's for questions to be answered.
    • xpt
      xpt almost 9 years
      If you know how many ways the extlinux-update can be called, then you will know what you said, the reply that contains "If your attempts editing this file failed, you'd better be off trying to understand why it failed", is totally wrong and completely unnecessary. This is the end of the discussion. I don't want to argue with you any further.
    • ju.kreber almost 9 years
      I don't want to argue with you either, I seriously try to help you fixing this problem. Maybe some of the comments were written a bit sharp, sorry for that. But please, at least try and answer what i said. But you're right this is not a forum, enough about that. I just set up an extlinux environment with ubuntu and it works fine for me. I followed the instructions here shallowsky.com/linux/extlinux.html and here manpages.ubuntu.com/manpages/natty/man8/extlinux-update.8.ht‌​ml. The second link describes how to set up extlinux without a direct edit of the main configuration file.
    • ju.kreber almost 9 years
      So please tell us which steps you went through, compared to the first link in my last comment. And please tell us how far your system boots currently.
    • ju.kreber almost 9 years
      Please also provide some information about your system: your disks and your partitions and their format. The last line of the extlinux.cfg refers to a configuration with a debian-styled menu. In order to find the problem, it would be easier for us to understand it if you commented out the last line and added the kernel-stuff configuration manually (although there is a warning). Is there a linux.cfg file in your /boot/extlinux directory? If so, what is written in it?
    • xpt
      xpt almost 9 years
      "I just set up an extlinux environment with ubuntu and it works fine for me" Oh, thanks a lot for trying to help me out. Sorry I wasn't in a good mode last night. "The second link describes how to set up extlinux without a direct edit of the main configuration file", you mean tweaking the /etc/default/extlinux file right? Yeah I did. "Is there a linux.cfg file in your /boot/extlinux directory" Yes, there is, and its content is correct. So let me ask you instead, did you touch the /boot/extlinux/extlinux.conf file after running extlinux-update so as to make it working, or it just- work?
    • ju.kreber almost 9 years
      No problem. Yup, i mean exactly that. Okay. No I didnt, it just worked. Okay, if its content is correct, that means the kernel and initrd name refer to existing files and you have a root=/dev/whatever or a root=UUID=whatever in the append? Soo what happens if you write this data directly into the extlinux.conf file? I assume your error is you land in a boot: promt and it can't find the kernel?
  • xpt
    xpt almost 9 years
    Thanks a lot for the detailed comprehensive answer. There were two confusions for me when I was asking the question. 1st) Coming from grub, I had the empirical thinking that once the extlinux-update is run, something will happen to the extlinux.conf file, exactly the same as your 1st respond "As i know it from grub i guess there are some files in some directories (maybe somewhere in /etc?) which include instructions what should be done into this main config file and running the update command applys these changes."
  • xpt
    xpt almost 9 years
    2nd confusions for me) In my Ubuntu 13.10, I have include linux.cfg etc in extlinux.conf; where is in the new Ubuntu 14.04, they are "missing", and I thought extlinux-update will get them back.
  • Ramhound
    Ramhound over 6 years
    This does not really answer the author's question. The tutorial isn't very helpful since it adds very little that wasn't stated in the existing answer
  • xpt
    xpt almost 5 years
    Nice Rolf, thanks. So you too don't need to tweak /boot/extlinux/extlinux.conf either? What's the content of your /boot/extlinux/extlinux.conf file?
  • Rolf
    Rolf almost 5 years
    You are welcome. In my case I did a custom install and I edited the conf file. There is a reference on the extlinux site, for that. However in this case you have to update the conf file every time you update your kernel. So it's better to use an automated way if available. I haven't looked enough into that yet.
  • Rolf
    Rolf almost 5 years
    This is pretty helpful information. The OP also mentioned that he does not want to edit the config file directly. So this could solve his problem.