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.
Manually repair file-system configuration or corruption issues that stop the boot process.
During the boot process, the systemd service mounts the persistent file systems that are defined in the /etc/fstab file.
Errors in the /etc/fstab file or corrupted file systems can block a system from completing the boot process.
In some failure scenarios, the system breaks out of the boot process and opens an emergency shell that requires the root user password.
The following list describes some common file-system mounting issues when parsing the /etc/fstab file during the boot process:
- Corrupted file system
The
systemdservice attempts to repair the file system. If the problem cannot be automatically repaired, then the system opens an emergency shell.- Nonexistent device or UUID
The
systemdservice times out waiting for the device to become available. If the device does not respond, then the system opens an emergency shell.
Note
If the mount point is not present, then Red Hat Enterprise Linux 9 automatically creates it during the boot process.
To access a system that cannot complete booting because of file-system issues, the systemd architecture provides an emergency boot target, which opens an emergency shell that requires the root password for access.
The next example demonstrates the boot process output when the system finds a file-system issue and switches to the emergency target:
...output omitted... [* ] A start job is running for /dev/vda2 (27s / 1min 30s) [ TIME ] Timed out waiting for device /dev/vda2. [DEPEND] Dependency failed for /mnt/mountfolder [DEPEND] Dependency failed for Local File Systems. [DEPEND] Dependency failed for Mark need to relabel after reboot. ...output omitted... [ OK ] Started Emergency Shell. [ OK ] Reached target Emergency Mode. ...output omitted... Give root password for maintenance (or press Control-D to continue):
The systemd daemon failed to mount the /dev/vda2 device and timed out.
Because the device is not available, the system opens an emergency shell for maintenance access.
To repair file-system issues when your system opens an emergency shell, first locate the errant file system, and then find and repair the fault.
Now reload the systemd configuration to retry the automatic mounting.
Use the mount command to find which file systems are currently mounted by the systemd daemon.
[root@host ~]#mount...output omitted... /dev/vda1 on/type xfs (ro,relatime,seclabel,attr2,inode64,noquota) ...output omitted...
If the root file system is mounted with the ro (read-only) option, then you cannot edit the /etc/fstab file.
Temporarily remount the root file system with the rw (read/write) option, if necessary, before opening the /etc/fstab file.
With the remount option, an in-use file system can change its mount parameters without unmounting the file system.
[root@host ~]# mount -o remount,rw /Try to mount all the file systems that are listed in the /etc/fstab file by using the mount --all option.
This option mounts processes on every file-system entry, but skips those file systems that are already mounted.
The command displays any errors that occur when mounting a file system.
[root@host ~]# mount --all
mount: /mnt/mountfolder: mount point does not exist.In this scenario, where the /mnt/mountfolder mount directory does not exist, create the /mnt/mountfolder directory before reattempting the mount.
Other error messages can occur, including typing errors in the entries, or wrong device names or UUIDs.
After you corrected all issues in the /etc/fstab file, inform the systemd daemon to register the new /etc/fstab file by using the systemctl daemon-reload command.
Then, reattempt mounting all the entries.
[root@host ~]#systemctl daemon-reload[root@host ~]#mount --all
Note
The systemd service processes the /etc/fstab file by transforming each entry into a .mount type systemd unit configuration and then starting the unit as a service.
The daemon-reload option requests the systemd daemon to rebuild and reload all unit configurations.
If the mount --all command succeeds without further errors, then the final test is to verify that file-system mounting is successful during a system boot.
Reboot the system and wait for the boot to complete normally.
[root@host ~]# systemctl rebootFor quick testing in the /etc/fstab file, use the nofail mount entry option.
Using the nofail option in an /etc/fstab entry enables the system to boot even if that file-system mount is unsuccessful.
This option must not be used with production file systems that must always mount.
With the nofail option, an application could start when its file-system data is missing, with possibly severe consequences.