RHCSA Rapid Track
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.targettomulti-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 thelab rhcsa-compreview1 break1command. This break script causes the boot process to fail onserverb. It also sets a longer timeout on theGRUB2menu to help interrupt the boot process, and rebootsserverb.Troubleshoot the possible cause and repair the boot failure. The fix must ensure that
serverbreboots without intervention. Useredhatas the password of the superuser, when required.On
workstation, run thelab rhcsa-compreview1 break2command. This break script causes the default target to switch from themulti-usertarget to thegraphicaltarget onserverb. It also sets a longer timeout for theGRUB2menu to help interrupt the boot process, and rebootsserverb.On
serverb, fix the default target to use themulti-usertarget. The default target settings must persist after reboot without manual intervention.Use the
sudocommand, as thestudentuser withstudentas the password, for performing privileged commands.Schedule a recurring job as the
studentuser that executes the/home/student/backup-home.shscript 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. Thebackup-home.shbackup script backs up the/home/studentdirectory fromserverbtoserverain the/home/student/serverb-backupdirectory. Use thebackup-home.shscript to schedule the recurring job as thestudentuser onserverb.Reboot the system and wait for the boot to complete before grading.
On
workstation, run thelab rhcsa-compreview1 break1command.After
serverbboots up, access the console and notice that the boot process stopped early. Take a minute to speculate about a possible cause for this behavior.Locate the icon for the
serverbconsole, as appropriate for your classroom environment. Open the console.Looking at the error, it appears that at least parts of the system are still functioning.
Press Ctrl+Alt+Del to reboot
serverb.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 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.targetto the end of the line.Press Ctrl+x to boot using the modified configuration.
Log in to emergency mode. The
rootpassword isredhat.Give root password for maintenance (or press Control-D to continue):
redhat[root@serverb ~]#
Remount the
/file system read/write. Use themount -acommand to attempt to mount all the other file systems.Remount the
/file system read/write to edit the file system.[root@serverb ~]#mount -o remount,rw /Use the
mount -acommand to attempt to mount all the other file systems. Notice that one of the file systems cannot be mounted.[root@serverb ~]#mount -amount: /FakeMount: can't find UUID=fake.Edit
/etc/fstabto fix the issue. Remove or comment out the incorrect line.[root@serverb ~]#vim /etc/fstab...output omitted... #UUID=fake /FakeMount xfs defaults 0 0Update
systemdfor the system to register the new/etc/fstabconfiguration.[root@serverb ~]#systemctl daemon-reload[ 206.828912] systemd[1]: Reloading.Verify that
/etc/fstabis now correct by attempting to mount all entries.[root@serverb ~]#mount -aReboot
serverband wait for the boot to complete. The system should now boot normally.[root@serverb ~]#systemctl reboot
On
workstation, run thelab rhcsa-compreview1 break2command.Wait for the reboot to complete before proceeding.
On
serverb, switch to themulti-usertarget. Set the default target tomulti-user. Use thesudocommand to run any required administrative command and if prompted, usestudentas the password.From
workstation, open an SSH session toserverbas thestudentuser.[student@workstation ~]$ssh student@serverb...output omitted...[student@serverb ~]$As the
studentuser onserverb, determine the default target.[student@serverb ~]$systemctl get-defaultgraphical.targetSwitch to the
multi-usertarget. Use thesudocommand and if prompted, usestudentas the password.[student@serverb ~]$sudo systemctl isolate multi-user.target[sudo] password for student:studentSet
serverbto use themulti-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
serverbto 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 reboot, 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
Schedule a recurring job as the
studentuser that executes the/home/student/backup-home.shscript on an hourly basis between 7 p.m. and 9 p.m. on all days except Saturday and Sunday.Use the
backup-home.shscript to schedule the recurring job. Download the backup script fromhttp://materials.example.com/labs/backup-home.sh.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.shUse the
crontab -ecommand to open the crontab file using 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.