On 11/25/18 5:53 PM, Ben Koenig wrote:
Chroot is often used when installing linux. It's really common actually,
but the installer programs and scripts you see for most distros will
automate the task silently in the background. Gentoo and Arch have nice
walkthroughs for what we want to do since both of those feature manually
install steps.
Basically, we need to set our shell to think we are inside your rootfs. It
won't boot, but it looks ok since your files are there. So a chroot is a
way to "change root". From our live filesystem, we are going to change to
your local filesystem. We will then have access to the programs and shell
environment of /dev/sda2, without actually booting it. Once we achieve
that, we run 'lilo' to make sure your bootloader has been properly uploaded
to the MBR.
Run the following commands from your life environment. Make absolutely sure
you still have /dev/sda2 mounted on /mnt/hd.
mount reports:
/dev/sda2 on /mnt/hd type ext4 (rw)
Also be very watchful for any
errors that occur. Ideally these commands will complete silently.
mount -t proc proc /mnt/hd/proc
mount -o bind /sys /mnt/hd/sys
mount -o bind /dev /mnt/hd/dev
All three executed quietly.
These first 3 mounts are to set up some virtual fs stuff used for book
keeping. Those are the folders most people ignore because they contain low
level info about your hardware. I don't really know how they work, I just
know they need to be mounted for LILO to work. For these mounts it's better
to go slow to make sure nothing weird happens with the paths instead of
charging ahead and miss one of them.
Now that you are ready, do the thing:
$ chroot /mnt/hd/ /bin/bash
bash-4.4# chroot /mnt/hd/ /bin/bash
chroot: failed to run command 'bin/bash': No such file or directory
bash-4.4# ls -l /bin/bash
-rwx-xr-x 1 root root 1102944 Jun 5 11:56 /bin/bash
Looks like it's there. I wonder why chroot won't see it.
I assume it makes no sense to proceed until we figure that one out.
The command structure is: chroot <new root> <shell to use on the new root>
Now you have become your install. Technically you have booted your OS, but
you are using the kernel from the live media ;-)
The shell you used to perform the chroot "thinks" that your root filesystem
is on /dev/sda2. So we can fix our bootloader.
Run the LILO command:
$ /sbin/lilo
and post the output here. It will print out a summary of your config as it
writes to your MBR. Or it will yell and give you scary errors. Sometimes
both, we shall see, and we want to triple check these messages BEFORE we
reboot because getting back in here sucks.
--
Regards,
Dick Steffens
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug