Score:0

unable to repair fstab typo on ubuntu server 22.04 LTS

sl flag

I was looking to set up a new partition on my hard drive and I accidentally made a typo in the fstab configuration file. To be precise, I addded a partition that was not yet formatted in the partition table and rebooted afterwards.

Now, when I start my machine, the system fails to boot properly and enters emergency mode.This is what appears on my screen

You are in emergency mode. After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "sytemctl default" or "exit" to boot into default mode.

Press Enter for maintenence
(or press Control-D to continue):

When I enter my regular user password, the machine won't login to the shell, neither does leaving this field empty work ( as this post would suggest)

I am very new to ubuntu and I have heard that since I didn't set a root password, I assume there is no valid password that can work there

How should I proceed ?

Don't hesitate to ask for other informations

EDIT : I made a fresh install of ubuntu server, and I mounted my old filesystem at /mnt, and for some reason I didn't have to edit fstab afterwards, the system just booted fine. ( see the picture below)

Unbuntu install menu

waltinator avatar
it flag
Boot from your install medium in "Try Ubuntu" mode. Then, you can `mount` your disk and edit its `fstab`. Read `man mount fstab`.
chipmunktunic avatar
sl flag
does that mean I need to flash a usb stick with the ubuntu server iso ?
oldfred avatar
cn flag
Can you boot recovery mode to terminal & `sudoedit /etc/fstab` ? Otherwise graham's comment is mostly correct. Its old and now gksudo should not be used and it is a graphical edit which as server you may not have. You can use sudoedit which uses default terminal editor often nano.
waltinator avatar
it flag
@oldfred `sudoedit` uses the `$EDITOR` and `$VISUAL` environment variables (`man sudoedit`) to specify the editor to use. In `~/.bashrc` add `export VISUAL=$(type -p vim);export EDITOR=$(type -p vim)` to use `vim`.
Score:0
ug flag

You need any linux live CD or image.

Boot up the live cd, then mount the filesystem which contains the /etc/fstab file into maybe the /mnt then just edit the fstab there.

Then the OS should boot up correctly.

If you need to kick the root password, just remove the hash from shadow for root.

Some live CD-s has tools for change root password too.

chipmunktunic avatar
sl flag
I did that and it solved the problem. Thx !
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.