[PLUG] Slackware -- programs missing

Ben Koenig techkoenig at gmail.com
Mon Nov 26 01:53:00 UTC 2018


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. 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


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

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.




On Sat, Nov 24, 2018 at 5:27 PM Dick Steffens <dick at dicksteffens.com> wrote:

> On 11/25/18 5:06 PM, Ben Koenig wrote:
> > Ah ok. I think I know what is happening.
> >
> > I'm assuming here that your filesystem on /dev/sda2 is functional and
> has a
> > working install of Slackware. A quick description of the LILO setup.
> >
> > lilo.conf sets up the configuration for the bootloader. However, after
> > creating your config you have to run the lilo command to upload your
> > kernel, initrd, and the bootloader itself to your MBR.
> >
> > Your file looks correct, however it still fails to find your root
> > filesystem. I'm hoping this is because lilo was run before you finished
> > your config, which means all we need to do is run it again :-)
> >
> > To do this, you want to boot the live media again, and manually mount
> sda2
> > with the following command (as root):
> > mount /dev//sda2 /mnt/hd
> >
> > Now you can list the contents of /mnt/hd/
> > /mnt/hd/ is a default folder in slackware that you can use for recovery
> > jobs such as this. Temporary mounts here will not interrupt the system.
> At
> > this point you should verify the existence of the init program with the
> > following command:
> >
> > $ ls /mnt/hd/sbin/init
> > /sbin/init*
> >
> > The error you are getting is referring to that file. When the kernel
> boots,
> > it mounts the rootfs as defined by lilo and then runs /sbin/init. If init
> > does not exist, no init found.
> > I'm pretty sure you have /sbin/init, but it doesn't hurt to double check.
> > Assuming it is still there then we need to do a quick chroot and re-run
> > lilo.
> >
> > Go ahead and boot live, mount sda2 as described above and verify that
> > /sbin/init exists.
>
> bash-4.4# mount /dev//sda2 /mnt/hd
> bash-4.4# ls /mnt/hd/sbin/init
> /mnt/hd/sbin/init
>
> Also confirmed that I see it with ls /mnt/hd/sbin.
> > The next step after that is a chroot and I need to go
> > look those commands up because I can never remember them off the top of
> my
> > head.
> > We know why it doesn't want to boot, so all we need to do now is fix it.
> :)
>
> I appreciate your help. I've heard of chroot, but never had it explained
> in a form I actually understood.
>
> --
> Regards,
>
> Dick Steffens
>
> _______________________________________________
> PLUG mailing list
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list