LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 08-18-2016, 10:41 AM   #1
oldwierdal
Member
 
Registered: Apr 2009
Location: Yuma, Arizona, USA
Distribution: Linux Mint 17 with Mate DE
Posts: 58
Blog Entries: 1

Rep: Reputation: 4
Lightbulb Using Syslinux/Extlinux as alternative boot-loader to Grub


I suppose that Linux users who only have one operating system on their machines, in other words those who do not dual-boot or multi-boot could probably get along just fine with Grub2 as their boot-loader, and never experience any problems at all. And for them, the question of whether to use Grub or some other boot-loader has never occurred to them. And so this discussion will probably be of no interest.
However, for users who dual/multi-boot to other operating systems, or just to other Linux distributions, the resulting boot menu can be confusing and very frustrating.

For years, I have kept at least one alternative OS on a separate hard drive, including Windows at times, in addition to having a bootable clone of my primary operating system, also on a separate hard drive. I had built my own desktop computer from a bare-bones kit, and had enough bays for three hard drives and a cd/dvd drive.
Now, even if you aren't interested in playing around like this, I would still advocate for using a separate hard drive as a backup for your primary system. And that could lead you to need the ability to dual/multi-boot.

I have been using Linux Mint as my operating system of choice for 5 or 6 years, and I am currently using Linux Mint 17.3 (Rosa). Dating from several years before that, I had rejected the use of grub2 or grub-pc because of its complexity and, for me, superfluous and completely non-essential files cluttering up the /boot/grub directory. I can't argue against the notion that perhaps grub-legacy needed to be updated/upgraded. But, again, in my humble opinion, grub2 went well beyond what was necessary just to boot a machine. All the admonitions to "just get used to it" and "then it won't seem so bad," and advice for little tricks to keep grub2 from screwing up grub.cfg seemed to me to just be ways to "tolerate" a poorly written program. So, for those several years, I would always dump grub-pc, and install grub-legacy. It is simple! And it just works!

Some months back, around January or February 2016, I discovered that the grub-legacy command; grub-install, had stopped working. I had made some major changes to my system, and needed to re-install grub. I posted on Linux Mint forums about this problem, but only received encouragement to "get used to grub2 (grub-pc) as grub-legacy was no longer supported, and that I was unlikely to get any assistance" with my problem. In fact, I didn't receive any advice on how to repair the broken 'grub-install' of grub-legacy.

I was able to boot to an old Debian 6.03 dvd which I kept handy as a rescue disk. And, from there, load my primary hard drive, and execute '/usr/sbin/grub-install --recheck /dev/sd*'. Within minutes, I had restored grub, and had a working system in spite of all the well-intended advice.

I was reluctant to accept that I "must" use grub2. After some searching, I discovered Syslinux/extlinux, which in my opinion is only slightly more involved than grub-legacy, but immeasurably simpler than that unnecessarily complicated grub2.

Both syslinux and extlinux are "in stock" from "trusty" packages. You will also need syslinux-common, and I find that 'syslinux-themes-linuxmint-mate' and/or 'syslinux-themes-debian-wheezy' are nice little programs to make your boot-splash pretty to your own tastes.

But, as for installing and configuring Syslinux/Extlinux, there are a few links for "how-to"s, all of which will get things done for you, but none of which is a really well written tutorial.

These following instructions are a direct lift from the following two links; http://shallowsky.com/linux/extlinux.html and http://shallowsky.com/blog/linux/ins...ux-debian.html. I just tinkered with them, combined some things, and this is the result. But, in all honesty, all the heavy lifting was done in these links. My thanks to these links which, put together, gave me a working bootloader which has not failed, even after installing new kernels and modifying boot order. Cool!

I prefer to do work involving system changes from a root terminal. I have it customized so that the root terminal is immediately recognized as such by the distinctive red font on bright yellow background, and I have never done anything stupid with the root terminal. However, some experts frown on this practice, and insist that users should use "$ sudo what-ever-command". If that is your preference, by all means, use the regular terminal, and simply add the "sudo" at the start of all of the following steps. Follow these steps, as root, STEP-BY-STEP. Skipping a step, or taking steps in the wrong order could lead to failure. However, I think that most users with even modest keyboard skills will find that setting up extlinux as your bootloader will be quite simple, and very, very reliable. Enjoy!

# apt-get install extlinux syslinux syslinux-common syslinux-themes-linuxmint-mate syslinux-themes-debian-wheezy

Syslinux might well be already installed in which case 'apt-get' will choke, saying that 'syslinux' is already installed. In that case just enter;

