LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   MBR deleted - I need to reinstall LILO without reinstalling Debian (https://www.linuxquestions.org/questions/linux-software-2/mbr-deleted-i-need-to-reinstall-lilo-without-reinstalling-debian-303899/)

chaca1983 03-20-2005 10:12 AM

MBR deleted - I need to reinstall LILO without reinstalling Debian
 
Hi guys,

This is the thing: my MBR was deleted and I had to "fdisk /mbr" my MBR. Now I have to reinstall LILO to my MBR so I can boot Debian 3.0 as well as Win 98. I was wondering if there was a way to do this without reinstalling Debian.

Y have my old /etc/lilo.conf in the linux patition which I can access booting from a Feather Linux CD.

This would be my questions:

Where should I boot in order to install LILO: Win 98, Feather Linux or DOS (win startup disk)? I don't have the Debian Boot Disk
How do I install LILO in that way? All the documents I've found describe how to install LILO already in Linux.

I would really appreciate some help here as this is now the first time I have to reinstall Linux due to some MBR problem.

Thanx a lot :)

Dodgeram01 03-20-2005 11:39 AM

You should try to install it from feather linux or whatever distro it was that you said you could access you config from. You could probably chroot the machine and then just run lilo or one of its other scripts. You might check the Gentoo handbook as I know it deals with installing Lilo, but I don't know whether or not it would be helpful for your situation.

chaca1983 03-20-2005 06:41 PM

