You are not logged in.

#1 2004-11-05 08:17:05

mitya
Member
Registered: 2004-08-03
Posts: 19

Problems recovering GRUB to MBR, chroot fails

Hello, fellow Archers!
I've got a problem with a very basic issue here, the one I've dealt with successfully several times before, although not with Archlinux.
I had windows installed on a primary master and Archlinux on primary slave, with grub lying in MBR on the first disc (the windows one). Everything was working fine, until I had to fdisk/mbr for reasons not relevant to the problem. I wasn't worried, because I knew how to restore GRUB back to MBR, by chrooting to my Arch installation using any bootable Linux disk. However, when I attempting to do this, I've suffered a miserable failure, several times. I 've tried several different recipies, found on Google, a number of bootable Linux distros, including Knoppix and Arch 0.6 base and nothing. I am really desperate and hope anyone here can help me, PLEASE.
Now for technical details:
As I've said, I have windows on primary master disc - /dev/discs/disc0/part1 and Arch on primary slave:

/dev/discs/disc1/part1 - /boot (ext2)
/dev/discs/disc1/part2 - extended partition
/dev/discs/disc1/part3 - swap
/dev/discs/disc1/part4 - / (reiserfs)
/dev/discs/disc1/part5 - fat32 partition

Here are the steps I've tried to follow:

1. Boot from Arch 0.6 base cd.
2. mkdir /mnt/system
3. mount -t reiserfs rw /dev/discs/disc1/part4 /mnt/system
4. mkdir /mnt/system/boot
5. mount /dev/discs/disc1/part1 /mnt/system/boot

Everything goes fine so far until the next line:

6. chroot /mnt/system

Every time I do this I recieve an error: /bin/sh not found.

Trying to execute

chroot /mnt/system /bin/bash

fails as well.

I've also tried to mount proc before step 6:

mkdir /mnt/system/proc
mount -t proc none /mnt/system/proc

but that didn't help a bit.

I recieve exactly the same error on chroot, when using Knoppix.
Please, tell me what am I doing wrong, or how to restore Grub to MBR in a different way.
Thanks in advance for any tip/lead.

Offline

#2 2004-11-05 08:41:05

dauphin
Member
From: Scotland
Registered: 2003-07-09
Posts: 188

Re: Problems recovering GRUB to MBR, chroot fails

Have you tried booting straight into your Arch installation from the cd?  At the boot prompt enter, for example:

arch root=/dev/discs/disc1/part1

Offline

#3 2004-11-05 08:45:39

mitya
Member
Registered: 2004-08-03
Posts: 19

Re: Problems recovering GRUB to MBR, chroot fails

dauphin wrote:

Have you tried booting straight into your Arch installation from the cd?  At the boot prompt enter, for example:

arch root=/dev/discs/disc1/part1

Hi, thanks for a quick reply!

Yes, I did, only my root partition is part4 and not part1, which is /boot. Or maybe this was my problem and I should have used root=/dev/discs/disc1/part1 as a boot param? yikes

Offline

#4 2004-11-05 09:14:50

dauphin
Member
From: Scotland
Registered: 2003-07-09
Posts: 188

Re: Problems recovering GRUB to MBR, chroot fails

Well I wasn't too sure either - I don't use a separate boot partition - but I figured if you tried one you'd try both  smile

One thing that's puzzling me, and I'm probably quite wrong here, is that if your swap and / partitions are within the extended partition, would they not be numbered part5 and part6 respectively?  No doubt I must be wrong otherwise you would get an error when you try to mount part4 - unless you have another (primary) reiserfs partition which is numbered part4.

Other than that, I would try exploring the implications of the error message by seeing if you can confirm the presence or otherwise of /bin/sh.

Offline

#5 2004-11-05 10:23:38

mitya
Member
Registered: 2004-08-03
Posts: 19

Re: Problems recovering GRUB to MBR, chroot fails

My / and swap partitions are not part of the extended, they are both primary partitions. smile

Other than that, I would try exploring the implications of the error message by seeing if you can confirm the presence or otherwise of /bin/sh.

Well, lets see... I am pretty sure about the existance of /bin/sh on the boot CD, otherwise the shell won't work at all. I know that /bin/bash exists on my root partition because I am using a bash shell in my Arch installation, or at least used it before this problem. sad

I have a feeling, this has something to do with my / being a reiserfs partition, but I really don't know what else I could do, besides reinstalling.
Anybody else got any ideas? sad

Offline

#6 2004-11-05 20:21:35

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Problems recovering GRUB to MBR, chroot fails

1. Boot from Arch 0.6 base cd.
2. mkdir /mnt/system
3. mount -t reiserfs rw /dev/discs/disc1/part4 /mnt/system
4. mkdir /mnt/system/boot
5. mount /dev/discs/disc1/part1 /mnt/system/boot

leave out step 4 and 5 and try to chroot again, it doesn't look ok I guess,
maybe you can mount your boot partition later


arch + gentoo + initng + python = enlisy

Offline

#7 2004-11-06 09:50:20

mitya
Member
Registered: 2004-08-03
Posts: 19

Re: Problems recovering GRUB to MBR, chroot fails

xerxes2 wrote:

leave out step 4 and 5 and try to chroot again, it doesn't look ok I guess,
maybe you can mount your boot partition later

chroot: cannot execute /bin/sh : No such file or directory

sad

Well, I'll probably wait for Wombat and reinstall. I would like to know what the problem is though, cause I never had it before.

Offline

#8 2004-11-06 11:25:41

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Problems recovering GRUB to MBR, chroot fails

