Trouble with Runlevel

ME dugan at libwais.sonoma.edu
Tue Mar 21 20:14:16 PST 2000


Hello,

USE THIS AT YOUR OWN RISK:

(Read it it the end before attempting it. Thanks.)

If all else fails, you may be able to get into your system without having
*any* init scripts run on your machine.

Realize, use of the "Linux Emergency Boot Disk" which may have come with
your system is often a better solution, but here is a procedure you can
try if you are in a serious bind without any other recourse:

Part 1 Starting up a kernel:
Booting your system with an alternate init
 From Lilo:
  When you see the Lilo prompt, press shift, then let go and press tab
  Locate the name of the normal linux kernel label, or the one you know
   works and is stable, then type that label at the "boot:" prompt and
   add the following to it: init=/bin/bash so you should see:
  LILO
  Boot: YourKernelLabel init=/sbin/bash

 From LOADLIN.EXE:
  Locate the Batch script you use for starting up Linux from DOS/Windows
   or modify your command line arguements to:
  LOADLINE.EXE from something like (this is an example)
  C:\linux\loadlin.exe c:\linux\k13b mem=128M root=/dev/hda3 ro
  to something like:
  C:\linux\loadlin.exe c:\linux\k13b mem=128M root=/dev/hda3 ro
init=/sbin/bash

If you do not have a staticly linked copy of bash, then perhaps you have a
staticly links copy of sh on your system. Try one of the above with a
substitution from /sbin/bash to /sbin/sh or another shell you have
installed that is staticly linked.

Part 2:
At this point your kernel has loaded into memory, and no service are
running. No networking has been setup, and no modules are likely to be
loaded in memory for special devices configured to be used with modules.

You should just see a root prompt staring you in the face.

At this point you *could* run fsck on your partitions to see if there are
any errors. (However, it is much safer and better to run this from your
"Linux Emergency Boot Disks" so the filesystems being checked are not
mounted, even though these are only mounted as RO.)

Now you should be able to remount your file system with rw premissions
*if* you wish to modify stuff on the hard disk.

If you want to do this then:
 mount -vno remount,rw /

if you just want to look around at your files, then don't do it until you
need it. (Safer.)

Part 3:
Now that you have a shell, you can inspect the startup scripts set to run
on your machine. you can try looking through the startup scripts and see
where a failure may have occurred.

(At this point it would be helpful for you to recall just where you get
that message on run-levels. if you noticed it immediately after the kernel
loaded, but before any services were started, then check out init.)

You could try disabling the services, daemons, programs, etc which you
think may be causing the problems.

Part 4: (SYNC the disk before rebooting!)

(Most Important part if you have chosen to remount your system with RW
access!)

When booting with init=/bin/bash , a shutdown will most often not pre-sync
your disk before rebooting. It is critical that you look in your shell,
make sure all files which were opened have been closed, and your
applications have finished their work. Then manually call "sync", and
either remount "/" with RO permissions and reboot, or just issue the
command "reboot" or "shutdown -r now"

It is critical that you run sync after all of your mods are complete. A
corrupt filesystem, loss of data, files may result if you do not.

I have used the above method a few times on my laptop when I was out in
the middle of nowhere with no extra bootable media.

Part Unrelated to above:
Sometimes it is just easier to re-install unless you have a good idea
where the problem is, or how it was created. Perhaps having a buddy come
over to examine your system is a quick solution. Perhaps, they may tell
you, you need to re-install due to major corruption of your sbins, and/or
library files. Perhaps it will just be something simple, like a self
calling startup script, or bad/damaged kernel, or ?

I have been really busy, or I would have offered this earlier.

Good Luck,
-ME





More information about the talk mailing list