Grub rescue - error: unknown filesystem
I could not figure out why the following did not fix grub:
sudo update-grub
sudo grub-install /dev/sda
So I downloaded boot-repair based on an answer from Persist commands typed to GRUB rescue post. That seemed to do the trick after I picked the "Recommended Repair (repairs most frequent problems)" option.
I have also used Grub Customizer to customize the order of boot entries.
Use:
set prefix=(hdX,Y)/boot/grub
. Use the values determined earlier.
Example: If the Ubuntu system is on sda5, enter:set prefix=(hd0,5)/boot/grub
set root=(hdX,Y)
. Example:set root=(hd0,5)
insmod normal
. Attempt to load the normal module.normal
We basically need GRUB to know where the /boot/grub
folder is. If this is not working, I guess doing a GRUB install from a boot CD is a good option.
There is an alternative cause of this problem. In this particular case, GRUB was somehow corrupted and needed to be repaired or reinstalled. However, as shown in Grub rescue fails with "Boot Repair" with error "unknown file system", it's also possible that the root partition on which GRUB is installed could be corrupted. To fix this:
This is a possible solution, but it should not be used likely lest your root partition become further corrupted. Running the command fsck -t ext4 /dev/sda1
, this program attempts to search and repair errors on a corrupted filesystem. Replace sda1 with your actual root partition. Replace ext4 with the actual filesystem; you have to know the file system or else the partition will be more corrupted. See Repairing a corrupted filesystem for more information.
Even though this question has an answer, there is an alternative way to fix the problem that worked for me. The steps are explained in the painful video Grub Rescue - Guide for beginners. In short, it will reinstall GRUB 2 altogether instead of repairing it.
Because this video is so painful to watch, I'll list the steps below (as I should regardless of how painful it is to watch the video)
- Launch a live session of Ubuntu. The video uses a live CD whereas I used a live USB. I made sure that the live USB had the same version of Ubuntu that I had on my harddrive.
- Find where your root partition was mounted. In the video, the user uses Nautilus to navigate through each drive that was mounted. It was mounted with a long string of numbers and characters. If this is the case, follow the following steps to remount the partition. Else, proceed to step 5.
- Bring up the terminal with Ctrl + Alt + T and use the
mount
command to find the name of the partition. - Mount the partition. Create a new folder in your media folder.
sudo mkdir /media/ubuntu
. Then simply mount your partition to that folder.sudo mount /dev/sdxx /media/ubuntu
wherexx
ofsdxx
is determined in step 3. Bind the following directories from the root directory of your live CD/USB to that of your root directory on your version of Ubuntu. The directories are the
dev
proc
andsys
. Do so with the following commands:sudo mount --bind /dev /media/ubuntu/dev sudo mount --bind /sys /media/ubuntu/sys sudo mount --bind /proc /media/ubuntu/proc
Change the root directory to the one on your Ubuntu partition.
sudo chroot /media/ubuntu/
- Having done the above, installing GRUB 2 again will install it to the root directory of your distribution of Ubuntu and not that of the live CD/USB's. So go ahead and run
sudo grub-install /dev/sdx
And that's how to fix GRUB using a live CD/USB. This method was developed by YouTube user crazytechzone.