RHCSA Rapid Track
Course update
An updated version of this course is available that uses a newer version of Red Hat Enterprise Linux in the lab environment. Therefore, the RHEL 9.0 version of the lab environment will retire on December 31, 2024. Please complete any work in this lab environment before it is removed on December 31, 2024. For the most up-to-date version of this course, we recommend moving to the RHEL 9.3 version.
Note
If you plan to take the RHCSA exam, then use the following approach to maximize the benefit of this Comprehensive Review: attempt each lab without viewing the solution buttons or referring to the course content. Use the grading scripts to gauge your progress as you complete each lab.
In this review, you troubleshoot and repair boot problems and update the system default target. You also schedule tasks to run on a repeating schedule as a normal user.
Outcomes
Diagnose issues and recover the system from emergency mode.
Change the default target from
graphical.targettomulti-user.target.Schedule recurring jobs to run as a normal user.
If you did not reset your workstation and server machines at the end of the last chapter, then save any work that you want to keep from earlier exercises on those machines, and reset them now.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start rhcsa-compreview1
Specifications
On
workstation, run the/tmp/rhcsa-break1script. This script causes an issue with the boot process onserverband then reboots the machine. Troubleshoot the cause and repair the boot issue. When prompted, useredhatas the password of therootuser.On
workstation, run the/tmp/rhcsa-break2script. This script causes the default target to switch from themulti-usertarget to thegraphicaltarget on theserverbmachine and then reboots the machine. Onserverb, reset the default target to use themulti-usertarget. The default target settings must persist after reboot without manual intervention. As thestudentuser, use thesudocommand for performing privileged commands. Usestudentas the password, when required.On
serverb, schedule a recurring job as thestudentuser that executes the/home/student/backup-home.shscript hourly between 7 PM and 9 PM every day except on Saturday and Sunday. Download the backup script fromhttp://materials.example.com/labs/backup-home.sh. Thebackup-home.shscript backs up the/home/studentdirectory fromserverbtoserverain the/home/student/serverb-backupdirectory. Use thebackup-home.shscript to schedule the recurring job as thestudentuser. Run the command as an executable.Reboot the
serverbmachine and wait for the boot to complete before grading.
On
workstation, run the/tmp/rhcsa-break1script.[student@workstation ~]$
sh /tmp/rhcsa-break1After the
serverbmachine boots, access the console and notice that the boot process stopped early. Consider a possible cause for this behavior.Locate the icon for the
serverbconsole, as appropriate for your classroom environment. Open the console and inspect the error. It might take a few seconds for the error to appear.Press Ctrl+Alt+Del to reboot the
serverbmachine. When the boot-loader menu appears, press any key except Enter to interrupt the countdown.Edit the default boot-loader entry, in memory, to log in to the emergency mode. Press e to edit the current entry.
Use the cursor keys to navigate to the line that starts with
linux. Appendsystemd.unit=emergency.target.Press Ctrl+x to boot with the modified configuration.
Log in to emergency mode. Use
redhatas therootuser's password.Give root password for maintenance (or press Control-D to continue):
redhat[root@serverb ~]#
Remount the
/file system with read and write capabilities. Use themount -acommand to try to mount all the other file systems.Remount the
/file system with read and write capabilities to edit the file system.[root@serverb ~]#
mount -o remount,rw /Try to mount all the other file systems. Notice that one of the file systems does not mount.
[root@serverb ~]#
mount -a...output omitted... mount: /FakeMount: can't find UUID=fake.Edit the
/etc/fstabfile to fix the issue. Remove or comment out the incorrect line.[root@serverb ~]#
vi /etc/fstab...output omitted... #UUID=fake /FakeMount xfs defaults 0 0Update the
systemddaemon for the system to register the new/etc/fstabfile configuration.[root@serverb ~]#
systemctl daemon-reload[ 206.828912] systemd[1]: Reloading.Verify that
/etc/fstabfile is now correct by attempting to mount all entries.[root@serverb ~]#
mount -aReboot
serverband wait for the boot to complete. The system should now boot without errors.[root@serverb ~]#
systemctl reboot
On
workstation, run the/tmp/rhcsa-break2script. Wait for theserverbmachine to reboot before proceeding.[student@workstation ~]$
sh /tmp/rhcsa-break2On
serverb, set themulti-usertarget as the current and default target.Log in to
serverbas thestudentuser.[student@workstation ~]$
ssh student@serverb...output omitted... [student@serverb ~]$Determine the default target.
[student@serverb ~]$
systemctl get-defaultgraphical.targetSwitch to the
multi-usertarget.[student@serverb ~]$
sudo systemctl isolate multi-user.target[sudo] password for student:studentSet the
multi-usertarget as the default target.[student@serverb ~]$
sudo systemctl set-default multi-user.targetRemoved /etc/systemd/system/default.target. Created symlink /etc/systemd/system/default.target -> /usr/lib/systemd/system/multi-user.target.Reboot
serverband verify that themulti-usertarget is set as the default target.[student@serverb ~]$
sudo systemctl rebootConnection to serverb closed by remote host. Connection to serverb closed. [student@workstation ~]$After the system reboots, open an SSH session to
serverbas thestudentuser. Verify that themulti-usertarget is set as the default target.[student@workstation ~]$
ssh student@serverb...output omitted... [student@serverb ~]$systemctl get-defaultmulti-user.target
On
serverb, schedule a recurring job as thestudentuser that executes the/home/student/backup-home.shscript hourly between 7 PM and 9 PM on all days except Saturday and Sunday. Use thebackup-home.shscript to schedule the recurring job. Download the backup script fromhttp://materials.example.com/labs/backup-home.sh. Run the command as an executable.On
serverb, download the backup script fromhttp://materials.example.com/labs/backup-home.sh. Usechmodto make the backup script executable.[student@serverb ~]$
wget http://materials.example.com/labs/backup-home.sh...output omitted... [student@serverb ~]$chmod +x backup-home.shOpen the crontab file with the default text editor.
[student@serverb ~]$
crontab -eEdit the file to add the following line:
0 19-21 * * Mon-Fri /home/student/backup-home.sh
Save the changes and exit the editor.
Use the
crontab -lcommand to list the scheduled recurring jobs.[student@serverb ~]$
crontab -l0 19-21 * * Mon-Fri /home/student/backup-home.sh
Reboot
serverband wait for the boot to complete before grading.[student@serverb ~]$
sudo systemctl reboot[sudo] password for student:studentConnection to serverb closed by remote host. Connection to serverb closed. [student@workstation ~]$
This concludes the section.