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.target to multi-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-break1 script.
This script causes an issue with the boot process on serverb and then reboots the machine.
Troubleshoot the cause and repair the boot issue.
When prompted, use redhat as the password of the root user.
On workstation, run the /tmp/rhcsa-break2 script.
This script causes the default target to switch from the multi-user target to the graphical target on the serverb machine and then reboots the machine.
On serverb, reset the default target to use the multi-user target.
The default target settings must persist after reboot without manual intervention.
As the student user, use the sudo command for performing privileged commands.
Use student as the password, when required.
On serverb, schedule a recurring job as the student user that executes the /home/student/backup-home.sh script hourly between 7 PM and 9 PM every day except on Saturday and Sunday.
Download the backup script from http://materials.example.com/labs/backup-home.sh.
The backup-home.sh 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.
Run the command as an executable.
Reboot the serverb machine and wait for the boot to complete before grading.
On workstation, run the /tmp/rhcsa-break1 script.
[student@workstation ~]$ sh /tmp/rhcsa-break1After the serverb machine boots, access the console and notice that the boot process stopped early.
Consider a possible cause for this behavior.
Locate the icon for the serverb console, 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 serverb machine.
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.
Append systemd.unit=emergency.target.
Press Ctrl+x to boot with the modified configuration.
Log in to emergency mode.
Use redhat as the root user'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 the mount -a command 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/fstab file 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 systemd daemon for the system to register the new /etc/fstab file configuration.
[root@serverb ~]# systemctl daemon-reload
[ 206.828912] systemd[1]: Reloading.Verify that /etc/fstab file is now correct by attempting to mount all entries.
[root@serverb ~]# mount -aReboot serverb and wait for the boot to complete.
The system should now boot without errors.
[root@serverb ~]# systemctl rebootOn workstation, run the /tmp/rhcsa-break2 script.
Wait for the serverb machine to reboot before proceeding.
[student@workstation ~]$ sh /tmp/rhcsa-break2On serverb, set the multi-user target as the current and default target.
Log in to serverb as the student user.
[student@workstation ~]$ ssh student@serverb
...output omitted...
[student@serverb ~]$Determine the default target.
[student@serverb ~]$ systemctl get-default
graphical.targetSwitch to the multi-user target.
[student@serverb ~]$sudo systemctl isolate multi-user.target[sudo] password for student:student
Set 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.Reboot serverb and 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 ~]$After the system reboots, 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-defaultmulti-user.target
On serverb, schedule a recurring job as the student user that executes the /home/student/backup-home.sh script hourly between 7 PM and 9 PM 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.
Run the command as an executable.
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
Open 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 -l command to list the scheduled recurring jobs.
[student@serverb ~]$ crontab -l
0 19-21 * * Mon-Fri /home/student/backup-home.shReboot serverb and 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.