Changing Linux run levels
search cancel

Changing Linux run levels

book

Article ID: 328844

calendar_today

Updated On:

Products

VMware VMware Desktop Hypervisor VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

This article describes how to change Linux run levels. Changing Linux run levels is useful in troubleshooting problems where it is suspected that there is a daemon or application being loaded into Linux that may be causing unexpected operating system behavior. Examples of such unexpected behavior include crashes, the operating system failing to respond or being slow, and network problems. If the unexpected behavior stops after disabling a service or application then the source of the problem is identified. Other reasons for changing the run level include not having a requirement for an X-Windows environment and needing to perform system maintenance.

Resolution

To change the run level of a Linux operating system:

Note: If the run level is being changed to troubleshoot a problem with the operating system or an application, following this procedure may remove a software environment that is required to test the health of your operating system.
  1. Ensure that you are logged in as a user with root privileges.

  2. Edit the file /etc/inittab in the text editor of your choice.

    Note: To perform this from a shell prompt using the VI text editor, refer to the Additional Information section at the end of this document.

  3. Look for the line of text id:X:initdefault: where X is replaced by a number. This number represents the default Linux run level.

  4. Edit the line of text and replace X with the run level you want to change to:

    1 Single User Mode
    3 Full multiuser
    5 X-Windows (X11)

    Note: The above is a list of run levels that are generally used. If the full list is not displayed at the top of the inittab file and you need to change to a level not listed, refer to the manual for your distribution of Linux.

    Warning: Do not set X to 0 or 6.

  5. Save the edited file.

  6. Reboot the operating system.

    Note: Linux boots into the new run level each time it is started. To return it to its former behavior, repeat steps 1-6 and edit the file to use the original value of X.

    Note: It is possible to change the run level without rebooting the operating system and without affecting the run level the operating system defaults to when it is started:

    1. Open a shell prompt. For more information, see Opening a command or shell prompt (1003892).

    2. Type init X and press Enter, where X is replaced by the run level you want to change to.

      Note: If this command does not work, refer to the manual for your distribution of Linux.

      Caution: This command exits all running applications. Save all work before entering this command.


Additional Information

Editing the /etc/inittab file from a shell prompt using the VI text editor:
  1. Open a shell prompt. For more information, see Opening a command or shell prompt (1003892).
  2. Type cd /etc and press Enter.
  3. Type vi inittaband press Enter.
  4. Type /id: and press Enter.
  5. Press the right arrow key three times.
  6. Type r.
  7. Type the number of the run level you want to change to.
  8. Type :x and press Enter.