LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 03-30-2009, 12:32 PM   #1
just a man
Member
 
Registered: Feb 2009
Posts: 37

Rep: Reputation: 15
Question Installing grub in place of lilo


I want to install grub on my Debian box, currently it uses lilo. What do I need to do when I've installed grub to make lilo not boot on restart? (or to not get some sort of weird bootloader clash).
 
Old 03-30-2009, 12:38 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Welcome to LQ!!

Assuming that GRUB 0.97 is in you repositories, you should be able to simply install it with the package manager.

To set up:
grub ##opens the grub shell
root (hd0,0) ## tells GRUB where its files are (ie the location of /boot) (I assumed first partition of the first drive)
setup (hd0) ## puts GRUB in the mbr of drive #1 (LILO will automatically be removed.)
 
Old 03-30-2009, 12:45 PM   #3
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: Debian 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,766

Rep: Reputation: Disabled
I think apt-get will do everything automatically.

Install grub and splash images with apt-get or synaptic.

#su
#grub-install /dev/sda

(will install to MBR)
 
Old 03-30-2009, 02:02 PM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
You still need to write the configuration file menu.lst.

Show us your /etc/lilo.conf if you want a conversion.
 
Old 03-30-2009, 04:14 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by saikee View Post
You still need to write the configuration file menu.lst.
Of course!!! Sorry for omitting that detail

Quote:
Originally Posted by amani
grub-install /dev/sda
I never use that method---don't you still need some kind of "root" statement?
 
Old 03-30-2009, 06:01 PM   #6
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
pixellany,

The grub-install isn't a command in Grub prompt. It is a shell script to be issued in a Bash terminal. Thus it is issued inside the Linux and so the root would be already known.

The root+setup is done outside the Linux and one can do several distros at the same time. The root+setup is more robust than grub-install because the latter is restricted by what the kernel can detect whereas the former is a loose cannon.

As an example Linux now with 2.6.28 kernel can break 15 partitions limit in a hard disk and I have booted Linux distro from a partition sda130. An earlier kernel can have udev detecting only the first 15 partitions. Grub at a Grub prompt (before a Linux is loaded) can see everything and more partitions than a kernel can detect.

We are going to have a lot of fun with partitions as potentially there isn't a limit.

Last edited by saikee; 03-30-2009 at 06:03 PM.
 
Old 03-30-2009, 06:04 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,706
Blog Entries: 4

Rep: Reputation: 3030Reputation: 3030Reputation: 3030Reputation: 3030Reputation: 3030Reputation: 3030Reputation: 3030Reputation: 3030Reputation: 3030Reputation: 3030Reputation: 3030
Examine all documentation very, very carefully.
 
Old 03-30-2009, 06:13 PM   #8
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
sundialsvcs,
Quote:
Examine all documentation very, very carefully.
What do you mean?

Any Linux can be booted by Grub even without being installed inside. A Grub floppy, Grub CD or some Live CD with Grub instead of isolinux can boot any installed Linux even there is no boot loader inside.
 
Old 03-31-2009, 05:36 AM   #9
just a man
Member
 
Registered: Feb 2009
Posts: 37

Original Poster
Rep: Reputation: 15
Thanks for the feedback guys!

Quote:
Originally Posted by saikee View Post
You still need to write the configuration file menu.lst.

Show us your /etc/lilo.conf if you want a conversion.
Quote:
lba32
boot=/dev/hda
prompt
timeout=50
large-memory

image=/boot/bzImage-2.6.27.10-xxxx-grs-ipv4-32
root=/dev/hda1
label="Linux"
read-only
I can't find the config file for grub, I looked at /boot/grub/menu.lst but there's not even a directory called grub. And yet I could run the grub interface thing... (boot+setup)
 
Old 03-31-2009, 07:09 AM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Please clarify exactly what you have done. eg did you run "apt-get install grub"? Some quick Googling suggests that this should put all the files in the right place, but I can't find anything definite. ( A little voice is telling me that there is another step......)

On my machine, I have:
/usr/lib/grub
/usr/sbin/grub
/usr/share/bug/grub
/usr/share/doc/grub
/usr/share/recovery-mode/options/grub

/usr/lib/grub has all the files (maybe needs to be copied to /boot?)
/usr/share/doc/grub has a sample menu.lst

Not clear how you could have run the grub setup command if everyting was not in the right place...???
 
Old 03-31-2009, 07:16 AM   #11
just a man
Member
 
Registered: Feb 2009
Posts: 37

Original Poster
Rep: Reputation: 15
I first ran

apt-get install grub /dev/hda1

