PDA

View Full Version : hosed hd with mbr...how do I install an mbr on good drive



helios17
10-16-2004, 12:25 AM
hda cratered but not a big deal, main distro is knoppix 3.6 on hdb. took hda out of the loop, changed jumpers and now computer is reading hard drive but on boot, I am getting loading grub error 22. booted to live cd (3.6) and went to lilo confige under system-admin, but when I choose "y" when it asks me if I want to save current config, the shell closes with an error. How do I go about making an mbr for this single hd now. Its probably easy, but I am a bit paniced right now and cant think of how I should do it.

thanx

helios

Durand Hicks
10-16-2004, 12:34 AM
If I'm reading this right, wouldn't hdb now be /dev/hda? Second, you would have to modify both /etc/fstab and /etc/lilo.conf to reflect the hard drive change. Then re-run lilo to install it to the mbr of /dev/hda.

HTH,

Durand

helios17
10-16-2004, 12:38 AM
yes, there is only one hd in the machine right now, the former hdb is now hda. I am completely clueless on how to edit the two things you mentioned. I am taking for granted that I must do it thru the live cd since that is the only way the computer will boot. I have looked around a bit and have not found instructions simple enough for my noobie mind. would you instruct? or point me in the right direction.

edit - I went to hda and looked into the files you told me to edit, but lilo.conf is locked and etc/fstab is only showing hda with the swap...Im guessing anyway.

thanx

helios

Durand Hicks
10-16-2004, 01:04 AM
Here's what I would do:

Boot knoppix cd to the desktop or just boot with knoppix init 3 and hit enter.
At the prompt, type mount /dev/hda1 /mnt/hda1 -o rw.
3) Type chroot /mnt/hda1
4) Type mcedit /etc/fstab and change all references to /dev/hdb to /dev/hda then when done press f10 followed by yes to save it on the way out.
5) Type mcedit /etc/lilo.conf and change any references to /dev/hdb to /dev/hda when done press f10 and yes to save it.
6) Type lilo and press y to have it insert lilo to the mbr of the disk.
7) Type exit
8) Type umount /mnt/hda1
9) Type reboot and you should boot into your hd install.

HTH,

Durand

helios17
10-16-2004, 02:57 AM
I followed your directions and got into mc to make the changes. seems that my hda is mounted as hda2, so I tried several times with hda or hda2...regardless of which one I did, when I ran lilo, I got the same error output. What am I doing wrong?

root@Knoppix:/# lilo
/dev/mapper/control: open failed: No such device
Is device-mapper driver missing from kernel?
/dev/mapper/control: open failed: No such device
Is device-mapper driver 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
Warning: Unable to determine video adapter in use in the present system.
Added Linux *
Added Linux(2.4)-1
Added Linux(2.6)-2
Device 0x0300: Inconsistent partition table, 1st entry
CHS address in PT: 0:0:0 --> LBA (-1)
LBA address in PT: 0 --> CHS (0:0:1)
Fatal: Either FIX-TABLE or IGNORE-TABLE must be specified
If not sure, first try IGNORE-TABLE (-P ignore)
root@Knoppix:/#

Durand Hicks
10-16-2004, 03:53 AM
Hmm,

