我尝试使用标准 apt-get upgrade 升级 ubuntu 并遇到了与此处描述的类似的问题: https://www.webhostingtalk.com/showthread.php?t=1315016
grub 在该过程中经历了重新配置步骤(重新配置是命令行,但抛出了伪 GUI)它在写入 /dev/sda 和 /dev/sdb 时失败,所以我必须继续而不进行安装(没有其他选择)
现在任何 apt-get 命令都会失败,我认为这是由于 grub 出现以下错误:
$ update-grub
/usr/sbin/grub-probe: error: failed to get canonical path of `none'.
或者
$ sudo apt-get upgrade
<snip>
Setting up friendly-recovery (0.2.31) ...
/usr/sbin/grub-probe: error: failed to get canonical path of `none'.
dpkg: error processing package friendly-recovery (--configure):
apt-get -f install
以类似的方式失败。
$ dpkg --configure -a
Setting up grub-pc (2.02~beta2-29ubuntu0.3) ...
/usr/sbin/grub-probe: error: failed to get canonical path of `none'.
dpkg: error processing package grub-pc (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of grub2:
grub2 depends on grub-pc (= 2.02~beta2-29ubuntu0.3); however:
Package grub-pc is not configured yet.
dpkg: error processing package grub2 (--configure):
dependency problems - leaving unconfigured
我的服务器是突袭服务器,所以我推测这是原因?
[编辑] 这可能就是所指的‘无’:
$ cat /etc/fstab
proc /proc proc defaults 0 0
/dev/md/0 none swap sw 0 0
/dev/md/1 /boot ext3 defaults 0 0
/dev/md/2 / ext4 defaults 0 0
我的假设这md0
是我的主机(hetzner)提供的救援分区。
我应该告诉 grub 忽略 md0 吗?该怎么做?
fdisk 的输出:
$ fdisk -l
Disk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 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: 0x00032e61
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 8390656 8388609 4G fd Linux raid autodetect
/dev/sda2 8392704 9441280 1048577 512M fd Linux raid autodetect
/dev/sda3 9443328 937701040 928257713 442.6G fd Linux raid autodetect
Disk /dev/sdb: 447.1 GiB, 480103981056 bytes, 937703088 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: 0x00074c3d
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 8390656 8388609 4G fd Linux raid autodetect
/dev/sdb2 8392704 9441280 1048577 512M fd Linux raid autodetect
/dev/sdb3 9443328 937701040 928257713 442.6G fd Linux raid autodetect
Disk /dev/md2: 442.5 GiB, 475133575168 bytes, 927995264 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/md0: 4 GiB, 4292804608 bytes, 8384384 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/md1: 511.7 MiB, 536543232 bytes, 1047936 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
答案1
清除并重新安装解决了所有 apt 问题:
sudo dpkg --purge grub-pc grub2 grub-gfxpayload-lists
sudo apt-get -f install
# the following gives the prompts:
sudo apt-get install grub-pc grub2 grub-gfxpayload-lists
我在这里更好地重述了这个问题(并且没有适当的问题): grub2:update-grub 无法获取“无”的规范路径