and then I looked for the config file, and didn't find it in /boot/grub/menu.lst, so I got all into a tizzy and in the confusion ran the grub command and then boot+setup.

Hopefully I've merely overwritten some grub stuff with the grub stuff that was put there already by "apt-get install grub /dev/hda1"

But I only did this because I don't know why the menu.lst isn't present. I did "find / menu.lst | grep menu.lst" and that found
/usr/share/doc/grub/menu.lst

But shouldn't it be either in /etc or /boot (I read somewhere that unusualy, grub stores the config file in /boot to keep its files all together).

Anyway I sisnced rebooted the server and now it won't boot at all.

Last edited by just a man; 03-31-2009 at 07:19 AM.
 
Old 03-31-2009, 07:29 AM   #12
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I think you wanted "apt-get install grub". The package manager typically knows where to put things, and I don't know what "/dev/hda1" would do.

Do you have any of the directories that I listed?

(To get back into the system, you'll need to boot up with a live CD)
 
Old 03-31-2009, 07:45 AM   #13
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
To install Grub a minimum of two files stage1 and stage2 are needed. They may be find in

Red Hat, Fedora
/usr/share/grub/x86_64-redhat/stage1
/usr/share/grub/i386-redhat/stage1

Mandriva
/lib/grub/i386-mandriva/stage1

Mandrake
/usr/local/lib/grub/i386-pc/stage1
/usr/lib/grub/i386-pc/stage1


Suse
/usr/lib/grub/i386-suse/stage1

Gentoo, Knoppix, Mepis, Xubuntu, Ubuntu, Kubuntu, Debian
/lib/grub/i386-pc/stage1


Frugalware, Kanotix
/usr/lib/grub/i386-pc/stage1


This is what I recommend

(1) Get any Live CD that has Grub, boot it up, mount hda1 (may be called sda1 in newer Linux). If the Live CD has Grub the two essential files of stage1 and stage2 will be found in /boot/grub or /usr/lib/grub/i386-pc etc.
Code:
mkdir /mnt/hda1
mount /dev/hda1 /mnt/hda1
(2) Create a directory /boot/grub inside mounted hda1. Copy stage1 and stage2 from /usr/lib/grub/i386-pc to this directory.
Code:
mkdir /mnt/hda1/boot/grub
cp /usr/lib/grub/i386-pc/stage* /mnt/hda1/boot/grub/
(3) Edit a text file "menu.lst" inside the new /mnt/hda1/boot/grub/ with the following entries
Code:
title Iternet dude gave this Grub conversion of my Debian in hda1 known to Grub as (hd0,0)
root (hd0,0)
kernel /boot/bzImage-2.6.27.10-xxxx-grs-ipv4-32 ro root=/dev/hda1
(4) You can now make the hda1 bootable by the following commands within a root console of any booted up Linux that contains Grub
Code:
grub
root (hd0,0)
setup (hd0)
quit
reboot
For the full functionality download Grub 0.97 from GNU/Grub, follow the instructions in the Grub Manual for installation and omit steps (1) & (2) above. With a full Grub you can have an alernative to Step (4) (as suggested/favoured by Pixellany)

Code:
mount /dev/hda1 /mnt/hda1
chroot /mnt/hda1
grub-install /dev/hda
exit
Edited-----------------

If Grub has been setup and does not find a menu.lst in /boot/grub or /grub directory it will defaults to a Grub prompt. There is no installed PC operating system that cannot be booted up manually in a Grub prompt. The booting instructions are exactly those in menu.lst except you need one extra statement of
Code:
boot
at the end to fire it up.

Last edited by saikee; 03-31-2009 at 07:50 AM.
 
Old 03-31-2009, 10:48 AM   #14
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: Debian 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,766

Rep: Reputation: Disabled
or use the super grub disk for menu based install
 
Old 03-31-2009, 02:12 PM   #15
Duck2006
Member
 
Registered: Sep 2006
Distribution: Ubuntu 8.04 Hardy Heron LST
Posts: 346

Rep: Reputation: 33
http://www.ask.com/bar?q=installing+...e-cd-265867%2F
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Lilo/grub installing and configuration iAlta Linux - Newbie 8 05-12-2007 08:20 AM
installing grub over lilo (for fc6) mjl3434 Fedora - Installation 8 01-28-2007 07:25 PM
My Lilo/grub lost after installing Win Xp leenuk Linux - Newbie 15 02-05-2006 09:41 PM
Installing Grub over LILO arpanetguru Linux - Software 3 01-02-2006 07:19 PM
GRUB/LILO not installing... uranologist Red Hat 7 12-17-2003 09:16 AM

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

All times are GMT -5. The time now is 07:59 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration