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