从 Live CD 安装 grub(紧急)

从 Live CD 安装 grub(紧急)

我错误地删除了 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

答案1

只需插入 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 更新 grub

答案2

我在以下帮助下解决了这个问题联合国网启动。安装后成功启动我的 ubuntu 系统(cnosole 模式或较差的图形模式)。无论从这两个启动哪个,只需运行 grub-install /dev/sdb,其中 /dev/sdb 是 bios 中设置的启动硬盘。重新启动,grub 应该可以正常工作。

答案3

使用如下命令-->

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

答案4

我刚刚遇到了一个类似的问题,而我手头只有一个 Ubuntu 14.04“迷你”启动盘 - 所以这就是我的做法:

  1. 从迷你启动盘启动并在高级选项中选择“救援模式”(实际上选择哪个可能并不重要)
  2. 当安装程序启动时,选择“返回”以获取主菜单。
  3. 选择“启动 shell”。老实说,任何能提供 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

瞧 — — grub 回来了。


(此网站上的代码缩进不起作用……?)

相关内容