[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#648208: os-prober: blockdev --setro affects running kvm instances

>> Since version 1.45, os-prober instead uses grub-mount when it's
>> -- and if grub is installed to use os-prober, it will pull it in.
>> So unless another bootloader is also using os-prober, or someone
>> installs and uses it by hand, this won't happen in unstable/testing.

> It's not really the case.

I agree here with Jean Francois.

Here the problematic code in os-probes/common/50mounted-tests line 49,
simplified for better understanding

if type grub-mount && type grub-probe  &&  grub-mount "$partition" ;
	etc ...
	blockdev --setro

the problem here is that when using LVM what 50mounted-tests treats as a
$partition might very well be a disk image (512 first bytes will contain
a MBR)

In that case grub-mount will fail and pass the hand to ro_partition
which will be happily set the whole device as read only, causing the
file system errors in the guest

poking on the idea of Michael I was wondering it would be possible to
test before calling blockdev --setro if the block device we target has a
file descriptor pointing to it. This would indicate that
something/someone is actually doing something with the block device and
we should rather leave it alone.

in pseudo shell it would look like:

if  ls -l /proc/*/fd | grep $(realpath $partition); then
	debug "active file descriptor on $partition)
	blockdev --setro

I find this a bit hacky however.

What we also do would be simply to change the depency on os-prober from
"recommends" to "suggests" in os-prober, and add os-prober as a
dependency of the desktop task of the debian-installer (which is
selected by default) so that non-server users get it installed.

Reply to: