KP on 12 Oct 2017 13:04:25 -0700


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

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


For the record, what JP described works. I do this quite a bit when I'm moving systems around- to new hardware or to VMs... changing filesystems... collapsing multiple partitions to one... its process that is good to know because it works uniformly for any Linux build...

...it even works for inferior operating systems ;)

On October 11, 2017 8:35:03 PM EDT, JP Vossen <jp@jpsdomain.org> wrote:
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

--
Sent from my Android device with K-9 Mail.
___________________________________________________________________________
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