Bookmark this page

Guided Exercise: Select the Boot Target

Determine the default target into which a system boots, and boot that system into other targets.

Outcomes

  • Update the system default target and use a temporary target from the boot loader.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command ensures that all required resources are available.

[student@workstation ~]$ lab start boot-selecting

Instructions

  1. On the workstation machine, open a terminal and confirm that the default target is graphical.target.

    [student@workstation ~]$ systemctl get-default
    graphical.target
  2. On the workstation machine, switch to the multi-user target manually without rebooting. Use the sudo command and if prompted, use student as the password.

    [student@workstation ~]$ sudo systemctl isolate multi-user.target
    [sudo] password for student: student
  3. Log in as the root user by using redhat as the password.

    workstation login: root
    Password: redhat
    [root@workstation ~]#
  4. Configure the workstation machine to automatically boot into the multi-user target, and then reboot the workstation machine to verify. When done, change the default systemd target back to the graphical target.

    1. Set the default target.

      [root@workstation ~]# systemctl set-default multi-user.target
      Removed /etc/systemd/system/default.target.
      Created symlink /etc/systemd/system/default.target -> /usr/lib/systemd/system/multi-user.target.
    2. Reboot the workstation machine. After reboot, the system presents a text-based console and not a graphical login screen.

      [root@workstation ~]# systemctl reboot
    3. Log in as the root user.

      workstation login: root
      Password: redhat
      Last login: Thu Mar 28 14:50:53 on tty1
      [root@workstation ~]#
    4. Set the default systemd target back to the graphical target.

      [root@workstation ~]# systemctl set-default graphical.target
      Removed /etc/systemd/system/default.target.
      Created symlink /etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target.

      This step concludes the first part of the exercise, where you practice setting the default systemd target.

  5. In this second part of the exercise, you practice by using rescue mode to recover the system.

    Access the boot loader by rebooting workstation again. From within the boot loader menu, boot into the rescue target.

    1. Initiate the reboot.

      [root@workstation ~]# systemctl reboot
    2. When the boot loader menu appears, press any key to interrupt the countdown (except Enter, which would initiate a normal boot).

    3. Use the cursor keys to highlight the default boot loader entry.

    4. Press e to edit the current entry.

    5. Using the cursor keys, navigate to the line that starts with linux.

    6. Press End to move the cursor to the end of the line.

    7. Append systemd.unit=rescue.target to the end of the line.

      Note

      If it is difficult for you to read the text in the console, then consider changing the resolution when you edit the kernel line in the boot loader entry.

      To change the console resolution, add either video=640x480 or vga=ask to the line that starts with the linux word, after systemd.unit=rescue.target. With the video=640x480 argument, the text console should be displayed at approximately an 80-column width. If you use vga=ask instead, then you can choose the resolution that best suits your environment at boot time.

    8. Press Ctrl+x to boot by using the modified configuration.

    9. Log in to rescue mode. You might need to press Enter to get a clean prompt.

      Give root password for maintenance
      (or press Control-D to continue): redhat
      [root@workstation ~]#
  6. Confirm that in rescue mode, the root file system is in read/write mode.

    [root@workstation ~]# mount
    ...output omitted...
    /dev/vda4 on / type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
    ...output omitted...
  7. Press Ctrl+d to continue with the boot process.

    The system presents a graphical login. Log in as the student user.

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish boot-selecting

Revision: rh134-9.3-5fd2368