LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Installing grub in place of lilo (https://www.linuxquestions.org/questions/linux-newbie-8/installing-grub-in-place-of-lilo-715523/)

just a man 03-30-2009 11:32 AM

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).

pixellany 03-30-2009 11:38 AM

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.)

amani 03-30-2009 11:45 AM

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)

saikee 03-30-2009 01:02 PM

You still need to write the configuration file menu.lst.

Show us your /etc/lilo.conf if you want a conversion.

pixellany 03-30-2009 03:14 PM

Quote:

Originally Posted by saikee (Post 3492738)
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?

saikee 03-30-2009 05:01 PM

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.

sundialsvcs 03-30-2009 05:04 PM

Examine all documentation very, very carefully.

saikee 03-30-2009 05:13 PM

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.

just a man 03-31-2009 04:36 AM

Thanks for the feedback guys!

Quote:

Originally Posted by saikee (Post 3492738)
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)

pixellany 03-31-2009 06:09 AM

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...???

just a man 03-31-2009 06:16 AM

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. :(

pixellany 03-31-2009 06:29 AM

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)

saikee 03-31-2009 06:45 AM

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.

amani 03-31-2009 09:48 AM

or use the super grub disk for menu based install

Duck2006 03-31-2009 01:12 PM

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


All times are GMT -5. The time now is 05:47 PM.