I accidentally deleted my /etc/fstab
file by running sudo rm /etc/fstab
. Without realising what I'd done, I shut down my Ubuntu OS.
Now I'm not able to boot.
My screen looks like this. In some cases, a purple screen appears. Please give me some solutions.
Best Answer
You have to recreate a new
fstab
file inside/etc
directory and add an entry for your root partition, so that your Ubuntu os will boot.Method 1:
Recreating /etc/fstab file via Recovery mode
Boot into Recovery mode and then drop to root shell.
Run
sudo blkid
command to know the UUID of your/
(root) partition.It will show something like this,From the
sudo blkid
output, identify your root ext4 partition and note down its corresponding UUID.Now mount your
/
partition in Read Write Mode by running the below command.Please note that the simplemount /
command for mounting your root partition won't work because of the deletion of/etc/fstab
. So, if your/
was/dev/sda1
, run this command:The above command will mount your
/
partition in read write mode.Run the below command to create a newfstab
file inside/etc
with the appropriate line to mount your/
. In the example above, my/
hasUUID=52e062e0-716c-4828-9bf1-05b93fdaef93
, so I would run:Exit from the root shell and boot your Ubuntu OS, it will surely bootup.
Method 2
Recreating /etc/fstab file via Ubuntu live disk
Boot ubuntu live disk.
Run
sudo blkid
command and note the installed Ubuntu partition's device id and the UUID.Mount your root partition,
Now go into the
/media/ubuntu
via nautilus and create afstab
file inside/etc
.On that fstab file, add an entry for your root partition like below.
Save that file.And boot into your installed Ubuntu.
Note: My root partition's UUID was given above.Please give your's.After booting into your installed Ubuntu OS, don't forget to add
fstab
entry for your swap partition.