• KVM can't use Blockdevice anymore

    From basti@21:1/5 to All on Sat Feb 8 20:00:01 2025
    Hello I setup a new KVM host (try debian 12 and 11).

    I use LVM with the host and also within KVM, this works goog for about
    the last > 10 years.

    Now KVM cant use block devices anymore.
    Apparmor is sill disabled.

    ...
    -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
    -msg timestamp=on
    char device redirected to /dev/pts/1 (label charserial0) 2025-02-08T17:46:56.707371Z qemu-system-x86_64: -blockdev {"driver":"host_device","filename":"/dev/kvm/debian11","aio":"native","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}:
    Could not open '/dev/kvm/debian11': Permission denied
    2025-02-08 17:46:56.762+0000: shutting down, reason=failed



    root@kvm:/dev/kvm# lvs
    LV VG Attr LSize Pool Origin Data% Meta% Move Log
    debian11 kvm -wi-a----- 5.00g

    I don't know what's wrong here.

    Best Regards

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Santiago Vila@21:1/5 to All on Sat Feb 8 22:20:01 2025
    El 8/2/25 a las 19:10, basti escribió:
    Now KVM cant use block devices anymore.

    Hi. I found a similar problem very recently.

    I tried to use a virtual machine which I defined a long time ago,
    but did not use for a long time (probably several years, during which
    the host was upgraded to Debian 12 in the meantime)

    What I did was to undefine the machine (which removes its xml
    snippet at /etc/libvirt/qemu) and install it again with
    virt-manager, using the same LVM logical volume as the disk.

    After that, it worked again, and I also noticed the small change
    in the xml file.

    I had this:

    - <emulator>/usr/bin/kvm</emulator>
    - <disk type='file' device='disk'>
    - <driver name='qemu' type='raw'/>
    - <source file='/dev/k/mymachine'/>

    and now I have this:

    + <emulator>/usr/bin/qemu-system-x86_64</emulator>
    + <disk type='block' device='disk'>
    + <driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
    + <source dev='/dev/k/mymachine'/>

    In the above, "k" is the name of my LVM group, so the disk was really a device, not a file, and maybe that's why it did not want to work with the old configuration.

    Hope this helps.

    Thanks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)