I actually tried something like that. I booted into Feathr Linux and mounted hda3 which is the partition where Debian is intalled. Then in the console I logged as root and tried to run lilo and then liloconf (or liloconfig, can't remember now). It gave me an error message, something to do with permissions if I recall correctly.

If posting the error message can be of any help please let me know and I'll post it ASAP.

Thanx for such quick answer Dodgeram01!

heema 03-21-2005 02:35 AM

here is how i did it in knoppix

"Q: My other Linux install is broken and I want to reinstall LILO.

A: Mount that partition and run LILO as root:

* e.g. mount -o dev /mnt/hda1, if its already mounted, you'll have to clear the "nodev" flag: sudo mount -o remount,dev /mnt/hda1.
* Enter that directory as root and run lilo: chroot /mnt/hda1 lilo."

http://www.knoppix.net/wiki/Rescue_FAQ

chaca1983 03-21-2005 08:13 AM

Thanx heema for your suggestion.

Here is what I did and the outcome. If you see that I'm doing anything wrong please let me know:

$su
#sudo mount /dev/hda3 /mnt/hda3
#chroot /mnt/hda3 lilo
/dev/mapper/control: open failed: no such device
Is device-mapper missing from kernel
/dev/mapper/control: open failed: no such device
Is device-mapper missing from kernel
Incompatible libdevmapper 1.00.19-ioctl (2004-07-03)(compat) and kernel driver
Warning: '/proc/partitions' does not exist, disk scan bypassed
Fatal: open /vmlinuz: No such file or directory

That was the console outcome. I will read the Knoppox documentation that heema suggests but if you could continue to point me to the right track I will be very thankful


CrashedAgain 03-21-2005 09:09 AM

Re: MBR deleted - I need to reinstall LILO without reinstalling Debian
 
Quote:

Originally posted by chaca1983


Y have my old /etc/lilo.conf in the linux patition which I can access booting from a Feather Linux CD.


as root from feather linux or knoppix or whatever you linux you can run,
mount the Debian partition then

lilo -C <your-old-/etc/lilo.conf file>

If this doesn't work, post back & also post your /etc/lilo.conf file.

chaca1983 03-21-2005 02:06 PM

Great, I will try this tonight and post the outcome. Thanx CrashedAgain

chaca1983 03-22-2005 07:23 AM

And here's the outcome:
$su
#mount -rw /dev/hda3 /mnt/hda3
#lilo -C /mnt/hda3/etc/lilo.conf
Fatal: create /boot/map~: Read-only file system

Maybe I made some mistake mounting the file system. I thought that -rw was for read-write. I will try some alternatives but tips are always welcomed :P

See you! Thanx!

CrashedAgain 03-22-2005 08:22 AM

Quote:

Originally posted by chaca1983
And here's the outcome:
$su
#mount -rw /dev/hda3 /mnt/hda3
#lilo -C /mnt/hda3/etc/lilo.conf
Fatal: create /boot/map~: Read-only file system

Maybe I made some mistake mounting the file system. I thought that -rw was for read-write. I will try some alternatives but tips are always welcomed :P

See you! Thanx!

I kind of figured that might happen; I think the read-only error is because it is running from a read only system, not because hda3 is improperly mounted.

'man lilo' says that -r forces lilo to chroot before running so try:
'lilo -r /mnt/hda3/ -C /mnt/hda3/etc/lilo.conf'

another possibility:
'lilo -m /mnt/hda3/boot/map -C /mnt/hda3/etc/lilo.conf'

You may also have to edit lilo.conf so that the whole path is specified like so: (This is from my lilo.conf which is on hda8 but also boots another install on hda5. Note the full path specified for the hda5 entry.


crashedagain@desktop:~$ cat /etc/lilo.conf
boot=/dev/hda
map=/boot/map
vga=normal
default="Linux(new)"
prompt
nowarn
timeout=100
#message=/boot/message
menu-scheme=wb:bw:wb:bw
lba32


# Boot Kanotix on hda8
image=/boot/vmlinuz
append="lang=us apm=power-off hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi hdf=scsi hdg=scsi hdh=scsi quiet BOOT_IMAGE=knoppix"
root=/dev/hda8
label="Linux(new)"
read-only

# Boot Windows on hda1
other=/dev/hda1
label="Windows"
table=/dev/hda

# Boot Knoppix26 on hda5
image=/mnt/hda5/boot/vmlinuz-2.6.6
label="Linux(old)"
root=/dev/hda5
initrd=/mnt/hda5/boot/initrd.img-2.6.6
append="lang=us apm=power-off ramdisk_size=100000 init=/etc/init nomcequiet wheelmouse"
read-only

chaca1983 03-25-2005 11:54 PM

Well I've tried that last possibilty and didn't work either. It said something about the vmlinuz file... Finally I had to reinstall Debian. But no harm done... I could backup the important data. Although I was really very interested in having this solved the other way.

I don't know if this question should really be in another post but: How can I backup and restore the MBR in Linux, Windows and DOS? It would be very useful to have an easy way to restore it in case of this incidents.

Thanx again everybody for your suggestions!!!!

syg00 03-26-2005 12:21 AM

Quote:

Originally posted by chaca1983
How can I backup and restore the MBR in Linux, Windows and DOS? It would be very useful to have an easy way to restore it in case of this incidents. [/B]
The only time a backup would be useful is immediately prior to updating it. After which it should probably be deleted.
Windows and DOS have well documented ways of recovering the MBR - nothing else needed. No backup, just replacement with fixmbr or "fdisk /mbr".
For grub, you can create an install floppy - this would allow a simple rebuild. Don't know about lilo.

The "problem" in Linux is the proliferation of GUI based systems that hide the working of these features.
Any distros recovery system should handle this with ease - if you think your distro doesn't, raise a requirement.
You'll probably be pointed to an already existing solution.

Gentoo users should be able to do this rebuild almost without instruction.

CrashedAgain 03-26-2005 09:22 AM

Quote:

Originally posted by chaca1983
Well I've tried that last possibilty and didn't work either. It said something about the vmlinuz file... Finally I had to reinstall Debian. But no harm done... I could backup the important data. Although I was really very interested in having this solved the other way.

I don't know if this question should really be in another post but: How can I backup and restore the MBR in Linux, Windows and DOS? It would be very useful to have an easy way to restore it in case of this incidents.

Thanx again everybody for your suggestions!!!!

I seem to recall being able to reinstall lilo from the Debian install disks without having to reinstall the whole distro but my memory may be faulty on this.
Make yourself a boot disk, at least then you will be able to get into your linux system if you lose your bootloader. Once properly running in linux lilo should reinstall easy, it's a little trickier trying to install it from a different system.
Also, never put data of any importance on the same partition as an operating system, if the o/s crashes, it is GONE. For a dual boot system you should have a vfat data partition for shared data.

chaca1983 03-26-2005 10:06 AM

I do have a vfat data partition were I keep my data, thanx for the tip anyway CrashedAgain! I was more concerned for some mldonkey temps and for the fact that this already happened to me and I wasn't able to fix it.

About reintalling lilo with the boot disk I tried that as I found my Debian boot disk but had the same problem. I guess I'm a little short on boot loaders' usage and configuration.

syg00: Now I've installed Grub so I will try the install floppy. On the other hand, I couldn't figure how to recover the MBR from Debian Install CDs... I guess I'm a little short on patience too :P

Thanx everyone anyhow!!!


All times are GMT -5. The time now is 06:11 PM.