AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 510434
Accepted
Philipp Claßen
Philipp Claßen
Asked: 2014-08-13 11:04:48 +0800 CST2014-08-13 11:04:48 +0800 CST 2014-08-13 11:04:48 +0800 CST

从 12.04 升级到 14.04 后 grub-install 失败(grub-pc 损坏)

  • 772

我刚刚从 Ubuntu 12.04 升级到 14.04,但是在安装过程中 grub-install 失败了:

在此处输入图像描述

在此处输入图像描述

我继续安装,希望之后能解决 grub 问题。但是,我遇到了一些困难。我还没有重新启动我的系统,因为我担心它无法重新启动。

这是我在尝试安装 grub 时总是遇到的错误:

 $ sudo grub-install /dev/mapper/isw_cjccfdbihf_Volume0p1 
 Installing for i386-pc platform.
 grub-install: error: cannot find a GRUB drive for /dev/mapper/isw_cjccfdbihf_Volume0p1.  Check your device.map.

(我也试过sudo grub-install /dev/sda了,但它也失败了,并出现了完全相同的错误消息。)

该机器似乎使用 RAID 1 设置。以下是一些信息:

$ ls -algh /dev/mapper/
total 0
drwxr-xr-x  2 root     120 Aug 12 19:41 .
drwxr-xr-x 16 root    5.2K Aug 12 20:27 ..
crw-------  1 root 10, 236 Jul 28 10:30 control
lrwxrwxrwx  1 root       7 Aug 12 19:41 isw_cjccfdbihf_Volume0p1 -> ../dm-1
lrwxrwxrwx  1 root       7 Aug 12 19:41 isw_cjccfdbihf_Volume0p2 -> ../dm-2
lrwxrwxrwx  1 root       7 Aug 12 19:41 isw_cjccfdbihf_Volume0p5 -> ../dm-3

$ sudo grub-probe -t device /boot/grub
/dev/mapper/isw_cjccfdbihf_Volume0p1

$ sudo fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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: 0x0003b681

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   468514815   234256384   83  Linux
/dev/sda2       468516862   488390655     9936897    5  Extended
/dev/sda5       468516864   488390655     9936896   82  Linux swap / Solaris

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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: 0x0003b681

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   468514815   234256384   83  Linux
/dev/sdb2       468516862   488390655     9936897    5  Extended
/dev/sdb5       468516864   488390655     9936896   82  Linux swap / Solaris

Disk /dev/mapper/isw_cjccfdbihf_Volume0p1: 239.9 GB, 239878537216 bytes
255 heads, 63 sectors/track, 29163 cylinders, total 468512768 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: 0x00000000

Disk /dev/mapper/isw_cjccfdbihf_Volume0p1 doesn't contain a valid partition table
fdisk: unable to read /dev/mapper/isw_cjccfdbihf_Volume0p2: Inappropriate ioctl for device

