Grub rescue fails with "Boot Repair" with error "unknown file system" [duplicate]
After a system crash (which was caused by a hard restart), my Ubuntu linux is not booting, it is showing now:
error: uknown filesystem
grub rescue>
Solutions that I tried:
grub rescue>ls
(hd0) (hd0,msdos5) (hd0) (hd0,msdos1)
grub rescue>ls (hd0,msdos5)
error: uknown filesystem
grub rescue>ls (hd0,msdos1)
error: uknown filesystem
So, I can't list/find my Linux filesystem ,,,
I decided to try Boot Repair, installed on Ubuntu live USB, but there was no Recommended repair button and there was no Advanced options. There was only one button which is Create a BootInfo summary
I tried BootRepair on live versions of the latest Ubuntu and on Linux Secure Remix, they both are LIVE editions baked on USB - the same result.
Also OS-Uninstaller on Linux Secure Remix states that there is no found/installed OS.
I tried the same Linux Secure Remix on a different PC and at least there is Recommended repair. So I think the problem is in my HDD or MBR.
After some responses, I tried
root@ubuntu:/home/ubuntu# sudo fdisk -l
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xebd671ce
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 302815231 151406592 83 Linux
/dev/sda2 302817278 312580095 4881409 5 Extended
/dev/sda5 302817280 312580095 4881408 82 Linux swap / Solaris
Disk /dev/sdb: 8021 MB, 8021606400 bytes
110 heads, 46 sectors/track, 3096 cylinders, total 15667200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x04030201
Device Boot Start End Blocks Id System
/dev/sdb1 * 10392 15667199 7828404 b W95 FAT32
root@ubuntu:/home/ubuntu# sudo mount /dev/sda1 /mnt
mount: you must specify the filesystem type
root@ubuntu:/home/ubuntu# blkid
/dev/loop0: TYPE="squashfs"
/dev/sda5: UUID="ce99d1c7-16fd-4b60-b0af-af6a14b8bdbe" TYPE="swap"
/dev/sdb1: LABEL="DANAIL" UUID="4ED6-708D" TYPE="vfat"
I tried different types: ext3, ext4, vfat and auto, but the result is same for all types:
root@ubuntu:/home/ubuntu# sudo mount -t ext4 /dev/sda1 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
root@ubuntu:/home/ubuntu# dmesg | tail
[ 2424.052221] SQUASHFS error: Can't find a SQUASHFS superblock on sda1
[ 2620.531816] EXT4-fs (sda1): VFS: Can't find ext4 filesystem
[ 2626.204025] EXT3-fs (sda1): error: can't find ext3 filesystem on dev sda1.
[ 2626.208650] EXT4-fs (sda1): VFS: Can't find ext4 filesystem
[ 2626.208938] FAT-fs (sda1): bogus number of reserved sectors
[ 2626.208943] FAT-fs (sda1): Can't find a valid FAT filesystem
[ 2626.209377] SQUASHFS error: Can't find a SQUASHFS superblock on sda1
[ 2635.692959] EXT2-fs (sda1): error: can't find an ext2 filesystem on dev sda1.
[ 2644.614887] FAT-fs (sda1): bogus number of reserved sectors
[ 2644.614894] FAT-fs (sda1): Can't find a valid FAT filesystem
root@ubuntu:/home/ubuntu# mount
/cow on / type overlayfs (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
/dev/sdb1 on /cdrom type vfat (ro,noatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/loop0 on /rofs type squashfs (ro,noatime)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
gvfsd-fuse on /run/user/ubuntu/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=ubuntu)
Finally I found the solution was to run fsck
on the broken /dev/sda1
system. The problem is in the filesystem, not in grub. That's why grub can't see the filesystem. Thank you!
Solution 1:
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 ext4 with the actual filesystem, you have to know the file system or else the partition will be more corrupted. See this thread 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 this painful video: http://www.youtube.com/watch?v=ZcbTgMKpVHQ . In short, it will reinstall Grub2 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 where as I used a live-usb. I made sure that the live-usb has 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, procede to step 5.
- Bring up the terminal with
ctrl
+alt
+T
and use themount
command to find the name of the partition. - Mount the partition. Create a new folder in your media folder.
sudo mkdir /media/ubuntu
. Then simple 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 Grub2 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.
Solution 2:
Your parted -l
output clearly says that your boot partition is /dev/sda1. This might not be recognized by some nice GUI application to fix grub.
Simplest solution is to reinstall grub via command line. Follow the commands given on this page, and you should be up and running in no time. Remember using /dev/sda1
wherever the page uses /dev/sdax
.