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.
In this exercise, you recover a system from a misconfiguration in the /etc/fstab file where the boot process fails.
Outcomes
Diagnose
/etc/fstabfile issues and use emergency mode to recover the system.
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 boot-repairing
Instructions
Access the
serveramachine console and notice that the boot process is stuck early on.Locate the icon for the
serveraconsole, as appropriate for your classroom environment. Open the console.Notice that a start job does not seem to complete. Consider a possible cause for this behavior.
Reboot the
serveramachine, by sending Ctrl+Alt+Del to your system by using the relevant button or menu entry. With this boot problem, this key sequence might not immediately abort the running job, and you might have to wait for it to time out before the system reboots.If you wait for the task to time out without sending Ctrl+Alt+Del, then the system eventually spawns an emergency shell by itself.
When the boot-loader menu appears, press any key to interrupt the countdown, except the Enter key.
Looking at the error from the previous boot, parts of the system still seem to be functioning. Use
redhatas therootuser password to try an emergency boot.Use the cursor keys to highlight the default boot loader entry.
Press the e key to edit the current entry.
Use the cursor keys to navigate to the line that starts with the
linuxword.Press End to move the cursor to the end of the line.
Append the
systemd.unit=emergency.targetstring to the end of the line.Note
If it is difficult for you to see the text in the console, consider changing the resolution when editing the kernel line in the boot loader entry.
To change the console resolution, add either
video=640x480orvga=askon the line that starts with thelinuxword, aftersystemd.unit=emergency.target. For most consoles, a resolution of640x480is enough. By usingvga=ask, you can choose a more suitable resolution for your environment.Press Ctrl+x to boot by using the modified configuration.
Log in to emergency mode.
Give root password for maintenance (or press Control-D to continue):
redhat[root@servera ~]#Determine which file systems the
systemddaemon currently mounts. Thesystemddaemon mounts the root file system in read-only mode.[root@servera ~]#
mount...output omitted... /dev/vda4 on/type xfs (ro,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota) ...output omitted...Remount the root file system in read/write mode.
[root@servera ~]#
mount -o remount,rw /Try to mount all the other file systems. The
--all(-a) option mounts all the listed file systems in the/etc/fstabfile that are not yet mounted.[root@servera ~]#
mount -amount: /RemoveMe: mount point does not exist.Edit the
/etc/fstabfile to fix the issue.Remove or comment out the incorrect line by using the
vim /etc/fstabcommand.[root@servera ~]#
cat /etc/fstab...output omitted...#/dev/sdz1 /RemoveMe xfs defaults 0 0Reload the
systemddaemon for the system to register the new/etc/fstabfile configuration.[root@servera ~]#
systemctl daemon-reload
Verify that the
/etc/fstabfile is now correct by attempting to mount all entries.[root@servera ~]#
mount -aReboot the system and wait for the boot to complete. The system should now boot normally.
[root@servera ~]#
systemctl reboot
This concludes the section.