#apt-get install extlinux syslinux-common syslinux-themes-linuxmint-mate syslinux-themes-debian-wheezy

Or, you could just use synaptic, and install them all from there. After they have been installed, as root enter;

# extlinux --install /boot/extlinux

This will install some very necessary files.

[I]####################################################################################
Mon 15 Aug 2016 12:07:04 PM MST
#################### THIS STEP IS CRITICAL FOR EXTLINUX/SYSLINUX TO WORK ##########
As root, enter; # fdisk -l /dev/sda and check that the drive to which you plan to install the bootloader has the ( * ) under the Boot column. The easiest way to be certain that the disk is flagged as bootable is to use gparted, then right click on the first partition of the drive you intend to use, and click on the box for 'boot'.
As I said, this is critical! Somehow, all of my drives which had been used as 'bootable' lost the 'boot' flag! Suddenly, my machine would not boot, saying that it could not find an operating system. Some time in June or July, the grub-legacy 'grub-install' problem was fixed, and I was able to re-install grub-legacy, but I wasted a couple of days trying to figure out what the hell had happened to extlinux! I tried everything I could think of. Why would it boot to grub-legacy, but not to extlinux?? And as I went through all of the steps described in all the tutorials, I had absent-mindedly passed over this step. Once a disk is flagged as bootable, I had never heard of the flag being somehow removed! Finally, it dawned on me that I should probably ACTUALLY CHECK that the disk was correctly flagged! Wull DUH!######################################################

[/I]
# fdisk -l

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 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 identifier: 0x000cdb06

Device Boot Start End Blocks Id System
/dev/sda2 * 2048 43010047 21504000 83 Linux
/dev/sda3 43010048 1461053439 709021696 83 Linux
/dev/sda4 1461053440 1465147189 2046875 82 Linux swap / Solaris

Disk /dev/sdb: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 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 identifier: 0x000d072e

Device Boot Start End Blocks Id System
/dev/sdb2 * 2048 43010047 21504000 83 Linux
/dev/sdb3 43010048 1463101439 710045696 83 Linux
/dev/sdb4 1463101440 1465148314 1023437+ 82 Linux swap / Solaris

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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 identifier: 0xd13616a4

Device Boot Start End Blocks Id System
/dev/sdc1 * 2048 40962047 20480000 83 Linux
/dev/sdc2 40962048 974725119 466881536 83 Linux
/dev/sdc3 974725120 976773119 1024000 82 Linux swap / Solaris

Disk /dev/sde: 2004 MB, 2004877312 bytes
191 heads, 11 sectors/track, 1863 cylinders, total 3915776 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 identifier: 0xc3072e18

Device Boot Start End Blocks Id System
/dev/sde1 2048 3915775 1956864 b W95 FAT32

You should do this for EVERY DISK which you intend to use as bootable! I, for one, like to install my bootloader onto every drive, sometimes even including a usb thumbdrive. In this particular instance, I have chosen not to use my usb thumbdrive as a bootloader, instead allowing for any of the three hard drives to be selected in BIOS as the first drive. This is particularly helpful if a previously used hard drive has failed for some reason. I can just remove the failed drive, and select one of the other two drives from which to boot my machine. Whether or not I actually replace the failed drive doesn't matter at this point.

Next, also as root, install extlinux to your mbr;

# dd if=/usr/lib/extlinux/mbr.bin of=/dev/sd* bs=440 count=1