Seems like it wants you to mount /proc before running lilo. (I've never had to do that in my chroot environment)
What is on the first partition? If knoppix is on /dev/hda2, something has to reside in /dev/hda1.
Second, what partition is the swap in?
Can you post the results of fdisk -l and the contents of /etc/fstab and /etc/lilo.conf? These need to be done as root from the cd.
Something sounds fishy about the partition table according to lilo and this needs to be fixed first before we can proceed any further, otherwise you'll end up with a corrupted installation.

helios17
10-16-2004, 04:53 AM
Device Boot Start End Blocks Id System
/dev/hda2 * 14 14471 116133885 83 Linux
/dev/hda3 14472 14593 979965 82 Linux swap
root@ttyp0[knoppix]#

I believe hda1 might be a persistant partition that I created earlier. I cannot think of what else it might be. qt parted shows it at 1001 meg and I think that is what I set it at.

lilo.conf

Device Boot Start End Blocks Id System
/dev/hda2 * 14 14471 116133885 83 Linux
/dev/hda3 14472 14593 979965 82 Linux swap
root@ttyp0[knoppix]#

/etc/fstab [BM--] 4 L:[ 1+10 11/ 11] *(474 / 474b)= <EOF>
/proc /proc proc defaults 0 0
/sys /sys sysfs noauto 0 0
/dev/pts /dev/pts devpts mode=0622 0 0
/dev/fd0 /mnt/auto/floppy auto user,noauto,exec,umask=000 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,ro 0 0
/dev/cdrom1 /mnt/auto/cdrom1 auto users,noauto,exec,ro 0 0
# Added by KNOPPIX
/dev/hda2 /mnt/hda2 ext3 noauto,users,exec 0 0
# Added by KNOPPIX
/dev/hda3 none swap defaults 0 0

fstab

/etc/fstab [BM--] 4 L:[ 1+10 11/ 11] *(474 / 474b)= <EOF>
/proc /proc proc defaults 0 0
/sys /sys sysfs noauto 0 0
/dev/pts /dev/pts devpts mode=0622 0 0
/dev/fd0 /mnt/auto/floppy auto user,noauto,exec,umask=000 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,ro 0 0
/dev/cdrom1 /mnt/auto/cdrom1 auto users,noauto,exec,ro 0 0
# Added by KNOPPIX
/dev/hda2 /mnt/hda2 ext3 noauto,users,exec 0 0
# Added by KNOPPIX
/dev/hda3 none swap defaults 0 0

lilo.conf

# Support LBA for large hard disks.
#
lba32

# Overrides the default mapping between harddisk names and the BIOS'
# harddisk order. Use with caution.
#disk=/dev/hda
# bios=0x81

#disk=/dev/sda
# bios=0x80

# Specifies the boot device. This is where Lilo installs its boot
# block. It can be either a partition, or the raw device, in which
# case it installs in the MBR, and will overwrite the current MBR.
#
boot=/dev/hda

1Help 2Save 3Mark 4Replac 5Copy 6Move 7Search 8Delete 9PullDn

Durand Hicks
10-16-2004, 06:25 AM
This is clearly an odd partitioning scheme. I'm not sure if you're willing to do a full re-install, and I'm not suggesting that you do......yet.
Fdisk clearly was not able to see the first partition, which can confuse lilo. It may be possible to install lilo to the hda2 partition where knoppix resides. But the BIOS would be looking for the mbr table in hda1 and if it's not there, you won't be able to boot your installation from the hard drive.
Just one more question, what format is hda1-- vfat, ntfs, ext2, or ext3 and is it encrypted since you said it was a persistant partition which you used your knoppix cd or hd installation as a poor man's install?

On the off chance you still want to keep this partitioning scheme,
Open a console and su to root
Mount /dev/hda2 /mnt/hda2
Chroot /mnt/hda2
Mcedit /etc/lilo.conf -- change boot=/dev/hda to read: boot=/dev/hda2 and save
Mount -t proc proc /proc
lilo -P ignore
umount /proc
exit
exit

After doing this, does lilo still report an error?

OErjan
10-16-2004, 09:59 AM
giving the comand mount -a when chrooted should mount everything ok. btw did you edit /etc/fstab?

helios17
10-16-2004, 02:17 PM
I did not choose to encrypt the persistant partition when I made it. I will try the solutions you so kindly provided. I thank you for your time and effort. Its not often people will help to this extent. I did a backup early this morning and have all vital data on cd's and am resigned to reinstall...wouldnt be the first time lol

btw, what would be wrong in going into qparted and deleting the hda1 since hda2 is an ext3 partition and a swap partition is already established?

thanks again

helios

Durand Hicks
10-16-2004, 06:03 PM
I'm not certain what would go wrong if you deleted the 1st partition in qtparted.
One thing I am certain of, is that the mbr has to reside in that partition in order to boot from the hd.
You could delete it and then recreate it, make it active and format it as fat32 (vfat) and have lilo install into that.
Theoretically, that would work without having to do a reinstall.
In that case you would change /etc/lilo.conf boot= line back to /dev/hda and root= should point to /dev/hda2. Also, you would need to modify /etc/fstab to include /dev/hda1 with a mount point of /mnt/hda1 so you can have extra space to mount /hda1 to host your /home directory. (This is not recommended if you're a newbie trying to learn linux and want stability, this is actually for the advanced user who knows the risk involved in doing this and the possibility of losing the ability to boot along with their personal data on that partition.)
That said, if you're really into having a stable system, a total disk wipe followed by a proper partitioning/formatting scheme topped off with a full install of knoppix would be the best thing for you, IMHO. After all, it takes roughly 20 minutes to get a full install from the cd once you have your knoppix configuration setup before you do the install. Then you can transfer your data back to the /home directory. This would give you a nice clean bootable system, but this is not advice I like to give out, unless it's absolutely necessary, because I hate seeing folks lose something important in a reinstall process.