[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: chroot problem with grub



On Thu, 13 Apr 2006 21:21:44 +0200
Philippe De Ryck <philippe.de.ryck@skynet.be> wrote:

> On Thu, 2006-04-13 at 12:13 -0600, Justin Guerin wrote:
> > Hi,
> > 
> > I've had to move my install to a new physical disk.  I made an image of my 
> > two partitions (/boot and /), and they restored properly.  Now, I only need 
> > to run grub-install to install the boot loader.  
> > 
> > When I boot from Knoppix, I can mount the / to /mnt/target, then mount /boot 
> > to /mnt/target/boot, and /proc to /mnt/target/proc, but I can't get 
> > grub-install to work properly.  When I chroot /mnt/target, and run grub, 
> > grub can't see the drives (error 21).  However, when I back out of the 
> > chroot, grub sees the drives just fine.
> > 
> > Can anyone tell me how grub accesses the bios to find out information about 
> > drives?  I'm not passing something through the chroot, but I have no idea 
> > what.  The device nodes are available in the chroot, and so is proc.  I'm 
> > running as root, and I know I have access to the device nodes.
> > 
> > Any help is appreciated.
> > 
> > Justin
> 
> Justin,
> 
> I don't think it is necessary to chroot at all. The knoppix disk has
> grub on board, so you can use that command. The command also has a
> command line switch to specify a device (/dev/hda for instance) and you
> can also specify a root-dir. If you specify as root-dir the mount point
> of your system (/mnt/target) grub will take the config file
> from /mnt/target/boot/...) and everything should work just fine.
> 
> If you search the internet (or the manual perhaps) for this specific
> info you'll find a lot more.
> 
> Good luck
> 
> Philippe De Ryck

This will work, but will install the grub version from Knoppix. If you
still want to do via chroot here's the recipe. Commands indented for
visibility (# means the root prompt, you can use sudo instead) and
assuming hda2 is your '/' and hda1 is your '/boot':

1. mount your / /boot AND /dev:
	#mount /dev/hda2 /mnt/target
	#mount /dev/hda1 /mnt/target/boot
	#mount -o remount /dev /mnt/target/dev

2. chroot:
	#chroot /mnt/target
3. mount /proc:
	#mount /proc
4. install grub:
	#grub-install /dev/hda

This should do it. The first part is the one that can create problems.
If you mount / via Knoppix's fstab then you won't be able to
mount /dev due to the nodev option ;) (This is documented on Knoppix's
site)

HTH
Andrei
-- 
If you can't explain it simply, you don't understand it well enough.
(Albert Einstein)



Reply to: