Bookmark this page

Guided Exercise: Repair File-system Issues at Boot

In this exercise, you recover a system from a misconfiguration in the /etc/fstab file where the boot process fails.

Outcomes

  • Diagnose /etc/fstab file 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

  1. Access the servera machine console and notice that the boot process is stuck early on.

    1. Locate the icon for the servera console, 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.

    2. Reboot the servera machine, 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.

    3. When the boot-loader menu appears, press any key to interrupt the countdown, except the Enter key.

  2. Looking at the error from the previous boot, parts of the system still seem to be functioning. Use redhat as the root user password to try an emergency boot.

    1. Use the cursor keys to highlight the default boot loader entry.

    2. Press the e key to edit the current entry.

    3. Use the cursor keys to navigate to the line that starts with the linux word.

    4. Press End to move the cursor to the end of the line.

    5. Append the systemd.unit=emergency.target string 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=640x480 or vga=ask on the line that starts with the linux word, after systemd.unit=emergency.target. For most consoles, a resolution of 640x480 is enough. By using vga=ask, you can choose a more suitable resolution for your environment.

    6. Press Ctrl+x to boot by using the modified configuration.

  3. Log in to emergency mode.

    Give root password for maintenance
    (or press Control-D to continue): redhat
    [root@servera ~]#
  4. Determine which file systems the systemd daemon currently mounts. The systemd daemon 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...
  5. Remount the root file system in read/write mode.

    [root@servera ~]# mount -o remount,rw /
  6. Try to mount all the other file systems. The --all (-a) option mounts all the listed file systems in the /etc/fstab file that are not yet mounted.

    [root@servera ~]# mount -a
    mount: /RemoveMe: mount point does not exist.
  7. Edit the /etc/fstab file to fix the issue.

    1. Remove or comment out the incorrect line by using the vim /etc/fstab command.

      [root@servera ~]# cat /etc/fstab
      ...output omitted...
      # /dev/sdz1   /RemoveMe   xfs   defaults   0 0
    2. Reload the systemd daemon for the system to register the new /etc/fstab file configuration.

      [root@servera ~]# systemctl daemon-reload
  8. Verify that the /etc/fstab file is now correct by attempting to mount all entries.

    [root@servera ~]# mount -a
  9. Reboot the system and wait for the boot to complete. The system should now boot normally.

    [root@servera ~]# systemctl reboot

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish boot-repairing

This concludes the section.

Revision: rh134-9.0-fa57cbe