grub-install from live CD (urgent)
I have removed mbr by mistake.
Now I can't boot ubuntu, so I want to reinstall grub.
I'm following this instructions.
The problem is that I'm getting this error:
grub-install --boot-directory=/media/cab64688-2d97-4bbd-9f32-7bc0badb40a8/boot /dev/sdb
rm: cannot remove `/media/cab64688-2d97-4bbd-9f32-7bc0badb40a8/boot/grub/915resolution.mod': Read-only file system
So, problem is that my existing ubuntu partition is mounted read only. When I try:
sudo mount /dev/sdb7 /media/ubuntu_mpt
mount: block device /dev/sdb7 is write-protected, mounting read-only
So I failed to install grub since I'm in read only mode.
Any idea?
Thanks in advance.
EDIT: After apt-get install grub, I repeated the process and got:
Probing devices to guess BIOS drives. This may take a long time.
Unknown partition table signature
sed: can't read /media/cab64688-2d97-4bbd-9f32-7bc0badb40a8_/boot/grub/device.map: No such file or directory
grep: /media/cab64688-2d97-4bbd-9f32-7bc0badb40a8_/boot/grub/device.map: No such file or directory
/dev/sda does not have any corresponding BIOS drive.
EDIT: Requested outputs:
fdisk -l
Disk /dev/sda: 163.9 GB, 163927522816 bytes
255 heads, 63 sectors/track, 19929 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sda doesn't contain a valid partition table
Disk /dev/sdb: 640.1 GB, 640133946880 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3dcf5202
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 3917 31463271 7 HPFS/NTFS
/dev/sdb2 3918 77826 593667163 f W95 Ext'd (LBA)
/dev/sdb5 3918 43080 314576766 7 HPFS/NTFS
/dev/sdb6 77328 77826 4000768 82 Linux swap / Solaris
/dev/sdb7 43081 77197 274041856 83 Linux
/dev/sdb8 77197 77327 1045504 82 Linux swap / Solaris
Partition table entries are not in disk order
Disk /dev/sdc: 4043 MB, 4043284480 bytes
125 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7750 * 512 = 3968000 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6f20736b
This doesn't look like a partition table
Probably you selected the wrong device.
Device Boot Start End Blocks Id System
/dev/sdc1 ? 100405 247697 570754815+ 72 Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(357, 116, 40) logical=(100404, 79, 11)
Partition 1 has different physical/logical endings:
phys=(357, 32, 45) logical=(247696, 24, 51)
Partition 1 does not end on cylinder boundary.
/dev/sdc2 ? 21767 271577 968014120 65 Novell Netware 386
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(288, 115, 43) logical=(21766, 48, 47)
Partition 2 has different physical/logical endings:
phys=(367, 114, 50) logical=(271576, 60, 42)
Partition 2 does not end on cylinder boundary.
/dev/sdc3 ? 241276 491086 968014096 79 Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(366, 32, 33) logical=(241275, 3, 30)
Partition 3 has different physical/logical endings:
phys=(357, 32, 43) logical=(491085, 14, 39)
Partition 3 does not end on cylinder boundary.
/dev/sdc4 ? 372346 372354 27749+ d Unknown
Partition 4 has different physical/logical beginnings (non-Linux?):
phys=(372, 97, 50) logical=(372345, 119, 25)
Partition 4 has different physical/logical endings:
phys=(0, 10, 0) logical=(372353, 14, 33)
Partition 4 does not end on cylinder boundary.
Partition table entries are not in disk order
mount
aufs on / type aufs (rw)
none on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
/dev/sr0 on /cdrom type iso9660 (ro,noatime)
/dev/loop0 on /rofs type squashfs (ro,noatime)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)
/dev/sda on /media/Backup type ext4 (rw,nosuid,nodev,uhelper=udisks)
/dev/sdb7 on /media/cab64688-2d97-4bbd-9f32-7bc0badb40a8_ type ext4 (ro,nosuid,nodev,uhelper=udisks)
ls -lA /dev/disk/by-label
total 0
lrwxrwxrwx 1 root root 9 2011-06-12 18:32 Backup -> ../../sda
lrwxrwxrwx 1 root root 9 2011-06-12 18:31 Ubuntu\x2011.04\x20i386 -> ../../sr0
Solution 1:
Just insert live cd and began ubuntu with livecd.Then goto
Applications->Accessories->Terminal then type sudo fdisk -l and find ubuntu installed partition.
then type the following in terminal
sudo mkdir /media/sdax ( here x is ubuntu installed partition number)
sudo mount /dev/sdax /media/sdax
sudo grub-install --root-directory=/media/sdax /dev/sda
then restart your system without live cd and type the following in terminal
sudo update-grub
Solution 2:
I fixed the problem with the help of UNetbootin. Installed it and managed to boot into my ubuntu system (cnosole mode or poor graphic mode). Whatever you boot from this two, just run grub-install /dev/sdb where /dev/sdb is boot hdd set in bios. Restart and grub should work.