26

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?

29

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.

| improve this answer | |
2

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.

| improve this answer | |
  • 2
    This is an old thread, but no matter. @Premkumar, yr answer applies more to Unix type specifications such as the Lx Standard Base (LSB) than to Debian GNU Lx or Ubuntu for that matter. Check the run level of yr Ubuntu type distro and you will see that it is probably 2 or perhaps 1, in rare cases where a single user mode runlevel is preferred. See this Wiki for a detailed description. In Ubuntu, Runlevel 2 is for "Graphical multi-user with networking". The Wiki holds descriptions for many distros. – Cbhihe Oct 3 '14 at 10:01
1

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
| improve this answer | |
0

You could also make use of the corresponding target of your desired runlevel. You can check which of the available target your system is running as default using:

systemctl get-default  

Supposing the graphical.target is the default, you can further check its definition and detailed information using:systemctl cat graphical.target. There are some target units tailored after the corresponding runlevels. You can find which of them are available on your system by listing them: systemctl list-unit-files -t target Suppose you want to set runlevel 2 as default, you can do this by running:

sudo systemctl set-default runlevel2.target

You should use this with caution and make sure you are not causing any issues running on the inappropriate target.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.