hello again  big_smile

I've /bin/sh on my root, it's a symlink to /bin/bash


arch + gentoo + initng + python = enlisy

Offline

#9 2004-11-06 16:09:36

mitya
Member
Registered: 2004-08-03
Posts: 19

Re: Problems recovering GRUB to MBR, chroot fails

xerxes2 wrote:

hello again  big_smile

I've /bin/sh on my root, it's a symlink to /bin/bash

Not sure what you mean by that, but

chroot /mnt/system /bin/bash

also fails.

Offline

#10 2004-11-06 21:49:28

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Problems recovering GRUB to MBR, chroot fails

remember that knoppix use /dev/hdx scheme,
there are also other threads in the forum about chrooting,

and if you are going to reinstall there is no need for waiting for 0.7 final, 0.7betas should be ok, just reboot and "pacman -Syu" and you are uptodate,

good luck


arch + gentoo + initng + python = enlisy

Offline

#11 2004-11-06 22:09:58

dauphin
Member
From: Scotland
Registered: 2003-07-09
Posts: 188

Re: Problems recovering GRUB to MBR, chroot fails

You could download a floppy image of Grub, write it to a floppy; eg with Knoppix, then boot from the floppy to a grub prompt and enter the appropriate parameters for your Arch installation.

Offline

#12 2004-11-07 09:19:15

mitya
Member
Registered: 2004-08-03
Posts: 19

Re: Problems recovering GRUB to MBR, chroot fails

xerxes2 wrote:

remember that knoppix use /dev/hdx scheme,
there are also other threads in the forum about chrooting,
good luck

Yes, I know that, of course. The fact that I recieve exactly the same error with other LiveCD's, leads me to the conclusion that there is some kind of problem in my partition configuration. Thanks anyway.

dauphin wrote:

You could download a floppy image of Grub, write it to a floppy; eg with Knoppix, then boot from the floppy to a grub prompt and enter the appropriate parameters for your Arch installation.

Thanks! smile Maybe I'll give it a shot.

Offline

#13 2004-11-10 16:24:46

mitya
Member
Registered: 2004-08-03
Posts: 19

Re: Problems recovering GRUB to MBR, chroot fails

Hi there! It's me again.

Well, I must say I made a progress in an effort of solving my problem. I am still unable to restore grub to MBR.

The chroot problem had nothing to do with Arch, of course. It was all about me trying to chroot the wrong partition. :oops: My /dev/discs/disc1/part1 is root partition (without a separate /boot) and /dev/discs/disc1/part4 is used for /home.
After successfully chroot'ing into my installation, I typed "grub" to enter the Grub shell.
Typing

root (hd1,0)

and

setup (hd0)

failed. Grub didn't recognized any of my discs. After doing a little research I found out that the problem is in the /boot/grub/device.map file, that is supposed to contain the info about my discs for Grub's usage. Only in my case it contains a single line:

(fd0) /dev/fd0

. Trying to add additional lines manually had no effect. sad
I am probably doing something wrong here... again. Can you, please, tell me what?

Thank you, for putting up with me so far. smile

Offline

#14 2004-11-10 17:39:36

dauphin
Member
From: Scotland
Registered: 2003-07-09
Posts: 188

Re: Problems recovering GRUB to MBR, chroot fails

Try:  grub-install (hd0)

You might need to append the --recheck option:

--recheck'
     Recheck the device map, even if `/boot/grub/device.map' already
     exists. You should use this option whenever you add/remove a disk
     into/from your computer.

You will get there!

Offline

#15 2004-11-10 18:02:29

mitya
Member
Registered: 2004-08-03
Posts: 19

Re: Problems recovering GRUB to MBR, chroot fails

dauphin wrote:

Try:  grub-install (hd0)

You might need to append the --recheck option:

--recheck'
     Recheck the device map, even if `/boot/grub/device.map' already
     exists. You should use this option whenever you add/remove a disk
     into/from your computer.

You will get there!

It didn't work. sad

Alwin wrote:

Apart from chrooting & executing the bootloader-installer, step 3 is crucial here, without it you'd have empty /dev directory within chroot environment. Did you mount this in your attempts?

I am using udev, but no, I haven't tried to mount the /dev yet. I am not sure this will work for udev, but I'll try anyway. Thanks!

Offline

#16 2004-11-10 18:56:01

dauphin
Member
From: Scotland
Registered: 2003-07-09
Posts: 188

Re: Problems recovering GRUB to MBR, chroot fails

Is device.map actually necessary?  (I don't have one)

You might try deleting it and if that doesn't work regenerate the file with
grub --devicemap=device.map

Offline

#17 2004-11-11 06:54:15

mitya
Member
Registered: 2004-08-03
Posts: 19

Re: Problems recovering GRUB to MBR, chroot fails

dauphin

Thanks, man! big_smile Mounting /dev before chroot did the trick. Finally, I am able to use Arch again. smile

Offline

#18 2004-11-11 08:33:01

dauphin
Member
From: Scotland
Registered: 2003-07-09
Posts: 188

Re: Problems recovering GRUB to MBR, chroot fails

Nothing to do with me, it's Alwin who came up with that one!  smile

Glad you got going again anyway.

Offline

#19 2004-11-11 13:31:04

mitya
Member
Registered: 2004-08-03
Posts: 19

Re: Problems recovering GRUB to MBR, chroot fails

Oh, I am sorry! :oops:

Alwin

Didn't mean to take the credit from you. Thank you!

Offline

Board footer

Powered by FluxBB