来自live CD的grub-install(紧急)

我错误地删除了mbr。

现在我无法启动ubuntu,所以我想重新安装grub。

我正在遵循这些指示。

问题是我收到了这个错误:

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 

所以,问题是我现有的ubuntu分区是只读的。 当我尝试:

 sudo mount /dev/sdb7 /media/ubuntu_mpt mount: block device /dev/sdb7 is write-protected, mounting read-only 

因为我处于只读模式,所以我无法安装grub。

任何的想法?

提前致谢。

编辑:在apt-get install grub之后,我重复了这个过程并得到了:

 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. 

编辑 :请求的输出:

 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 

只需插入live cd并用livecd开始ubuntu。然后转到

应用程序 – >附件 – >终端然后键入sudo fdisk -l并找到ubuntu安装分区。

然后在终端中键入以下内容

sudo mkdir / media / sdax(这里x是ubuntu安装的分区号)

sudo mount / dev / sdax / media / sdax

sudo grub-install –root-directory = / media / sdax / dev / sda

然后在没有live cd的情况下重新启动系统并在终端中输入以下内容

sudo update-grub

我在UNetbootin的帮助下解决了这个问题。 安装它并设法启动到我的ubuntu系统(cnosole模式或可怜的图形模式)。 无论你从这两个引导什么,只需运行grub-install / dev / sdb,其中/ dev / sdb是在BIOS中设置的boot hdd。 重启和grub应该工作。

使用这样的命令 – >

 sudo mount /dev/ROOT_PARTITION /opt sudo grub-install --root-directory=/opt /dev/sda 

只需下载并安装“Boot repair” http://mygeekopinions.blogspot.com/2011/06/install-boot-repair-in-ubuntu-1104.html即可 。 就像那样。 我在1个小时前做过,宾果游戏!

我只需要解决类似的问题,而我所需要的只是一个Ubuntu 14.04“迷你”启动盘 – 所以我就是这样做的:

  1. 启动迷你启动盘并在高级选项中选择“救援模式”(可能与您实际选择的无关)
  2. 当您启动安装程序时,选择“返回”以获取主菜单。
  3. 选择“启动shell”。 TBH任何能够为你提供shell的Linux启动盘都能让你获益匪浅。
  4. 挂载linux分区
  5. 将/ dev,/ proc和/ sys绑定到已安装的分区
  6. Chroot进入那个分区
  7. 从chroot运行grub-install和update-grub2(mini没有安装grub工具。

# mount /dev/sda5 /mnt # mount -o bind /dev /mnt/dev # mount -o bind /proc /mnt/proc # mount -o bind /sys /mnt/sys # chroot /mnt /bin/bash ~# grub-install --root-directory=/ /dev/sda ~# update-grub2 ~# ^D # reboot

Et voila – grub回来了。


(代码缩进不在此站点上工作……?)