U 盘安装上的内核更新失败,并出现 grub-probe 错误

Ada*_*nce 1 update-manager kernel 11.10

我正在使用 Ubuntu 11.10 的 U 盘安装来诊断一些硬件问题。

按照 Ubuntu 网站的建议,使用 11.10 映像和 pendrivelinux.com 方法设置了 USB 记忆棒。USB 记忆棒为 8 GB。

我的笔记本允许我直接从 USB 启动,所以 HDD 仍然具有 Micro$oft 风格的启动结构(Windows 7)。

在稍微玩了 O/S 之后(并了解到我的 HDD 有 15000 个重新分配的扇区),更新管理器提示我安装一些更新。除了内核更新 (3.0.0.14) 之外,所有内容都正确更新。

似乎有一个 grub 错误:

ubuntu@ubuntu:/dev$ sudo apt-get install
Reading package lists... Done  
Building dependency tree   
Reading state information... Done  
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.  
3 not fully installed or removed.  
After this operation, 0 B of additional disk space will be used.  
Setting up linux-image-3.0.0-14-generic (3.0.0-14.23) ...  
Running depmod.  
update-initramfs: deferring update (hook will be called later)  
Examining /etc/kernel/postinst.d.  
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.0.0-14-generic /boot/vmlinuz-3.0.0-14-generic  
update-initramfs: Generating /boot/initrd.img-3.0.0-14-generic  
cryptsetup: WARNING: failed to detect canonical device of overlayfs  
cryptsetup: WARNING: could not determine root device from /etc/fstab  
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.0.0-14-generic /boot/vmlinuz-3.0.0-14-generic  
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.0.0-14-generic /boot/vmlinuz-3.0.0-14-generic  
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.0.0-14-generic /boot/vmlinuz-3.0.0-14-generic  
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).  
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
Run Code Online (Sandbox Code Playgroud)

每次我尝试重复安装时都会出现这种情况。幸运的是,尽管出现故障,系统始终处于可启动状态。

我是否必须采取一些特殊步骤来更新内核?我是否有一个微妙的安装问题需要手动解决才能解决这个问题?

至少有其他人在旧版本的 O/S 上遇到了同样的问题mount当我再次访问笔记本电脑时,我将提供(如上一个问题中所要求的)的输出。

编辑:结果mount

/cow on / type overlayfs (rw)   
proc on /proc type proc (rw,noexec,nosuid,nodev  
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)  
fusectl on /sys/fs/fuse/connections type fusectl (rw)  
udev on /dev type devtmpfs (rw,mode=0755)  
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)  
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)  
/dev/sdb1 on /cdrom type vfat  (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)  
/dev/loop0 on /rofs type squashfs (ro,noatime)  
none on /sys/kernel/debug type debugfs (rw)  
none on /sys/kernel/security type securityfs (rw)  
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)  
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)  
none on /run/shm type tmpfs (rw,nosuid,nodev)  
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)  
gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)
Run Code Online (Sandbox Code Playgroud)

编辑 #2:我已经确定 pendrivelinux.com 闪存驱动器实用程序可能在其中发挥作用。根据 boot_info_script 脚本,包含我的 Ubuntu 发行版的 U 盘被格式化为 FAT32,并且正在安装的引导加载程序实际上不是 GRUB 而是 SYSLINUX。

考虑到 grub 不参与启动过程,grub-probe 无法弄清楚该怎么做是有道理的。

(这让我想知道为什么 apt-get 在尝试内核更新之前不检查 grub 引导加载程序作为依赖项?)

我想下一步是尝试用 GRUB 覆盖 SYSLINUX 并尝试以这种方式启动棒,然后查看更新是否有效。

我的第一次尝试导致系统无法启动 - grub 正在加载,我可以正常加载内核,但无法确定以 root 身份挂载什么。我不得不擦拭并重新安装在闪存驱动器上才能重新开始。

小智 5

我看到你解决了你的问题(使用 Windows 7 ......不是真正的解决方案,但无论如何)。我找到了解决方案。我在这里发布它,供其他可能遇到问题的用户使用。

我找到了如何解决这个问题。中断安装的行是:

run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.0.0-15-generic /boot/vmlinuz-3.0.0-15-generic
Run Code Online (Sandbox Code Playgroud)

(内核版本可能因您的安装而异)

编辑有问题的文件以注释更新 Grub 的行。这是一个非常小的文件,所以不是太难。

注意:如果您想先备份文件(这通常是一个明智的主意),请将其复制到另一个目录中(这/root是一个很好的目录,/tmp因为它不会在重新启动后继续存在)。如果您在同一文件夹 ( /etc/kernel/postinst.d/) 中进行备份,它也会被调用,并且会失败。

编辑/etc/kernel/postinst.d/zz-update-grub以注释掉第 15 行。

前:

    */postinst.d/*:|*/postinst.d/*:configure|*/postrm.d/*:|*/postrm.d/*:remove)
        exec update-grub
        ;;
Run Code Online (Sandbox Code Playgroud)

后:

    */postinst.d/*:|*/postinst.d/*:configure|*/postrm.d/*:|*/postrm.d/*:remove)
#       exec update-grub
        ;;
Run Code Online (Sandbox Code Playgroud)

运行配置脚本:

sudo dpkg --configure -a
Run Code Online (Sandbox Code Playgroud)

你应该看到很多调试,而不是最后的错误行。

可以肯定的是,重新运行配置。它应该立即结束,没有任何日志:

sudo dpkg --configure -a
Run Code Online (Sandbox Code Playgroud)

现在,您可以恢复该zz-update-grub文件,以防万一您想稍后安装其他内核并grub开始使用overlayfs.