(substitute the drive letter you want the mbr installed on for the (*). The warnings about installing to the mounted and running drive only apply if you are just using extlinux to build a bootable floppy/flashdrive. Since I am replacing grub with extlinux, I really do want to install the mbr to the drive I'm running as well as my backup drive and my testing drive. If installing mbr to multiple drives, substitute the (*) with each of your intended drives.)

You won't want to reboot just yet. There are a couple of things you need to do. Extlinux needs a little extra code in order to display a menu. On Debian, that code comes from the syslinux-common package rather than the extlinux package, which is why I said earlier that you should install both. Copy the menu files into place:

# cp /usr/lib/syslinux/*menu* /boot/extlinux

If you'll be dual-booting Windows or another OS, you'll also need the chain-loader:

# cp /usr/lib/syslinux/chain.c32 /boot/extlinux

Now you can add a line to /boot/extlinux.conf to turn on the menu :

ui vesamenu.c32

You might want to edit the files which determine how the boot loader behaves. I would start with /etc/default/extlinux. Mine looks like this. Use your favorite text editor.

#gedit /etc/default/extlinux

## /etc/default/extlinux - configuration file for extlinux-update(8)

#EXTLINUX_UPDATE="true"

#EXTLINUX_ALTERNATIVES="default recovery"
EXTLINUX_DEFAULT="l0"
EXTLINUX_ENTRIES="all"
#EXTLINUX_MEMDISK="true"
EXTLINUX_MEMDISK_DIRECTORY="/boot"
EXTLINUX_MENU_LABEL="LinuxMint 17.1 w/Mate, kernel 3.13.0-74-lowlatency"
#EXTLINUX_OS_PROBER="true"
EXTLINUX_PARAMETERS="ro quiet splash"
EXTLINUX_ROOT="root=LABEL=640a1"
EXTLINUX_THEME="debian"
EXTLINUX_TIMEOUT="05"


As I said above, by disabling 'EXTLINUX_UPDATE=”true”, and what ever else you wish to disable to keep your boot menu clean and simple and understandable, you'll be able to customize your boot loader the way you want it to appear.

This is my /boot/extlinux/linux.cfg;

$ cat /boot/extlinux/linux.cfg
## /boot/extlinux/linux.cfg
##
## IMPORTANT WARNING
##
## The configuration of this file is generated automatically.
## Do not edit this file manually, use: extlinux-update


label l0
menu label LinuxMint 17.3 "Rosa" (on label=640a1), kernel 4.4.0-34-generic 4.4.0-34-generic
linux /boot/vmlinuz-4.4.0-34-generic
append initrd=/boot/initrd.img-4.4.0-34-generic root=LABEL=640a1 ro quiet splash

label l1
menu label Bootable Clone of LinuxMint 17.3 (on label=528a1), kernel 4.4.0-34-generic 4.4.0-34-generic
linux /boot/vmlinuz-4.4.0-34-generic
append initrd=/boot/initrd.img-4.4.0-34-generic root=LABEL=528a1 ro quiet splash

label l2
menu label Redundant Bootable Clone of LinuxMint 17.3 (on label=418a1), kernel 4.4.0-34-generic 4.4.0-34-generic
linux /boot/vmlinuz-4.4.0-34-generic
append initrd=/boot/initrd.img-4.4.0-34-generic root=LABEL=418a1 ro quiet splash


You might also want to edit /boot/extlinux/themes/debian-wheezy/menu.cfg to your liking. This is mine;

# cat /boot/extlinux/themes/debian-wheezy/menu.cfg
menu hshift 0
menu width 82

menu title Uglybox Boot Menu Built For Rebecca by OWA
include themes/debian-wheezy/stdmenu.cfg
include linux.cfg
include memdisk.cfg
include os-prober.cfg
menu separator
menu begin other
menu title Other options
include themes/debian-wheezy/stdmenu.cfg
label mainmenu
menu label ^Back..
menu exit
include themes/debian-wheezy/other.cfg
menu end


Also, I replaced the Debian 'splash.png' with Lake_mapourika_NZ.png, and just called it 'splash.png.' You can play with yours as you see fit.

It is very important to note and remember that every OS and every kernel you wish to boot MUST have the accompanying 'chain-loader', 'initrd.img' and 'vmlinuz', and all other support files for each kernel copied to the /boot directory which contains your Syslinux/Extlinux boot-loader. It is in that directory which extlinux will look for the 'initrd.img' and 'vmlinuz' files.
Also important, as time passes, you may want to do some “light housekeeping” in your /boot directory to remove kernels which are no longer in use. Be very careful when doing your “cleaning” that you don't accidentally remove something you actually need.

And, lastly, in addition to keeping a regularly updated backup of your system, I find it to be vastly helpful to keep a separate backup of files which I have deemed as very, very, critically, absolutely do-not-lose important in a separate "/save" folder, in 2 or 3 separate locations.
Paranoid, perhaps, but recovery from disasters is much, much quicker and easier when you have frequent, and multiple backups on hand.

Thanks, owa

Last edited by oldwierdal; 08-18-2016 at 10:53 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
syslinux instead of lilo as boot loader? farinet Slackware 4 12-23-2015 09:11 AM
how to switch linux boot loader from syslinux to grub? nickleus Linux - Kernel 3 09-26-2009 03:23 PM
How to change from grub boot loader to lilo boot loader linuxjamil Linux - Software 1 05-27-2008 01:47 PM
Syslinux as an alternative to GRUB/LILO AP81 Linux - General 6 12-05-2007 10:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 02:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration