Commit f3e364d49d
Unsigned
Layout: unified · split
content/blog/2024-02-13-ubuntu-emergency-mode.md added +71
| @@ -0,0 +1,71 @@ | |||
| 1 | +++ | ||
| 2 | date = 2024-02-13 | ||
| 3 | title = "Stuck in Ubuntu's Emergency Mode? Try Fixing the Fstab File" | ||
| 4 | description = "Learn how to fix a missing disk issue that can lock you in Ubuntu's emergency mode." | ||
| 5 | +++ | ||
| 6 | |||
| 7 | ### The Problem | ||
| 8 | |||
| 9 | I recently [migrated my hard drives to a ZFS pool](/blog/zfs/) and found myself | ||
| 10 | stuck in Ubuntu's emergency mode after the first reboot I performed after | ||
| 11 | creating the ZFS pool. | ||
| 12 | |||
| 13 | My server was stuck in the boot process and showed the following error on the | ||
| 14 | screen: | ||
| 15 | |||
| 16 | ```txt | ||
| 17 | You are in emergency mode. | ||
| 18 | After logging in, type "journalctl -xb" to view system logs, | ||
| 19 | "systemctl reboot" to reboot, "systemctl default" | ||
| 20 | or ^D to try again to boot into default mode". | ||
| 21 | ``` | ||
| 22 | |||
| 23 | After rebooting the server and watching the logs scroll on a monitor, I noticed | ||
| 24 | the root cause was related to a very long search for certain drives. I kept | ||
| 25 | seeing errors like this: | ||
| 26 | |||
| 27 | ```txt | ||
| 28 | [ TIME ] Timed out waiting of device dev-disk-by/[disk-uuid] | ||
| 29 | ``` | ||
| 30 | |||
| 31 | I realized that I had not removed the `/etc/fstab` references that asked Ubuntu | ||
| 32 | to mount two disks on boot, but I had recently changed those disks to be part of | ||
| 33 | my ZFS pool instead. Therefore, Ubuntu was trying to identify and mount a disk | ||
| 34 | that was not available. | ||
| 35 | |||
| 36 | Now that we have an idea of the issue, let's move to solution. | ||
| 37 | |||
| 38 | ### The Solution | ||
| 39 | |||
| 40 | In order to fix the issue, I waited until I was allowed to type the root user's | ||
| 41 | password, and then I executed the following command: | ||
| 42 | |||
| 43 | ```sh | ||
| 44 | nano /etc/fstab | ||
| 45 | ``` | ||
| 46 | |||
| 47 | Within the `fstab` file, I needed to comment/remove the following lines at the | ||
| 48 | bottom of the file. You can comment-out a line by prepending a `#` symbol at the | ||
| 49 | beginning of the line. You can also delete the line entirely. | ||
| 50 | |||
| 51 | ```conf | ||
| 52 | # What it looked like when running into the issue: | ||
| 53 | UUID=B64E53824E5339F7 /mnt/white-01 ntfs-3g uid=1000,gid=1000 0 0 | ||
| 54 | UUID=E69867E59867B32B /mnt/white-02 ntfs-3g uid=1000,gid=1000 0 0 | ||
| 55 | |||
| 56 | # What I changed it to, in order to fix the issue: | ||
| 57 | # UUID=B64E53824E5339F7 /mnt/white-01 ntfs-3g uid=1000,gid=1000 0 0 | ||
| 58 | # UUID=E69867E59867B32B /mnt/white-02 ntfs-3g uid=1000,gid=1000 0 0 | ||
| 59 | ``` | ||
| 60 | |||
| 61 | Once removing the lines above from the `/etc/fstab` file, save and exit the file | ||
| 62 | by hitting the `Ctrl` + `x` key combo. | ||
| 63 | |||
| 64 | You can now hit `Ctrl` + `D` to continue, or reboot: | ||
| 65 | |||
| 66 | ```sh | ||
| 67 | systemctl reboot | ||
| 68 | ``` | ||
| 69 | |||
| 70 | Once rebooted, I was able to watch the machine boot properly and launch to the | ||
| 71 | TTY login screen without errors! | ||