RHEL7: Boot systems into different targets manually.

Share this link

Note: This is an RHCSA 7 exam objective.

In the old days

Before Systemd, there were the following runlevels:

  • 1, single: maintenance level,
  • 2: level without network resources (NFS, etc),
  • 3: multi-user level without graphical interface,
  • 5: multi-user level with graphical interface.

Note: The default run level was set in the /etc/inittab file.

To get the current run level with the old way, type:

# runlevel

To change the current run level (where X is the run level), type:

# init X

Note: As seen before, levels 0 and 6 were respectively used for halting a system and for rebooting it.

Current State

With Systemd, new commands are available:

  • systemctl rescue: to move to single user mode/maintenance level with mounted local file systems,
  • systemctl emergency: to move to single user mode/maintenance with only /root mounted file system,
  • systemctl isolate multi-user.target: to move to multi-user level without graphical interface (equivalent to previous run level 3),
  • systemctl isolate graphical.target: to move to multi-user level with graphical interface (equivalent to previous run level 5),
  • systemctl set-default graphical.target: to set the default run level to multi-user graphical mode,
  • systemctl get-default: to get the default run level.

Additional Resources

Make sure you visit the Systemd page.

You can also watch Ralph Nyberg‘s video about Systemd targets (6min/2015).

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 4.00 out of 5)
Loading...
9 comments on “RHEL7: Boot systems into different targets manually.
  1. salvador says:

    To boot into a systemd target from the grub menu, append to the kernel line for example:
    systemd.unit=graphical.target

  2. twostep says:

    Strange
    In case of command “systemctl rescue” I get info:
    “…Welcome to emergency mode! After logging in, type “journalctl -xb” to view…”
    and all file systems are mounted.
    Maybe the rescue mode is accessed only via rd.break parameter during boot?

  3. blumeout86 says:

    My sytemctl has built-in command completion, so I can type systemctl, hit TAB twice, and it shows all the possible actions, like rescue or isolate graphical.target.
    When I type systemctl set-default and TAB, there are about 70 different runlevels!!! I’m glad the exam just focuses on the more common ones.

    • blumeout86 says:

      What’s more, if you’re an old-school admin, systemd supports the traditional initd runlevels. For instance, if I type…
      systemctl isolate runlevel6.target
      the system will reboot.

    • Sam says:

      Note I think bash-complete needs to be installed to ensure tab works.

      • blumeout86 says:

        No. This isn’t bash completion. I’m talking TAB completion for various utilities, like nmcli, and systemctl. I have a VM running the CentOS 7 minimal install. Bash completion works fine, but not the individual utilities.
        BTW, the package is called bash-completion. There is also a package called bash-completion-extras. That also does not install those utilities. Everything works just fine on the default install.

        • blumeout86 says:

          Oh, man, did I ever get it wrong on that one. You’re correct, you need bash-completion and bash-completion-extras. I installed them on a VM running the CentOS 7 minimal install, but it still didn’t work.
          After some research, it turns out that completion is a bunch of shell scripts – I thought it was a daemon. It didn’t work because the main script is sourced in the user’s start-up scripts. Simply logging out and back in again (no restart) got it all working.

          • Sam says:

            Your welcome. I only used bash-completion, and every time I did a new VM, I used a minimal-install, just in-case there may be something like that on the exam.

Leave a Reply

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 15 minutes.
Get an iso image of CentOS 7 (or a DVD) and set up a local repository.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a caching-only DNS server.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...