MAJOR Console Errors
Kevin Buettner
kev@primenet.com
Sun, 30 Jul 2000 21:59:05 -0700
Nathan,
The command you're thinking of is ``chroot''. ``chroot'' is well
worth knowing about for rescue situations, but I don't think it will
be of much benefit to Zach for solving his particular problem. You
see, Zach will need to restore everything that he inadvertently moved
once he is able to run ``ls'', ``mv'', etc. In order to do that, he
can not change the root location to somewhere else or else he won't be
able to restore properly. I.e, if he were to somehow do a "chroot
/graphics", this would mean that the the new / would actually be
/graphics and he would be unable to restore /bin, /usr/bin, etc. to
their proper locations since the old / is no longer accessible.
So when is ``chroot'' useful?
Suppose you've just changed the root password and can't remember what
you changed it to (this happened to me a short while ago on a machine
that I was setting up). All you need to do is boot with a rescue
disk; I like tomsrtbt. Then mount your / partition at /mnt and your
/usr partition (if you have a separte one) at /mnt/usr. Then, do
chroot /mnt
Once this is done, you'll be able to run ``passwd'' in order to easily
change the root password to something that you'll hopefully remember
the next time you need it.
I've found this technique useful for other situations as well
including ones in which I've just added a disk drive so that the drive
mappings contained in /etc/fstab and /etc/lilo.conf are no longer
valid. Using chroot after booting a rescue disk allows you to modify
the mappings in /etc/fstab and /etc/lilo.conf. (But note that you
could do this anyway even without doing a chroot.) The real value of
chroot comes in when you wish to run lilo; since / is really the / of
your system, you can run lilo as normal and be certain that it is
finding your lilo.conf file in the normal location.
Another use for chroot (which I've never used, but I suspect would
work) is in situations where you have several distributions on your
machine. Let's suppose that you're currently running Red Hat, and
would like to quickly (and painlessly) try something out on Debian.
Rather than rebooting, you can simply become root in one one of your
terminal windows (e.g, an xterm), mount your debian root partition in
some convenient locations, say /debian, do a chroot to /debian, and
then run "mount -a" to get the rest of your mounts in place (if
necessary). Then, for safeties sake, su to an ordinary user and go to
work on what'll appear to be your debian system. The other terminal
windows will still be running Red Hat, but you'll have one (or more if
you start up separate xterms) which are (for the most part) running
debian. (Note that you're not actually running the debian kernel, but
there are many situations where this doesn't really matter. E.g, a
software developer who wishes to try his executables on many
distributions wouldn't care that much.)
Kevin
On Jul 30, 4:30pm, Nathan Saper wrote:
> Subject: Re: MAJOR Console Errors
> On Sun, 30 Jul 2000 C0DEMASTR@aol.com wrote:
>
>
> changeroot should work. Just make /graphics your root directory. Then,
> /graphics/bin will be /bin, etc.
>
> I believe the command would be:
>
> changeroot /graphics
>
> However, I'm not at my Linux machine, and I have aliases to hard-to-
> remember commands all over my shell, so changeroot might not be the right
> command name. YMMV.
>
> > Hey everyone.
> >
> > This is zach and I really need help because my computer is majorly hosed
> > right now. I decided to move some images from my root directory to my images
> > directory and I used the command 'mv * /graphics' So now as you can imagine I
> > am in the console blind. I have no ls, cp, mv, mount, dir, or anything useful
> > except I am in BASH. Does anyone know how I can regain control of my system?
> >
> > What I have tried so far: I can cd into /graphics/bin where it got moved
> > to and BASH says stuff like ls is not a directory when I try to cd to it, but
> > I cannot run anything.
> >
> > If anyone could please help me tonight I will be very grateful.
> >
> > -Zach
> >
>
> --
>
> Nathan Saper
> natedog@well.com
> nsaper@sprintpcs.com (cell phone)
> http://www.well.com/user/natedog/
>
>
> _______________________________________________
> Plug-discuss mailing list - Plug-discuss@lists.PLUG.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>-- End of excerpt from Nathan Saper