How can I see or change default run level?

In the Linux / Unix administration handbook it mentions that you can edit the /etc/inittab file to change the run level. I don't have that file on 10.04. I Googled this and found a tip saying that file had been replaced with /etc/event.d/rc-default - however I don't have that file on my system either.

Have these been deleted or does 10.04 deal with run levels differently?


Yes, it deals with them differently.

To see the current (and previous) runlevel:

runlevel

To switch runlevels:

sudo init $runlevel

For example, to reboot:

sudo init 6

The init you are reading about was replaced by upstart starting with Edgy Eft 6.10; and, one of the programs provided by upstart is its own implementation of init. Here are the docs for 10.04.

To change the default runlevel, use your favorite text editor on /etc/init/rc-sysinit.conf...

sudo vim /etc/init/rc-sysinit.conf

Change this line to whichever runlevel you want...

env DEFAULT_RUNLEVEL=2

Then, at each boot, upstart will use that runlevel.


To See the Current Run Level Command:

$ who -r or $ runlevel

If you want chance the runlevel Command

$ sudo init 1 ( it will take to u single user mode)

This are differnt runlevel you can perform :

0 - System halt; no activity, the system can be safely powered down.

1 - Single user; rarely used.

2 - Multiple users, no NFS (network filesystem); also used rarely.

3 - Multiple users, command line (i.e., all-text mode) interface; the standard runlevel for most Linux-based server hardware.

4 - User-definable

5 - Multiple users, GUI (graphical user interface); the standard runlevel for most Linux-based desktop systems.

6 - Reboot; used when restarting the system.


Normally this is done by explicitly adding a number to the kernel options in the GRUB entry.

Let's say, you want to change default grub entry from default run level (5) to 3:

sudo vim /boot/grub/grub.cfg

Find a place of default boot entry, and have a look at linux line. Might look something like this:

linux   /boot/vmlinuz-3.0.0-13-generic root=UUID=d07e0c99-65ba-4eda-98d8-79693dc79554 ro   quiet splash vt.handoff=7

Add 3 at the end of that line:

linux   /boot/vmlinuz-3.0.0-13-generic root=UUID=d07e0c99-65ba-4eda-98d8-79693dc79554 ro   quiet splash vt.handoff=7 3

Try it out:

sudo reboot