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

Re: Problems with grub2/initramfs-tools in chroot



On Vi, 21 nov 14, 14:43:11, Ross Boylan wrote:
> 
> grub needs to know where it should jump to. I don't know how it can
> figure that out from inside a chroot.  For example, say /boot inside
> the chroot is mounted from sdb2. To the chroot, it's just part of the
> filesystem.  How is grub-install to figure out that, when it loads
> from the start of the disk, it should look for the grub directory (not
> /boot/grub) of the appropriate partition?  The only possibility I can
> think of would be that it looks in /etc/fstab.

As far as I understand it you must reproduce the to-be-booted system in 
the chroot as much as possible. Assuming /dev/sdc2 should be your root 
partition and /dev/sdc1 your /boot this should work

mount /dev/sdc2 /chroot
mount /dev/sdc1 /chroot/boot
mount -o bind /dev /chroot/dev
mount -t sysfs sysfs /chroot/sys
mount -t proc proc /chroot/proc
chroot /chroot
grub-install /dev/sdc # installing to MBR

If the kernel in the new system is significantly different to the one 
you're running from this might lead to problems, so as soon as you 
manage to boot run another 'grub-install /dev/sdc'.

Hope this helps,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
http://nuvreauspam.ro/gpg-transition.txt

Attachment: signature.asc
Description: Digital signature


Reply to: