I am upgrading the kernel in Debian 9.0 Stretch to kernel to 4.9.0-1-amd64.
The package is installed, however, at the end of the procedure I got the cryptic error:
device-mapper: reload ioctl on osprober-linux-sda2 failed: Device or resource busy
Command failed
I also am worried about rebooting it, and it not booting properly.
Running dpkg-reconfigure linux-image-4.9.0-1-amd64 also produces the same error.
Oddly enough, at /etc/fstab I have no sda2 partition, and the procedure used to work until now. It just stopped working after the last package upgrades (in fact I could swear I saw the error first after the last udev package upgrade to 232-18 ). VMs with Jessie are still working fine.
So fstab is:
$cat /etc/fstab
/dev/sda1 / ext3 errors=remount-ro,noatime 0 1
/dev/sda3 none swap sw 0 0
However, running blkid, I remember now /dev/sda2 is the ext3 journaling partition:
/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"
After investigating a little more, I also found a dangling file still mentioning the old sda2 (as this VM was migrated from a server with LVM many moons ago)
The contents of /etc/blkid.tab were:
<device DEVNO="0x0802" TIME="1414777337.116803" UUID="B24u3l-mvwB-vyxK-GRNw-vc6o-r2sS-NDgVru" TYPE="LVM2_member">/dev/sda2</device>
I deleted it, however it probably does not do any difference as the proper blkid.tab is as expected at /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>
Running the previous dpkg-reconfigure still gives the same error.
I also managed to pinpoint the error to upgrade-grub being called in dpkg-reconfigure. Running it separately:
#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
stracing upgrade-grub, it is evident this happens at /etc/grub.d/30_os-prober, and reading that script the offending command is os-prober.
So running it:
#os-prober
device-mapper: reload ioctl on osprober-linux-sda2 failed: Device or resource busy
Command failed
The error comes from os-prober calling:
#/usr/bin/linux-boot-prober /dev/sda2
device-mapper: reload ioctl on osprober-linux-sda2 failed: Device or resource busy
Command failed
Looking at 30_os-prober I also find out about 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
Googling around found this article: Make grub2 ignore a certain partition, which led me to put in /etc/default/grub:
GRUB_OS_PROBER_SKIP_LIST="b153f326-cb4e-491b-9b38-f9750dcf5165@/dev/sda2"
However, the error still happens, and putting the 30_os-prober script in debug mode shows the code block responsible for handling GRUB_OS_PROBER_SKIP_LIST is not executed. e.g. it does not even reaches the if line displayed above.
My GRUB version is 2.02~beta3-5. What to do?
UPDATE: as per @GaD3R request, libmapper-dev is 1.02.1