Configure systems to boot into a specific target automatically

7. Deploy, Configure, and Maintain Systems

📘Red Hat Certified System Administrator (RHCSA – EX200)


1. Understanding Boot Targets in Linux (RHEL/CentOS/AlmaLinux)

In RHEL 7 and later, Linux uses systemd to manage services and the boot process.

  • A target is like a “mode” that the system boots into.
  • Each target defines what services start and which do not.

Think of targets as “system states” in IT terms:

TargetDescriptionCommon Use Case
graphical.targetFull graphical desktop environmentWorkstations or systems with GUI
multi-user.targetText-based login (no GUI)Servers accessed via SSH
rescue.targetSingle-user mode for recoveryFixing system problems
emergency.targetMinimal system, root onlyDeep troubleshooting or repairing disks

Exam tip: You need to know graphical.target vs multi-user.target, because most servers use multi-user.target.


2. Viewing the Current Default Boot Target

To check what target your system boots into by default, use:

systemctl get-default

Example:

$ systemctl get-default
graphical.target
  • This means the system currently boots into GUI mode.
  • For a server, you might want multi-user.target instead.

3. Changing the Default Boot Target

To change the system’s default target, use:

systemctl set-default <target_name>

Example: Set server to boot into multi-user (no GUI):

sudo systemctl set-default multi-user.target

Verify the change:

systemctl get-default
# Output should now be multi-user.target
  • This change is permanent – it will remain across reboots.

4. Switching Targets Without Rebooting

Sometimes you need to switch targets immediately without rebooting:

sudo systemctl isolate <target_name>

Example: Switch to rescue mode immediately:

sudo systemctl isolate rescue.target
  • Note: Using isolate changes the current running target and stops services not needed by the new target.

5. Checking Which Targets Are Available

To list all systemd targets:

systemctl list-unit-files --type=target

You’ll see something like:

graphical.target      enabled
multi-user.target enabled
rescue.target disabled
emergency.target disabled
  • enabled means the target can be used normally.
  • disabled typically means it’s only used manually in emergencies.

6. Example Scenarios in IT

  1. Server Boot to Text Mode for SSH Management
    • Servers don’t need GUI, so you set default to multi-user.target.
    • Commands: sudo systemctl set-default multi-user.target
      sudo systemctl get-default
  2. Workstation Boot to GUI
    • Workstations with desktop environments need GUI, so graphical.target is default.
    • Commands: sudo systemctl set-default graphical.target
  3. Rescue Mode for Disk Repair
    • If a server fails to boot normally, you can boot into rescue.target using GRUB or: sudo systemctl isolate rescue.target

7. Temporary Boot Target via GRUB

Sometimes you don’t want to change the default, but want to boot into a different target once:

  1. Reboot the system.
  2. At GRUB menu, press e to edit the boot entry.
  3. Find the line starting with linux or linux16.
  4. Add the target at the end:
systemd.unit=multi-user.target
  1. Press Ctrl+X to boot.
  • This only affects the current boot; default remains unchanged.

8. RHCSA Exam Checklist for Boot Targets

To make sure you’re ready for the exam, practice these tasks:

  1. Check the current default boot target: systemctl get-default
  2. Change the default target permanently: sudo systemctl set-default multi-user.target
  3. Switch targets immediately without reboot: sudo systemctl isolate rescue.target
  4. List all available targets: systemctl list-unit-files –type=target
  5. Temporary boot target via GRUB (one-time):
    • Edit GRUB at boot → append systemd.unit=multi-user.target

Tip: In the exam, they may ask you to change the system to boot in a specific target and verify it. Always check with systemctl get-default.


Key Takeaways for Students

  • Targets control what services run at boot.
  • graphical.target = GUI, multi-user.target = server mode.
  • Use systemctl set-default for permanent changes.
  • Use systemctl isolate to change immediately without reboot.
  • Use GRUB for one-time boot targets.
  • Always verify with systemctl get-default.
Buy Me a Coffee