Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-104684

libvirt daemon autostart/session mode for root user (for use in container build process)

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-10.0
    • libvirt
    • None
    • None
    • 1
    • rhel-virt-core-libvirt-1
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • Libvirt in planning
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      What were you trying to do that didn't work?

      In a Containerfile, use a libguestfs command which ultimately uses libvirt to run qemu. (Running qemu directly works fine). The actual Containerfile is quite complicated, but a simplified reproducer is:

      FROM fedora:42
      RUN dnf install /usr/bin/guestfish -y
      RUN guestfish -a /dev/null run
      
      $ podman build -f Containerfile-test
      [...]
      STEP 3/3: RUN guestfish -a /dev/null run
      libvirt: XML-RPC error : Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory
      *stdin*:0: libguestfs: error: could not connect to libvirt (URI = qemu:///system): Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory [code=38 int1=2]
      Error: building at STEP "RUN guestfish -a /dev/null run": while running runtime: exit status 1
      

      Modifying the test case to force using qemu:///session fails similarly:

      FROM fedora:42
      RUN dnf install /usr/bin/guestfish -y
      RUN LIBGUESTFS_BACKEND=libvirt:qemu:///session guestfish -a /dev/null run
      
      STEP 3/3: RUN LIBGUESTFS_BACKEND=libvirt:qemu:///session guestfish -a /dev/null run
      libvirt: XML-RPC error : Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory
      *stdin*:0: libguestfs: error: could not connect to libvirt (URI = qemu:///session): Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory [code=38 int1=2]
      Error: building at STEP "RUN LIBGUESTFS_BACKEND=libvirt:qemu:///session guestfish -a /dev/null run": while running runtime: exit status 1
      

      What is the impact of this issue to you?

      We cannot run libguestfs commands in container builds, which we want to do.

      There is a workaround, using LIBGUESTFS_BACKEND=direct, but that is undesirable for other reasons.

      Please provide the package NVR for which the bug is seen:

      It was seen in RHEL 10.0, but this happens in Fedora & likely with upstream libvirt too.

      How reproducible is this bug?:

      100%

              virt-maint virt-maint
              rhn-eng-rjones Richard Jones
              virt-maint virt-maint
              virt-bugs virt-bugs
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: