Bookmark this page

Lab: Fixing Boot Issues and Maintaining Servers

In this review, you will troubleshoot and repair boot problems and update the system default target. You will also schedule tasks to run on a repeating schedule as a normal user.

Outcomes

You should be able to:

  • Diagnose issues and recover the system from emergency mode.

  • Change the default target from graphical.target to multi-user.target.

  • Schedule recurring jobs to run as a normal user.

Copy any files or work you wish to keep to other systems before resetting. Reset the workstation, servera, and serverb systems now.

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

On workstation, run lab rhcsa-compreview1 start to start the comprehensive review. This script creates the necessary files to set up the environment correctly.

[student@workstation ~]$ lab rhcsa-compreview1 start

Instructions

Perform the following tasks on serverb to complete the comprehensive review:

  • On workstation, run the lab rhcsa-compreview1 break1 command. This break script causes the boot process to fail on serverb. It also sets a longer timeout on the GRUB2 menu to help interrupt the boot process, and reboots serverb.

    Troubleshoot the possible cause and repair the boot failure. The fix must ensure that serverb reboots without intervention. Use redhat as the password of the superuser, when required.

  • On workstation, run the lab rhcsa-compreview1 break2 command. This break script causes the default target to switch from the multi-user target to the graphical target on serverb. It also sets a longer timeout for the GRUB2 menu to help interrupt the boot process, and reboots serverb.

    On serverb, fix the default target to use the multi-user target. The default target settings must persist after reboot without manual intervention.

    Use the sudo command, as the student user with student as the password, for performing privileged commands.

  • Schedule a recurring job as the student user that executes the /home/student/backup-home.sh script on an hourly basis between 7 p.m. and 9 p.m. on all days except Saturday and Sunday.

    Download the backup script from http://materials.example.com/labs/backup-home.sh. The backup-home.sh backup script backs up the /home/student directory from serverb to servera in the /home/student/serverb-backup directory. Use the backup-home.sh script to schedule the recurring job as the student user on serverb.

  • Reboot the system and wait for the boot to complete before grading.

  1. On workstation, run the lab rhcsa-compreview1 break1 command.

    1. [student@workstation ~]$ lab rhcsa-compreview1 break1
  2. After serverb boots up, access the console and notice that the boot process stopped early. Take a minute to speculate about a possible cause for this behavior.

    1. Locate the icon for the serverb console, as appropriate for your classroom environment. Open the console.

    2. Looking at the error, it appears that at least parts of the system are still functioning.

    3. Press Ctrl+Alt+Del to reboot serverb.

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

    4. Edit the default boot-loader entry, in memory, to log in to emergency mode.

      Press e to edit the current entry.

    5. Use the cursor keys to navigate to the line that starts with linux. Append systemd.unit=emergency.target to the end of the line.

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

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

      Give root password for maintenance
      (or press Control-D to continue): redhat
      [root@serverb ~]# 
  3. Remount the / file system read/write. Use the mount -a command to attempt to mount all the other file systems.

    1. Remount the / file system read/write to edit the file system.

      [root@serverb ~]# mount -o remount,rw /
    2. Use the mount -a command to attempt to mount all the other file systems. Notice that one of the file systems cannot be mounted.

      [root@serverb ~]# mount -a
      mount: /FakeMount: can't find UUID=fake.
    3. Edit /etc/fstab to fix the issue. Remove or comment out the incorrect line.

      [root@serverb ~]# vim /etc/fstab
      ...output omitted...
      #UUID=fake     /FakeMount  xfs   defaults    0 0
    4. Update systemd for the system to register the new /etc/fstab configuration.

      [root@serverb ~]# systemctl daemon-reload
      [ 206.828912] systemd[1]: Reloading.
    5. Verify that /etc/fstab is now correct by attempting to mount all entries.

      [root@serverb ~]# mount -a
    6. Reboot serverb and wait for the boot to complete. The system should now boot normally.

      [root@serverb ~]# systemctl reboot
  4. On workstation, run the lab rhcsa-compreview1 break2 command.

    Wait for the reboot to complete before proceeding.

    1. [student@workstation ~]$ lab rhcsa-compreview1 break2
  5. On serverb, switch to the multi-user target. Set the default target to multi-user. Use the sudo command to run any required administrative command and if prompted, use student as the password.

    1. From workstation, open an SSH session to serverb as the student user.

      [student@workstation ~]$ ssh student@serverb
      ...output omitted...
      [student@serverb ~]$ 
    2. As the student user on serverb, determine the default target.

      [student@serverb ~]$ systemctl get-default
      graphical.target
    3. Switch to the multi-user target. Use the sudo command and if prompted, use student as the password.

      [student@serverb ~]$ sudo systemctl isolate multi-user.target
      [sudo] password for student: student
    4. Set serverb to use the multi-user target as the default target.

      [student@serverb ~]$ sudo 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.
    5. Reboot serverb to verify that the multi-user target is set as the default target.

      [student@serverb ~]$ sudo systemctl reboot
      Connection to serverb closed by remote host.
      Connection to serverb closed.
      [student@workstation ~]$ 
    6. After reboot, open an SSH session to serverb as the student user. Verify that the multi-user target is set as the default target.

      [student@workstation ~]$ ssh student@serverb
      ...output omitted...
      [student@serverb ~]$ systemctl get-default
      multi-user.target
  6. Schedule a recurring job as the student user that executes the /home/student/backup-home.sh script on an hourly basis between 7 p.m. and 9 p.m. on all days except Saturday and Sunday.

    Use the backup-home.sh script to schedule the recurring job. Download the backup script from http://materials.example.com/labs/backup-home.sh.

    1. On serverb, download the backup script from http://materials.example.com/labs/backup-home.sh. Use chmod to make the backup script executable.

      [student@serverb ~]$ wget http://materials.example.com/labs/backup-home.sh
      ...output omitted...
      [student@serverb ~]$ chmod +x backup-home.sh
    2. Use the crontab -e command to open the crontab file using the default text editor.

      [student@serverb ~]$ crontab -e
    3. Edit the file to add the following line:

      0 19-21 * * Mon-Fri /home/student/backup-home.sh

      Save the changes and exit the editor.

    4. Use the crontab -l command to list the scheduled recurring jobs.

      [student@serverb ~]$ crontab -l
      0 19-21 * * Mon-Fri /home/student/backup-home.sh
  7. Reboot serverb and wait for the boot to complete before grading.

    1. [student@serverb ~]$ sudo systemctl reboot
      [sudo] password for student: student
      Connection to serverb closed by remote host.
      Connection to serverb closed.
      [student@workstation ~]$ 

Evaluation

On workstation, run the lab rhcsa-compreview1 grade script to confirm success on this exercise. Correct any reported failures and rerun the script until successful.

[student@workstation ~]$ lab rhcsa-compreview1 grade

Finish

On workstation, run lab rhcsa-compreview1 finish to complete this exercise. This script deletes the files and resources created throughout the exercise and ensures that the environment is clean.

[student@workstation ~]$ lab rhcsa-compreview1 finish

Save any files or work you want to keep to other systems, and then reset workstation, servera, and serverb before the next exercise.

This concludes the comprehensive review.

Revision: rh134-8.2-f0a9756