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.

enter image description here

My screen looks like this. In some cases, a purple screen appears. Please give me some solutions.


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

  1. Boot into Recovery mode and then drop to root shell.

  2. Run sudo blkid command to know the UUID of your /(root) partition.It will show something like this,

    /dev/sda1: UUID="52e062e0-716c-4828-9bf1-05b93fdaef93" TYPE="ext4"
    /dev/sda1: UUID="2F4DAFCF02D7EBEB" TYPE="ntfs" 
    /dev/sda3: UUID="039E0CF305398945" TYPE="ntfs" 
    /dev/sda5: UUID="C68C57908C5779BF" TYPE="ntfs" 
  3. From the sudo blkid output, identify your root ext4 partition and note down its corresponding UUID.

  4. Now mount your / partition in Read Write Mode by running the below command.Please note that the simple mount / 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:

    mount -t ext4 -o rw,remount /dev/sda1 /
  5. The above command will mount your / partition in read write mode.Run the below command to create a new fstab file inside /etc with the appropriate line to mount your /. In the example above, my / has UUID=52e062e0-716c-4828-9bf1-05b93fdaef93, so I would run:

    echo "UUID=52e062e0-716c-4828-9bf1-05b93fdaef93 / ext4 errors=remount-ro 0 1" > /etc/fstab
  6. Exit from the root shell and boot your Ubuntu OS, it will surely bootup.

Method 2

Recreating /etc/fstab file via Ubuntu live disk

  1. Boot ubuntu live disk.

  2. Run sudo blkid command and note the installed Ubuntu partition's device id and the UUID.

  3. Mount your root partition,

     sudo mkdir /media/ubuntu
     sudo mount /dev/sdaX /media/ubuntu
  4. Now go into the /media/ubuntu via nautilus and create a fstab file inside /etc.

  5. On that fstab file, add an entry for your root partition like below.

     UUID=52e062e0-716c-4828-9bf1-05b93fdaef93 / ext4 errors=remount-ro 0 1
  6. 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.

  • 2
    You shouldn't need to chroot in order to do this. You can write the fstab without it (just mounted) and as it is, it's just going to cause more problems. I'd drop it.
    – Oli
    Mar 18 '14 at 16:06
  • 1
    Method will not work as you will not be able to drop to a root shell because you are missing fstab. As Oli pointed out, chroot is a bit much and makes repair more complicated then it needs to be. Just boot a live CD, mount the / partition, and write a fstab. You might also wish to include an entry for swap ;) See also - help.ubuntu.com/community/Fstab
    – Panther
    Mar 18 '14 at 16:31
  • @bodhi.zazen i do the first method on maintenance mode.See i.stack.imgur.com/KB6Xp.png Mar 18 '14 at 16:34
  • Without fsatb, you will not be able to run bash, you will drop to busy box with limited commands (only what is in the initrd). As with the chroot, sure it is possible, but it is going to be more difficult then simply booting a live image.
    – Panther
    Mar 18 '14 at 16:37
  • @bodhi.zazen see i.stack.imgur.com/2CWDf.png Mar 18 '14 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.