在复制的系统上重新安装 grub

在复制的系统上重新安装 grub

我决定将 Ubuntu 16.04 从 HHD (sdb) 移至 SSD (sda)。在 live-usb 中启动,复制 /media,在 fstab 中更新 UUID。

下一步是让 GRUB 在 SSD 上运行,因此我尝试在 live-usb 中安装 GRUB。尽管最后显示“安装完成。未报告任何错误。”当我从 SSD 磁盘在 BIOS 中启动计算机时,它仍然要求提供可启动磁盘。

复制的 /media 有 grub 2.something

mint@mint ~ $ sudo grub-install --root-directory=/media/mint/SSD1 /dev/sda
grub-probe: error: failed to get canonical path of `/cow'.
Installing for i386-pc platform.
grub-install.real: warning: Sector 32 is already in use by the program `FlexNet'; avoiding it.  This software may cause boot or other problems in future.  Please ask its authors not to store data in the boot track.
Installation finished. No error reported.


sudo fdisk -l

Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 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: 0x73b46703

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   233066495   116532224   83  Linux
/dev/sda2       233066496   250068991     8501248   82  Linux swap / Solaris

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0xbbc58b91

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   318919887   159458920    7  HPFS/NTFS/exFAT
/dev/sdb2       318920702   976771071   328925185    5  Extended
/dev/sdb5       960151552   976771071     8309760   82  Linux swap / Solaris
/dev/sdb6       318920704   960151551   320615424   83  Linux

Partition table entries are not in disk order

答案1

使用以下针对 Ubuntu 16.04 的代码解决了这个问题,如下所述这里

mount /dev/sda1 /mnt
for dir in /dev /dev/pts /proc /sys /run; do
    mount --bind $dir /mnt$dir
done
chroot /mnt
update-grub2

相关内容