![常规 apt-get 更新破坏了 grub](https://linux22.com/image/637181/%E5%B8%B8%E8%A7%84%20apt-get%20%E6%9B%B4%E6%96%B0%E7%A0%B4%E5%9D%8F%E4%BA%86%20grub.png)
昨天,我在妻子的服务器(带有硬件 RAID 的 Hetzner 根服务器)上运行了常规更新(aptitude safe-upgrade),此后服务器一直无法正常启动。我能够使用 Hetzner 救援系统启动服务器(据我所知,这与使用实时 CD 启动本地 PC 相同),安装磁盘并选择进入系统。我对每个分区都运行了 fsck,它们都很好。在从救援系统 chroot 到操作系统时,我做了以下操作
- 运行
grub-install /dev/sda
并grub-install --recheck /dev/sda
,每次命令都会报告成功 - 删除了昨天错误更新中安装的新内核版本(3.2.0-65)
通过查看/var/log/apt/term.log
我可以看到升级过程中发生了以下错误:
Setting up grub-pc (1.99-21ubuntu3.15) ... /usr/sbin/grub-setup: warn: Attempting to install GRUB to a partition-less disk or to a partition. This is a BAD idea.. /usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blo cklists are UNRELIABLE and their use is discouraged.. Installation finished. No error reported.
更新安装的软件包列表如下:
Install: linux-headers-3.2.0-65-generic:amd64 (3.2.0-65.99, automatic), linux-headers-3.2.0-65:amd64 (3.2.0-65.99, automatic), linux-image-3.2.0-65-generic:amd64 (3.2.0-65.99, automatic) Upgrade: apt-transport-https:amd64 (0.8.16~exp12ubuntu10.16, 0.8.16~exp12ubuntu10.17), iproute:amd64 (20111117-1ubuntu2.1, 20111117-1ubuntu2.3), uuid-runtime:amd64 (2.20.1-1ubuntu3, 2.20.1-1ubuntu3.1), libmount1:amd64 (2.20.1-1ubuntu3, 2.20.1-1ubuntu3.1), libblkid1:amd64 (2.20.1-1ubuntu3, 2.20.1-1ubuntu3.1), libdrm-radeon1:amd64 (2.4.46-1ubuntu0.0.0.1, 2.4.52-1~precise1), libdbus-1-3:amd64 (1.4.18-1ubuntu1.4, 1.4.18-1ubuntu1.5), util-linux:amd64 (2.20.1-1ubuntu3, 2.20.1-1ubuntu3.1), linux-generic:amd64 (3.2.0.61.72, 3.2.0.65.77), libgnutls26:amd64 (2.12.14-5ubuntu3.7, 2.12.14-5ubuntu3.8), libapt-inst1.4:amd64 (0.8.16~exp12ubuntu10.16, 0.8.16~exp12ubuntu10.17), php5-gd:amd64 (5.3.10-1ubuntu3.11, 5.3.10-1ubuntu3.13), grub-pc:amd64 (1.99-21ubuntu3.14, 1.99-21ubuntu3.15), apt-utils:amd64 (0.8.16~exp12ubuntu10.16, 0.8.16~exp12ubuntu10.17), update-manager-core:amd64 (0.156.14.13, 0.156.14.15), linux-firmware:amd64 (1.79.12, 1.79.16), dbus:amd64 (1.4.18-1ubuntu1.4, 1.4.18-1ubuntu1.5), apt:amd64 (0.8.16~exp12ubuntu10.16, 0.8.16~exp12ubuntu10.17), libdrm2:amd64 (2.4.46-1ubuntu0.0.0.1, 2.4.52-1~precise1), ifupdown:amd64 (0.7~beta2ubuntu11, 0.7~beta2ubuntu11.1), bsdutils:amd64 (2.20.1-1ubuntu3, 2.20.1-1ubuntu3.1), libdrm-nouveau1a:amd64 (2.4.46-1ubuntu0.0.0.1, 2.4.52-1~precise1), linux-headers-generic:amd64 (3.2.0.61.72, 3.2.0.65.77), dpkg:amd64 (1.16.1.2ubuntu7.4, 1.16.1.2ubuntu7.5), libdrm-intel1:amd64 (2.4.46-1ubuntu0.0.0.1, 2.4.52-1~precise1), libxml2:amd64 (2.7.8.dfsg-5.1ubuntu4.6, 2.7.8.dfsg-5.1ubuntu4.9), linux-image-generic:amd64 (3.2.0.61.72, 3.2.0.65.77), libapt-pkg4.12:amd64 (0.8.16~exp12ubuntu10.16, 0.8.16~exp12ubuntu10.17), grub-pc-bin:amd64 (1.99-21ubuntu3.14, 1.99-21ubuntu3.15), libuuid1:amd64 (2.20.1-1ubuntu3, 2.20.1-1ubuntu3.1), tzdata:amd64 (2014a-0ubuntu0.12.04, 2014e-0ubuntu0.12.04), gpgv:amd64 (1.4.11-3ubuntu2.5, 1.4.11-3ubuntu2.6), openssl:amd64 (1.0.1-4ubuntu5.13, 1.0.1-4ubuntu5.16), php5-mysql:amd64 (5.3.10-1ubuntu3.11, 5.3.10-1ubuntu3.13), mount:amd64 (2.20.1-1ubuntu3, 2.20.1-1ubuntu3.1), linux-libc-dev:amd64 (3.2.0-61.93, 3.2.0-65.99), grub-common:amd64 (1.99-21ubuntu3.14, 1.99-21ubuntu3.15), grub2-common:amd64 (1.99-21ubuntu3.14, 1.99-21ubuntu3.15), php5-fpm:amd64 (5.3.10-1ubuntu3.11, 5.3.10-1ubuntu3.13), php5-common:amd64 (5.3.10-1ubuntu3.11, 5.3.10-1ubuntu3.13), libssl1.0.0:amd64 (1.0.1-4ubuntu5.13, 1.0.1-4ubuntu5.16), gnupg:amd64 (1.4.11-3ubuntu2.5, 1.4.11-3ubuntu2.6)
在我重新安装整个服务器之前,是否有人知道我可以采取其他步骤来纠正此问题?
- 编辑 -
服务器操作系统:Ubuntu 12.04
磁盘分区表:
root@rescue ~ # fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 400.1 GB, 400087408640 bytes
64 heads, 32 sectors/track, 381553 cylinders, total 781420720 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: 0x000d0317
Device Boot Start End Blocks Id System
/dev/sda1 2048 8390656 4194304+ 83 Linux
/dev/sda2 * 8392704 9441280 524288+ 83 Linux
/dev/sda3 9443328 781420719 385988696 83 Linux
Command (m for help):
我手动在 sda2 上添加了启动标志,之前没有。我检查了另一台 Hetzner 服务器,也是一样。
答案1
遗憾的是,我不得不请 Hetzner 的好心服务器人员把这个操作系统拿回去,然后我重新安装了 Ubuntu 1404 上的所有应用程序。有得有失......