特别是最后两行似乎表明了更深层次的问题。:-(

的错误信息grub-install还提到了一个device.map文件。

$ cat /boot/grub/device.map
cat: /boot/grub/device.map: No such file or directory

我试图生成它,但它也没有帮助(错误消息没有改变):

$ sudo grub-mkdevicemap
$ cat /boot/grub/device.map
 (hd0)  /dev/disk/by-id/ata-WDC_WD2500AAJS-00YZCA0_WD-WCAYU7549707
 (hd1)  /dev/disk/by-id/ata-WDC_WD2500AAJS-00YZCA0_WD-WCAYU7501473

您对我下一步应该尝试什么有什么建议吗?非常感谢任何帮助。

更新:

$ debconf-show grub-pc
debconf: DbDriver "passwords" warning: could not open /var/cache/debconf    /passwords.dat: Permission denied
* grub-pc/install_devices: /dev/disk/by-id/dm-name-isw_cjccfdbihf_Volume0
  grub-pc/kopt_extracted: false
  grub-pc/partition_description:
* grub2/linux_cmdline:
  grub-pc/install_devices_empty: false
  grub-pc/timeout: 10
  grub-pc/install_devices_failed_upgrade: true
* grub2/linux_cmdline_default: quiet splash
  grub-pc/postrm_purge_boot_grub: false
  grub-pc/hidden_timeout: true
  grub-pc/disk_description:
  grub-pc/mixed_legacy_and_grub2: true
  grub2/kfreebsd_cmdline_default: quiet splash
  grub2/device_map_regenerated:
* grub-pc/install_devices_failed: true
  grub-pc/chainload_from_menu.lst: true
  grub-pc/install_devices_disks_changed:
  grub2/kfreebsd_cmdline:

注意这一行:grub-pc/install_devices: /dev/disk/by-id/dm-name-isw_cjccfdbihf_Volume0

现在的内容/etc/fstab:

proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/isw_cjccfdbihf_Volume01 /               ext4    errors=remount-ro 0       1
/dev/mapper/isw_cjccfdbihf_Volume0p5 none            swap    sw              0       0

2012 年的备份文件显示交换条目略有不同(Volume05 而不是 Volume0p5),这表明名称可能已更改:

 # Note that this is an old file at the time the system was installed (Ubuntu 10.04 or 10.10)
 # (This is also the time from which the original grub configuration is from, isn't it?!)
 /dev/mapper/isw_cjccfdbihf_Volume01 /               ext4    errors=remount-ro 0       1
 /dev/mapper/isw_cjccfdbihf_Volume05 none            swap    sw              0       0

所以,也许它与“_Volume01”与“_Volume0p1”与“_Volume0”有关。/etc/fstab说“01”,ls /dev/mapper返回映射“0p1”、“0p2”和“0p5”(交换),最后debconf-show grub-pc说“Volume0”。我认为这种不一致是问题的根源。

现在我想知道:

  1. grub-pc/install_devices输出中的行应该debconf-show grub-pc是什么?
  2. 如何更改 Grub 设置,以便我可以尝试不同的值?

我还刚刚注意到 grub-pc 的安装被破坏了:

$ sudo dpkg-reconfigure grub-pc
/usr/sbin/dpkg-reconfigure: grub-pc is broken or not fully installed
14.04
  • 4 4 个回答
  • 18321 Views

4 个回答

  • Voted
  1. Best Answer
    Philipp Claßen
    2014-08-14T09:30:35+08:002014-08-14T09:30:35+08:00

    这是我解决问题的方法:

    在安静的时刻,我有时间冒停机的风险。所以我用 Ubuntu 14.04 Live CD 重新启动了系统并重新安装了 Grub。我没有遇到问题,之后系统正常启动。

    这是一般说明:https ://help.ubuntu.com/community/Grub2/Installing#via_the_LiveCD_terminal

    根据记忆,以下是我在特定情况下使用的命令:

    从 Live CD 启动并执行以下命令:

     $ sudo su
     $ mount /dev/mapper/isw_cjccfdbihf_Volume0p1 /mnt
    
     (Sorry, I'm not 100% sure whether the target was /dev/mapper/isw_cjccfdbihf_Volume0p1 or
      /dev/sda. I think it was /dev/mapper/isw_cjccfdbihf_Volume0p1.)
     $ grub-install --root-directory=/mnt /dev/mapper/isw_cjccfdbihf_Volume0p1
     $ reboot
    

    之后,系统重新启动。最后,我可以用sudo apt-get install.

    目前,/etc/fstab仍然列出/dev/mapper/isw_cjccfdbihf_Volume01根目录。我仍然不知道这是否真的正确,但我没有尝试将其更改为/dev/mapper/isw_cjccfdbihf_Volume0p1以确定它在重新启动后是否仍然有效。

    • 3
  2. Peter Häring
    2014-10-06T07:38:37+08:002014-10-06T07:38:37+08:00

    在 RAID 设置中安装 grub2 失败,因为设备命名在某种程度上随着更新而改变,但尚未重新启动的运行系统使用不同的命名方案。

    失败时只需取消 grub-install 并重新启动即可。之前安装的 grub 仍然指向一个有效的内核并且可以毫无问题地引导。重新启动后,grub 安装没有任何问题。

    • 3
  3. Kirtlander
    2014-10-08T15:34:37+08:002014-10-08T15:34:37+08:00

    杰出的。grub-install在执行命令时,我只需要更改一件事以避免出现此错误:

    /usr/bin/grub-bios-setup: warning: Embedding is not possible. GRUB
    can only be installed in this setup by using blocklists. However,
    blocklists are UNRELIABLE and their use is discouraged..
    /usr/bin/grub-bios-setup: error: will not proceed with blocklists.
    

    使用上面的命令,我更改了 grub-install 命令以将 GRUB 安装到 MBR 而不是像这样的分区(删除'p1'):

    $ grub-install --root-directory=/mnt /dev/mapper/isw_cjccfdbihf_Volume0
    

    否则,它真的省去了我的后顾之忧。我很感激。

    • 1
  4. Joel B
    2014-12-10T06:43:22+08:002014-12-10T06:43:22+08:00

    没有一个答案对我有用,所以我重新启动并使用引导修复盘来解决问题。这奏效了。呼...!

    • 0

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve