重新安装 GRUB 失败

重新安装 GRUB 失败

我已经在已经运行 Ubuntu 14.10 的笔记本上安装了 W7 作为第二个操作系统,并进行了双重引导。W7
安装在硬盘上。对于 Ubuntu,/home 和 /usr/share 安装在硬盘上,其余安装在附加 SSD 上。安装 W7 后,grub 启动菜单被删除,因此我尝试使用 Live CD 重新安装它。

我运行boot-repair并选择了Recommended repair它,然后出现提示:

 apt-error detected. Please open a terminal then type (or copy-paste) the following command:
 sudo chroot "/mnt/boot-sav/sdb2" apt-get -f install

但是当我运行这个命令时我得到:

  debconf: Perl may be unconfigured (Can't locate strict.pm in @INC (you may need to install the strict module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.1 /usr/local/share/perl/5.20.1 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at (eval 1) line 2.
  BEGIN failed--compilation aborted at (eval 1) line 2.
 ) -- aborting
 E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)
 Setting up install-info (5.2.0.dfsg.1-4) ...
 Not a directory: /usr/share/info.
 dpkg: error processing package install-info (--configure):
 subprocess installed post-installation script returned error exit status 1
 Errors were encountered while processing:
 install-info
 E: Sub-process /usr/bin/dpkg returned an error code (1)

我试图跑sudo apt-get install -fsudo apt-get autoremove但没有帮助......

以下是有关磁盘/分区的一些附加信息:

ubuntu@ubuntu:~$ sudo parted -l
Model: ATA WDC WD10JPVX-08J (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size   Type     File system  Flags
 1      1049kB  106MB   105MB  primary  ntfs         boot
 2      106MB   253GB   253GB  primary  ntfs
 3      253GB   777GB   525GB  primary  ext4
 4      777GB   1000GB  223GB  primary  ext4


 Model: ATA LITEONIT LSS-16L (scsi)
 Disk /dev/sdb: 16.0GB
 Sector size (logical/physical): 512B/512B
 Partition Table: msdos
 Disk Flags: 

 Number  Start   End     Size    Type     File system  Flags
  2      1049kB  16.0GB  16.0GB  primary  ext4         boot


 Model: MATSHITA DVD-RAM UJ8C2 (scsi)
 Disk /dev/sr0: 4700MB
 Sector size (logical/physical): 2048B/2048B
 Partition Table: mac
 Disk Flags: 

 Number  Start   End     Size    File system  Name   Flags
  1      2048B   6143B   4096B                Apple
  2      1152MB  1155MB  2327kB               EFI

 Disk /dev/loop0: 1 GiB, 1115594752 bytes, 2178896 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 /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 4096 bytes
 I/O size (minimum/optimal): 4096 bytes / 4096 bytes
 Disklabel type: dos
 Disk identifier: 0x00098003

 Device     Boot      Start        End    Sectors   Size Id Type
 /dev/sda1  *          2048     206847     204800   100M  7 HPFS/NTFS/exFAT
 /dev/sda2           206848  493502463  493295616 235.2G  7 HPFS/NTFS/exFAT
 /dev/sda3        493502464 1518438399 1024935936 488.7G 83 Linux
 /dev/sda4       1518438400 1953523711  435085312 207.5G 83 Linux

 Disk /dev/sdb: 14.9 GiB, 16013942784 bytes, 31277232 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
 Disklabel type: dos
 Disk identifier: 0x38b890f8

 Device     Boot Start      End  Sectors  Size Id Type
 /dev/sdb2  *     2048 31277055 31275008 14.9G 83 Linux

 ubuntu@ubuntu:~$ sudo blkid
 /dev/sda1: LABEL="System Reserved" UUID="F878F91778F8D57A" TYPE="ntfs"    PARTUUID="00098003-01" 
 /dev/sda2: UUID="8AB0009CB00090BD" TYPE="ntfs" PARTUUID="00098003-02" 
 /dev/sda3: UUID="5eede873-4ba1-4979-8cd3-91954305dd24" TYPE="ext4" PARTUUID="00098003-03" 
 /dev/sda4: UUID="22edd7a2-9794-4192-be60-8d595047f72d" TYPE="ext4" PARTUUID="00098003-04" 
 /dev/sdb2: UUID="0cd95271-f784-4e78-94aa-ebd8d80a3e52" TYPE="ext4" PARTUUID="38b890f8-02" 
 /dev/sr0: UUID="2014-10-22-19-43-11-00" LABEL="Ubuntu 14.10 amd64" TYPE="iso9660" PTUUID="4a022e4f" PTTYPE="dos" 
 /dev/loop0: TYPE="squashfs" 

答案1

好的,我终于找到了一个解决方案:由于/home/usr/share其余部分位于不同的分区上,因此我需要正确安装所有内容:

sudo mount /dev/sdb2 /mnt
sudo mount /dev/sda4 /mnt/usr/share
sudo mount /dev/sda3 /mnt/home
for i in /dev /dev/pts /proc /sys /run ; do sudo mount -B $i /mnt$i ; done
sudo mount -o bind /etc/resolv.conf /mnt/etc/resolv.conf 
sudo chroot /mnt /bin/bash
[Optional -> was needed in my case] sudo apt-get install grub-pc
grub-install /dev/sda
sudo update-grub

一切又恢复正常了!

相关内容