Bug 1999372

Summary: Error unclear when starting guest with wrong virtiofsd path
Product: Red Hat Enterprise Linux 9 Reporter: Lili Zhu <lizhu>
Component: libvirtAssignee: Ján Tomko <jtomko>
libvirt sub component: General QA Contact: Lili Zhu <lizhu>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: jdenemar, jsuchane, lmen, smitterl, virt-maint
Version: 9.0Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-8.1.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:03:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 8.1.0
Embargoed:

Description Lili Zhu 2021-08-31 03:55:33 UTC
Description of problem:
Error unclear when starting guest with wrong  virtiofsd path

Version-Release number of selected component (if applicable):
libvirt-daemon-7.6.0-2.module+el8.5.0+12219+a5ea13d2.x86_64

How reproducible:
100%


Steps to Reproduce:
1. check the virtiofsd.json file
# cat /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json
{
  "description": "QEMU virtiofsd vhost-user-fs",
  "type": "fs",
  "binary": "/usr/libexec/virtiofsd"  <==binary path is updated
}


2. prepare a guest with the following xml
...
 <filesystem type='mount' accessmode='passthrough'>
      <driver type='virtiofs'/>
      <binary path='/sbin/virtiofsd'/>
      <source dir='/path'/>
      <target dir='mount_tag'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </filesystem>
...

3. start the guest
# virsh start avocado-vt-vm1 
error: Failed to start domain 'avocado-vt-vm1'
error: internal error: virtiofsd died unexpectedly

Expected results:
Should report clear error msg to show that virtiofsd binday is not correct.


Additional info:

Comment 1 Ján Tomko 2022-01-27 14:39:05 UTC
libvirt actually logs the error into virtiofsd.log:
libvirt:  error : cannot execute binary /sbin/virtiofsd: No such file or directory

But checking if the binary exists upfront (virExec does not do that check
for relative paths) and/or reporting the errors from the log from early startup
(like we do with QEMU) would be much more helpful.

Comment 2 Ján Tomko 2022-01-27 18:23:54 UTC
Patch that checks if the binary is existing and executable before trying to run it:
https://listman.redhat.com/archives/libvir-list/2022-January/msg01246.html

Comment 3 Ján Tomko 2022-02-03 13:17:38 UTC
Pushed as:
commit 459f8009c29a40b48f1a28846003d1c5d7e04539
Author:     Ján Tomko <jtomko>
CommitDate: 2022-02-03 14:15:04 +0100

    qemu: virtiofs: check whether the supplied binary exists
    
    Report an error upfront if the binary does not exist
    or is not executable.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1999372
    
    Signed-off-by: Ján Tomko <jtomko>
    Reviewed-by: Andrea Bolognani <abologna>

git describe: v8.0.0-276-g459f8009c2

Comment 4 Lili Zhu 2022-03-19 14:59:09 UTC
Tested with:
libvirt-8.2.0-1.fc35.x86_64

1. prepare a guest with the following xml
...
 <filesystem type='mount' accessmode='passthrough'>
      <driver type='virtiofs'/>
      <binary path='/sbin/virtiofsd'/>
      <source dir='/path'/>
      <target dir='mount_tag'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </filesystem>
...

2. define the guest
# virsh define avocado-vt-vm1 
error: Failed to start domain 'avocado-vt-vm1'
error: internal error: virtiofsd binary '/sbin/virtiofsd' is not executable

Comment 7 Lili Zhu 2022-04-29 02:21:09 UTC
Verified this bug with:
libvirt-8.2.0-1.el9.x86_64

The testing steps are the same with Comment #4.

The testing result matches with the expected result, mark the bug as verified.

Comment 9 errata-xmlrpc 2022-11-15 10:03:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Low: libvirt security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:8003