Rui*_*iro 5 debian dpkg linux-kernel
我正在将 Debian 9.0 Stretch 中的内核升级到内核到 4.9.0-1-amd64。
该软件包已安装,但是,在程序结束时,我收到了一个神秘的错误:
device-mapper: reload ioctl on osprober-linux-sda2 failed: Device or resource busy
Command failed
Run Code Online (Sandbox Code Playgroud)
我也担心重新启动它,它无法正常启动。
运行dpkg-reconfigure linux-image-4.9.0-1-amd64
也会产生同样的错误。
奇怪的是,在/etc/fstab
我没有sda2
分区,并且该程序用于工作到现在。它只是在最后一次软件包升级后停止工作(实际上我可以发誓我在最后一次udev
软件包升级到 232-18后首先看到了错误)。带有 Jessie 的 VM 仍然可以正常工作。
所以fstab
是:
$cat /etc/fstab
/dev/sda1 / ext3 errors=remount-ro,noatime 0 1
/dev/sda3 none swap sw 0 0
Run Code Online (Sandbox Code Playgroud)
但是,运行blkid
,我现在记得/dev/sda2
是ext3日志分区:
/dev/sda1: UUID="43dcd715-1914-4da8-8e55-27879705920a" EXT_JOURNAL="b153f326-cb4e-491b-9b38-f9750dcf5165" TYPE="ext3" PARTUUID="8aac691c-01"
/dev/sda2: LABEL="j-my-dev" UUID="b153f326-cb4e-491b-9b38-f9750dcf5165" LOGUUID="b153f326-cb4e-491b-9b38-f9750dcf5165" TYPE="jbd" PARTUUID="8aac691c-02"
/dev/sda3: UUID="a04c0b69-07d5-40e1-8c80-6914118f6df4" TYPE="swap" PARTUUID="8aac691c-03"
Run Code Online (Sandbox Code Playgroud)
在进一步调查后,我还发现一个悬空文件仍然提到旧的sda2
(因为这个虚拟机是在很多个月前从带有 LVM 的服务器迁移的)
内容/etc/blkid.tab
是:
<device DEVNO="0x0802" TIME="1414777337.116803" UUID="B24u3l-mvwB-vyxK-GRNw-vc6o-r2sS-NDgVru" TYPE="LVM2_member">/dev/sda2</device>
Run Code Online (Sandbox Code Playgroud)
我删除了它,但是它可能没有任何区别,因为正确的blkid.tab
是/var/run/blkid/blkid.tab
<device DEVNO="0x0801" TIME="1487991512.317454" UUID="43dcd715-1914-4da8-8e55-27879705920a" EXT_JOURNAL="b153f326-cb4e-491b-9b38-f9750dcf5165" TYPE="ext3" PARTUUID="8aac691c-01">/dev/sda1</device>
<device DEVNO="0x0802" TIME="1487991415.63466" LABEL="j-my-dev" UUID="b153f326-cb4e-491b-9b38-f9750dcf5165" LOGUUID="b153f326-cb4e-491b-9b38-f9750dcf5165" TYPE="jbd" PARTUUID="8aac691c-02">/dev/sda2</device>
<device DEVNO="0x0803" TIME="1487991512.507280" UUID="a04c0b69-07d5-40e1-8c80-6914118f6df4" TYPE="swap" PARTUUID="8aac691c-03">/dev/sda3</device>
Run Code Online (Sandbox Code Playgroud)
运行前一个dpkg-reconfigure
仍然给出相同的错误。
我还设法查明了upgrade-grub
被调用的错误dpkg-reconfigure
。单独运行:
#update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.9.0-1-amd64
Found initrd image: /boot/initrd.img-4.9.0-1-amd64
device-mapper: reload ioctl on osprober-linux-sda2 failed: Device or resource busy
Command failed
done
Run Code Online (Sandbox Code Playgroud)
stracing upgrade-grub
,很明显这种情况发生在/etc/grub.d/30_os-prober
,阅读该脚本的违规命令是os-prober
。
所以运行它:
#os-prober
device-mapper: reload ioctl on osprober-linux-sda2 failed: Device or resource busy
Command failed
Run Code Online (Sandbox Code Playgroud)
错误来自os-prober
调用:
#/usr/bin/linux-boot-prober /dev/sda2
device-mapper: reload ioctl on osprober-linux-sda2 failed: Device or resource busy
Command failed
Run Code Online (Sandbox Code Playgroud)
看着30_os-prober
我也了解一下GRUB_OS_PROBER_SKIP_LIST
。
if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
continue
fi
Run Code Online (Sandbox Code Playgroud)
谷歌搜索发现这篇文章:Make grub2 ignore a某个分区,这让我输入/etc/default/grub
:
GRUB_OS_PROBER_SKIP_LIST="b153f326-cb4e-491b-9b38-f9750dcf5165@/dev/sda2"
Run Code Online (Sandbox Code Playgroud)
但是,错误仍然发生,并且将30_os-prober
脚本置于调试模式显示负责处理的代码块GRUB_OS_PROBER_SKIP_LIST
未执行。例如,它甚至没有到达if
上面显示的行。
我的 GRUB 版本是2.02~beta3-5
. 该怎么办?
更新:根据@GaD3R 请求,libmapper-dev 是 1.02.1
鉴于GRUB_OS_PROBER_SKIP_LIST
显然没有被使用(bug?),我不得不配置 GRUB/os-prober 来不扫描每个分区中的操作系统。
所以它被添加到/etc/default/grub
行中:
GRUB_DISABLE_OS_PROBER=true\n
Run Code Online (Sandbox Code Playgroud)\n\n现在,命令dpkg-reconfigure linux-image-4.9.0-1-amd64
可以update-grub
正常工作了。
有问题的服务器也4.9.0-1-amd64
成功地使用内核重新启动。
我在所有调试和解决方案之后发现的一个相关问题, 在这里,也主张os-prober
完全删除作为替代方案。该解决方案也将起作用,因为脚本在调用二进制文件之前检查它是否存在。
我怀疑os-prober
只需要多操作系统 grub,这不是我的情况。
在 @Ferenc W\xc3\xa1gner对的历史问题发表评论之后os-prober
,并分享了在仅 Linux 虚拟机的上下文中删除 os-prober 并没有什么坏处的观点之后,我实际上将其从我的虚拟机中删除了。
归档时间: |
|
查看次数: |
5807 次 |
最近记录: |