JP Vossen on 11 Oct 2017 17:35:09 -0700


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

Re: [PLUG] create a boot record without use of chroot?


first things first, have you tried:
chroot /mnt/newroot /bin/bash

That works if I boot into the root directory--thank you!  Then I run
into the frustrating problem that it doesn't help me because there's a
separate boot partition, and boot is what I need access to to update
grub.  If I try the same command to chroot into the boot partition,
unsurprisingly it doesn't work:
chroot:  failed to run command /bin/bash:  no such file or directory

If I'd had the entire filesystem on one partition, I'd be all set at
this point, but because of the separate boot partition it doesn't work.
Is there a way around that?

There are 2 things that help out the whole `chroot` thing and this process.

One is simple, create your mounts the way you need them, then mount them that way. The second is "bind mounts" (kinda like a symlink for a mount). So if you have sda1 as /boot/ and sda2 as / then as root:
	cd /mnt
	mkdir -p recover/boot
	mount /dev/sda2 recover
	mount /dev/sda1 recover/boot
	mount -o bind /dev /mnt/recover/dev
	mount -t proc none /mnt/recover/proc
	chroot recover

Then, **hopefully** you can `grub-install` or whatever you're trying to do.

HTH,
JP
--  -------------------------------------------------------------------
JP Vossen, CISSP | http://www.jpsdomain.org/ | http://bashcookbook.com/
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug