LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-16-2011, 08:46 PM   #1
kienlarsen
Member
 
Registered: Apr 2011
Posts: 76

Rep: Reputation: 0
Why do we need boot loader or boot manager? GRUB, Lilo


I understand that we need GRUB or Lilo to choose between different operating systems, like Windows and Fedora on one machine. However, my UNIX Academy DVD training, and "Administrator' handbook", both discuss configurations where booting choices are between different kernels/configurations. Neither of them discuss booting with Windows as an option. I'm not getting it. Why would we need different kernels/configurations of Linux installed on one computer? And what's the benefit of using boot manager if my Linux is the only OS on a computer? Why not to boot it directly from MBR?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-16-2011, 09:16 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Firstly the kernel is too big for the MBR; you need something
(like lilo or grub) who can read the kernel on a linux filesytem,
drag it into RAM and start it's execution.

Secondly it's always a good idea to have several kernels in case
you update one, and it misbehaves ... it's much quicker and easier
to choose a working one from lilo/grub than booting off a rescue
CD and repairing stuff.



Cheers,
Tink
 
4 members found this post helpful.
Old 05-16-2011, 09:16 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by kienlarsen View Post
Why would we need different kernels/configurations of Linux installed on one computer? And what's the benefit of using boot manager if my Linux is the only OS on a computer?
If you install a new kernel, may be with security patches or bugfixes, it is always a good idea to keep the old kernel. The new kernel may have issues with your hardware configuration. If it is your only kernel you run into problems, with the bootloaders option to run the old kernel you don't have a problem if the new kernel doesn't work.

You also have the possibility to run more than one Linux version. For example, not long ago I had Debian installed for everyday use and Arch for gaming.

Quote:
Why not to boot it directly from MBR?
Because you can't. The MBR is only 512 Bytes in size, usable for the bootloader are only 446 Byte. The kernel is far to large for that.
 
4 members found this post helpful.
Old 05-16-2011, 09:22 PM   #4
g0lum
LQ Newbie
 
Registered: May 2011
Distribution: mint9,10_amd64 , slackware13.1_amd64 ,minix3 V_M
Posts: 6

Rep: Reputation: 5
I guess these are 2 Questions

1. what is the need for boot loader?
A. well try this:http://www.xs4all.nl/~lennartb/bootloaders/node3.html
and if linux is only OS on your computer than set waiting time of boot loader = 0 and it wont prompt for initial display but boot the default OS
but i think a little freedom of choice wont hurt

2. what is the need for choosing different kernel versions ?
A. Different distributions and individuals compile and use different versions of kernel or simply compile for same version for their specific needs and needs to install and test them what if any thing goes wrong , In this case you can always choose old working kernel and here boot loader like LILO and GRUB comes with a great help
perhaps a little google on 'kernel build and installation' will help
 
4 members found this post helpful.
Old 05-16-2011, 10:12 PM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
It is probably worth mentioning that there was a time when Linux did boot directly from the MBR, where it bootstrapped itself as it loaded. This is of course rather limiting, and makes it difficult to recover if you happen to get a non-working kernel.

Most end-users don't ever need to use multiple kernels or Linux versions. For those that do, the bootloader is the perfect way to support their requirement. Linux does have a habit of trying to get along with everyone, if possible. It is also a convenient way to try different kernel settings with little pain. The kernel takes arguments to modify some of its behaviors, such as setting IPs, and other kernel module options. Some/many/most bootloaders allow you to set the kernel argument commandline at boot time. I was recently able to use such a facility to try various options to make the cooling fan on a laptop work. Having discovered the correct magic incantations, I then made it a permanent default.

I don't know for sure, but my hunch is that some distro installer software uses the bootlaoader as a last line of customization of an installation, based on the particular hardware that it discovers. This would enable Linux distributors to create more generic kernels. It would be easy to imagine that distributors appreciate the bootloader splash-screen as an ideal place to announce their product.

--- rod.

Last edited by theNbomr; 05-16-2011 at 10:15 PM.
 
3 members found this post helpful.
Old 05-17-2011, 11:21 AM   #6
kienlarsen
Member
 
Registered: Apr 2011
Posts: 76

Original Poster
Rep: Reputation: 0
So we need Grub or Lilo for having an option of booting old kernel if updated/upgraded kernel doesn't fly.
 
Old 05-17-2011, 12:05 PM   #7
Mr. Bill
Member
 
Registered: Mar 2011
Location: Maryland, USA
Distribution: Xubuntu 14.04 - 64
Posts: 185

Rep: Reputation: 14
Quote:
Originally Posted by kienlarsen View Post
So we need Grub or Lilo for having an option of booting old kernel if updated/upgraded kernel doesn't fly.
What about the other explanations? The kernel is too large for the MBR. All systems need a boot loader/manager in the MBR to launch the kernel. The one for Windows is NTLDR.COM.

Last edited by Mr. Bill; 05-17-2011 at 12:08 PM.
 
2 members found this post helpful.
Old 05-17-2011, 01:48 PM   #8
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by kienlarsen View Post
So we need Grub or Lilo for having an option of booting old kernel if updated/upgraded kernel doesn't fly.
I guess I could call this a bit of an over-simplification, given the body of explanation provided. Since you specified, I'll take the time to point out as well, that Grub (in either of it's two incarnations) and Lilo are not the only bootloaders out there. To name a few others:
  • Isolinux - found on many/most live-CD distros
  • PXE - the defacto standard in network booloaders
  • U-Boot - mostly for non-X86 hosts
  • Loadlin - boots Linux from DOS/Win3.x/Win9x
  • Redboot - for embedded systems, boots from flash

--- rod.
 
1 members found this post helpful.
Old 05-18-2011, 06:22 PM   #9
kienlarsen
Member
 
Registered: Apr 2011
Posts: 76

Original Poster
Rep: Reputation: 0
Obviously, I'm not Linux expert, but I had my hand on Windows and MBR was never intended for having there boot manager. MBR is a place for a primary boot loader. This primary boot loader is responsible for loading a larger loader with portions of Kernel, major drivers etc. My reading of Linux books confirms that the same scheme is true for Linux. Boot managers aren't unique to Linux, there are plenty of them for Windows. And to mention Windows itself features boot manager. Boot manager is an extra software that interrupts a natural sequence of booting and allows to substitute the default booting command to something else. So limited space in MBR isn't a reason for having Grub or Lilo, in fact I been playing with some Linux installation (can't remember which, I've been playing around with too many in last few days) which offered an option of been installed without boot manager. So I do believe at this point that major reason for having Grub (or Lilo) is to get a way around stale kernel.

I've been reading that Grub also helps if root password is lost. I also been reading that Grub allows loading any other kernel, because BIOS itself is unaware file system structure.
 
Old 05-19-2011, 12:13 AM   #10
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by kienlarsen View Post
So I do believe at this point that major reason for having Grub (or Lilo) is to get a way around stale kernel.

I've been reading that Grub also helps if root password is lost. I also been reading that Grub allows loading any other kernel, because BIOS itself is unaware file system structure.
Well, you are free to believe whatever you want. However, you make the point that the bootloader may be used to recover from a lost root password. This is an example of the runtime modification of kernel arguments that I described earlier. By using the bootloader to append the argument 'single', most distributions will boot to a single-user (root user) mode, which gives you root access. You can reset the root password, among many other diagnostic and remedial tasks.

It is a fact that the MBR is too small to contain an effective bootloader for most Linux kernels. The bootloader-less mode you describe would still use the MBR to bootstrap a dedicated bootloader that would be built into the kernel itself. This was at one time the standard way to launch Linux, but has been all but abandoned.

A bit of understanding of the boot process can be gained by simply knowing the origin of the term 'boot'. There is an English phrase 'pick oneself up by the bootstrap', which is of course a literal impossibility. The implication of the phrase is that it might be possible to lift yourself up, by lifting yourself by the feet; in other words, by elevating without the benefit of any external assistance. The boot process is done by starting from almost nothing (the simplist of code in a BIOS, for example), through a series of stages that progressively increase the basis upon which to build. Grub embodies this process literally, being composed of a series of 'stages', strategically organized to give it enough knowledge to read from a variety of filesystems on a variety of hardware. Once again, the bootloader is a single small point of customization, providing distros and their installers with something that can launch a kernel that is generic.

--- rod.
 
1 members found this post helpful.
Old 05-19-2011, 12:54 AM   #11
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by kienlarsen View Post
MBR is a place for a primary boot loader.
Which is exactly what grub and lilo are.

Quote:
Originally Posted by kienlarsen View Post
This primary boot loader is responsible for loading a larger loader with portions of Kernel, major drivers etc.
And that is what grub and lilo do (specially lilo). Nothing states that they can't do other things as well.

Quote:
Originally Posted by kienlarsen View Post
but I had my hand on Windows and MBR was never intended for having there boot manager
How does windows handle dual boot scenarios (e.g. WinXP and Win7 dual boot, no Linux involved)? Just curious but as this is possible, Windows also uses what you call a bootmanager and not a primary bootloader. Please correct me if I'm wrong here.

Last edited by Wim Sturkenboom; 05-19-2011 at 12:56 AM.
 
Old 05-19-2011, 08:23 AM   #12
kienlarsen
Member
 
Registered: Apr 2011
Posts: 76

Original Poster
Rep: Reputation: 0
Which is more in use today: Grub or Lilo? I see more about Lilo in older books and more about Grub in up to date training. It is just my impression or Grub is unseating Lilo?
 
Old 05-19-2011, 08:30 AM   #13
fmillion
Member
 
Registered: Nov 2006
Posts: 93

Rep: Reputation: 27
Quote:
Originally Posted by kienlarsen View Post
Which is more in use today: Grub or Lilo? I see more about Lilo in older books and more about Grub in up to date training. It is just my impression or Grub is unseating Lilo?
I'd say it depends on the distro. You are correct, more distros do seem to be moving towards grub. Grub does have more powerful features, but LILO is simpler to install and configure. It really comes down to a matter of choice. It is possible to take an installation that boots with Grub and switch it to boot with LILO, and vice versa.

Aside from displaying fancy boot menus, and whatever other bells and whistles it wants to, a bootloader pretty much follows the same procedure to boot a Linux kernel, regardless of which loader it is. It must first learn how to access a Linux filesystem, then it must find and load the kernel from that filesystem into RAM, often while decompressing it, then it tells the CPU to start executing code at the memory location the kernel was loaded into. From there on, the bootloader has little to no significance.

(Geeks: correct me if I'm wrong, but I think there still is a way to compile a "self-booting" kernel wherein the kernel image's first 512 bytes do indeed contain simplistic bootloader code... No room for kernel prameters or any rescue options when doing this, but I can see the applications in embedded systems, where rescue would typically involve some external hardware anyway. I remember booting 2.2 series kernels off floppy disks this way...)

Last edited by fmillion; 05-19-2011 at 08:33 AM.
 
1 members found this post helpful.
Old 05-19-2011, 08:40 PM   #14
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
Computers these days have a lot of onboard software in Flash-ROM, and the "old BIOS ways" of doing things have really been superseded in many ways. But the basic principle of loading an operating-system is generally the same: a small loader program is grabbed from somewhere (these days, most of the goodies are actually in the ROM...), and it loads some kind of a boot-loader, and this loader locates and initializes the operating-system.

Of the various Linux loaders, I think that GRUB has pretty well taken-over for LILO, because it is considerably more flexible. It doesn't have the problem of requiring you to execute a magic command before shutting-down the system in order to be assured of being able to start it up again.

I know several Windows developers who use GRUB as the first-stage loader on their development machines. (It is used to load the appropriate NTLDR or whatever-it-is, which subsequently loads the Windows version.)
 
1 members found this post helpful.
Old 05-19-2011, 08:48 PM   #15
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by sundialsvcs View Post
It doesn't have the problem of requiring you to execute a magic command before shutting-down the system in order to be assured of being able to start it up again.
I use Slackware with Lilo and don't have to execute a magic command before rebooting. If I forget to update Lilo after building a new kernel I just boot into the old one, no problem here.
 
1 members found this post helpful.
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
grub boot loader to lilo guruvayur LinuxQuestions.org Member Intro 1 09-24-2008 05:45 AM
How to change from grub boot loader to lilo boot loader linuxjamil Linux - Software 1 05-27-2008 01:47 PM
Can't change boot loader from GRUB to LILO ikeTightPants Linux - Software 3 05-21-2004 09:30 AM
Lilo to Grub Boot loader Maurice Arthur Linux - Software 3 07-23-2001 09:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:59 PM.

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