Bookmark this page

Lab: Controlling the Boot Process

Performance Checklist

In this lab, you will reset the root password on a system, recover from a misconfiguration, and set the default boot target.

Outcomes

You should be able to:

  • Reset a lost root password.

  • Diagnose and fix boot issues.

  • Set the default systemd target.

Log in to workstation as student using student as the password.

On workstation, run the lab boot-review start command. This command runs a start script that determines if the serverb machine is reachable on the network. It also introduces a file-system issue, resets the root password, sets a higher timeout for the GRUB2 menu, and reboots serverb.

[student@workstation ~]$ lab boot-review start
  1. On serverb, reset the root password to redhat.

    Locate the icon for the serverb console, as appropriate for your classroom environment. Work from that console.

    1. Send a Ctrl+Alt+Del to your system using the relevant button or menu entry.

    2. When the boot-loader menu appears, press any key to interrupt the countdown, except Enter.

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

    4. Press e to edit the current entry.

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

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

    7. Append rd.break to the end of the line.

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

    9. At the switch_root prompt, remount the /sysroot file system read/write, then use chroot to go into a chroot jail at /sysroot.

      switch_root:/# mount -o remount,rw /sysroot
      switch_root:/# chroot /sysroot
    10. Set the root password to redhat.

      sh-4.4# passwd root
      Changing password for user root.
      New password: redhat
      BAD PASSWORD: The password is shorter than 8 characters
      Retype new password: redhat
      passwd: all authentication tokens updated successfully.
    11. Configure the system to automatically perform a full SELinux relabel after boot.

      sh-4.4# touch /.autorelabel
    12. Type exit twice to continue booting your system. The system fails to boot because of an issue you resolve in the next step.

  2. The system fails to boot. A start job does not seem to complete. From the console, fix the issue.

    1. Boot the system into emergency mode. To do so, reboot serverb by sending a Ctrl+Alt+Del to your system using the relevant button or menu entry.

    2. When the boot-loader menu appears, press any key to interrupt the countdown, except Enter.

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

    4. Press e to edit the current entry.

    5. Use the cursor keys to 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=emergency.target to the end of the line.

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

    9. Log in to emergency mode. The root password is redhat.

      Give root password for maintenance
      (or press Control-D to continue): redhat
      [root@serverb ~]# 
    10. Remount the / file system read/write.

      [root@serverb ~]# mount -o remount,rw /
    11. Use the mount -a command to attempt to mount all the other file systems.

      [root@serverb ~]# mount -a
      mount: /olddata: can't find UUID=4d5c85a5-8921-4a06-8aff-80567e9689bc.
    12. Edit /etc/fstab to remove or comment out the incorrect line.

      [root@serverb ~]# vim /etc/fstab
      ...output omitted...
      #UUID=4d5c85a5-8921-4a06-8aff-80567e9689bc  /olddata  xfs  defaults  0 0
    13. Update systemd for the system to register the new /etc/fstab configuration.

      [root@serverb ~]# systemctl daemon-reload
      [root@serverb ~]# 
    14. Verify that your /etc/fstab is now correct by attempting to mount all entries.

      [root@serverb ~]# mount -a
      [root@serverb ~]# 
    15. Reboot the system and wait for the boot to complete. Because you created the /.autorelabel file in the first step, after setting the root password, the system runs an SELinux relabel, then reboots again by itself. The system should now boot normally.

      [root@serverb ~]# systemctl reboot
  3. Change the default systemd target on serverb for the system to automatically start a graphical interface when it boots.

    No graphical interface is installed yet on serverb. For this exercise, only set the default target and do not install the packages.

    1. Log in to serverb as the root user. Use redhat as the password.

    2. Use the systemctl set-default command to set graphical.target as the default target.

      [root@serverb ~]# systemctl set-default graphical.target
    3. Use the systemctl get-default command to verify your work.

      [root@serverb ~]# systemctl get-default
      graphical.target
    4. Log off from serverb.

      [root@serverb ~]# exit

Evaluation

On workstation, run the lab boot-review grade script to confirm success on this exercise.

[student@workstation ~]$ lab boot-review grade

Finish

On workstation, run the lab boot-review finish script to complete the lab.

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

This concludes the lab.

Revision: rh134-8.2-f0a9756