Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 909372 - app-emulation/virtiofsd does not include QEMU instructions
Summary: app-emulation/virtiofsd does not include QEMU instructions
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Michal Prívozník
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2023-06-29 10:31 UTC by Amit Ugol
Modified: 2023-07-27 12:01 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Ugol 2023-06-29 10:31:29 UTC
Installing app-emulation/virtiofsd does not include instructions for QEMU, so
when we use, virt-manager for instance, we cannot add a shared folder because QEMU returns that it did not find a working virtiofsd, even if it is in the PATH.

The solution is to add the location via a vhost-user interop JSON file as described in this bug [1].


I am not sure if any package should supply such a file, but maybe there is a reason to include it to virtiofsd, as it is often used with other virtualization tools. So perhaps adding a USE=qemu into the virtiofsd ebuild, to add such a file is an option? Or maybe the opposite, add in QEMU, USE=virtiofsd to include a file.

For me, I used the data from this commit [2] to add a file, and it fixed the issue:

# cat /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json
{
  "description": "QEMU virtiofsd vhost-user-fs",
  "type": "fs",
  "binary": "/usr/bin/virtiofsd"
}

1 - https://bugzilla.redhat.com/show_bug.cgi?id=1999372
2 - https://patchwork.kernel.org/project/qemu-devel/patch/20191212163904.159893-30-dgilbert@redhat.com/
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-29 10:33:17 UTC
I've seen a few reportso f this on IRC where people were confused because libvirt (or qemu?) couldn't automagically find it.
Comment 2 Amit Ugol 2023-06-29 10:59:57 UTC
Just in case if someone wants to see the original error before adding the JSON file:


    -- Error message:
    Error starting domain: operation failed: Unable to find a satisfying virtiofsd

    Traceback (most recent call last):
      File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in
    cb_wrapper
        callback(asyncjob, *args, **kwargs)
      File "/usr/share/virt-manager/virtManager/asyncjob.py", line 108, in tmpcb
        callback(*args, **kwargs)
      File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57,
    in newfn
        ret = fn(self, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/share/virt-manager/virtManager/object/domain.py", line 1402, in
    startup
        self._backend.create()
      File "/usr/lib/python3.11/site-packages/libvirt.py", line 1373, in create
        raise libvirtError('virDomainCreate() failed')
    libvirt.libvirtError: operation failed: Unable to find a satisfying virtiofsd
Comment 3 Joakim Tjernlund 2023-06-29 12:13:17 UTC
# cat /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json
{
  "description": "QEMU virtiofsd vhost-user-fs",
  "type": "fs",
  "binary": "/usr/libexec/virtiofsd"
}

My file appear to point to to the right file

# file /usr/libexec/virtiofsd
/usr/libexec/virtiofsd: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, stripped
Comment 4 Joakim Tjernlund 2023-06-29 12:15:32 UTC
(In reply to Joakim Tjernlund from comment #3)
> # cat /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json
> {
>   "description": "QEMU virtiofsd vhost-user-fs",
>   "type": "fs",
>   "binary": "/usr/libexec/virtiofsd"
> }
> 
> My file appear to point to to the right file
> 
> # file /usr/libexec/virtiofsd
> /usr/libexec/virtiofsd: ELF 64-bit LSB pie executable, x86-64, version 1
> (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for
> GNU/Linux 3.2.0, stripped

# qfile /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json
app-emulation/qemu: /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json
Comment 5 Michal Prívozník 2023-06-29 14:38:02 UTC
(In reply to Joakim Tjernlund from comment #4)
> # qfile /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json
> app-emulation/qemu: /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json

This is because virtiofsd used to be part of qemu.git, but was removed in commit v8.0.0-rc0~55^2~2 in favor of rust version which lives in a different project. What we need to do is have app-emulation/virtiofsd install 50-qemu-virtiofsd.json under /usr/share/qemu/vhost-user/ where libvirt expects it.
Comment 6 Larry the Git Cow gentoo-dev 2023-07-02 22:39:22 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd59e8c8dc76f8021aebaa6d7b776c5858358eab

commit cd59e8c8dc76f8021aebaa6d7b776c5858358eab
Author:     Michal Privoznik <michal.privoznik@gmail.com>
AuthorDate: 2023-06-29 14:37:35 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-07-02 22:32:56 +0000

    app-emulation/virtiofsd: Install 50-qemu-virtiofsd.json
    
    With the old virtiofsd provided by app-emulation/qemu the
    corresponding JSON file descriptor is installed by QEMU. But with
    this new rust version, we have to install it ourselves in order
    for libvirt to pick it up. To avoid conflicts with the file
    installed by app-emulation/qemu we can install it under a
    different name. And because smaller number means higher priority
    let's go with "40-qemu-virtiofsd.json" so that users with
    <app-emulation/qemu-8.0.0 can benefit from rust version of the
    daemon (if both are installed).
    
    Closes: https://bugs.gentoo.org/909372
    Signed-off-by: Michal Privoznik <michal.privoznik@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../{virtiofsd-1.5.1.ebuild => virtiofsd-1.5.1-r1.ebuild}    | 12 ++++++++++++
 app-emulation/virtiofsd/virtiofsd-9999.ebuild                | 12 ++++++++++++
 2 files changed, 24 insertions(+)
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-02 22:40:08 UTC
(In reply to Michal Prívozník from comment #5)
> (In reply to Joakim Tjernlund from comment #4)
> > # qfile /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json
> > app-emulation/qemu: /usr/share/qemu/vhost-user/50-qemu-virtiofsd.json
> 
> This is because virtiofsd used to be part of qemu.git, but was removed in
> commit v8.0.0-rc0~55^2~2 in favor of rust version which lives in a different
> project. What we need to do is have app-emulation/virtiofsd install
> 50-qemu-virtiofsd.json under /usr/share/qemu/vhost-user/ where libvirt
> expects it.

Thank you Michal!
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-21 13:33:03 UTC
This came up on the forums earlier at https://forums.gentoo.org/viewtopic-t-1164316.html, but unfortunately, neither user gave all the needed versions.

Not sure if this is actually fixed or not.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-21 13:33:31 UTC
(Also, there's a fair point about either QEMU or libvirt depending on virtiofsd, I suppose)
Comment 10 Larry the Git Cow gentoo-dev 2023-07-27 12:00:54 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a38ac0e9f9f4f6b7c0f8fbca13b6ae9256ad6ed

commit 0a38ac0e9f9f4f6b7c0f8fbca13b6ae9256ad6ed
Author:     Michal Privoznik <michal.privoznik@gmail.com>
AuthorDate: 2023-07-27 10:08:48 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-07-27 12:00:29 +0000

    app-emulation/virtiofsd: Move virtiofsd binary into /usr/libexec
    
    In one of my recent commits I've introduced JSON descriptor file
    that libvirt uses when learning about helper binaries
    (40-qemu-virtiofsd.json). What I did not realize is that the file
    tells libvirt to execute /usr/libexec/virtiofsd while our ebuilds
    install the binary under /usr/bin/.
    
    I haven't found a way to tell cargo_src_install where to install
    the binary so we have to move it 'manually'.
    
    Bug: https://bugs.gentoo.org/909372
    Closes: https://bugs.gentoo.org/911274
    Signed-off-by: Michal Privoznik <michal.privoznik@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/32062
    Signed-off-by: Sam James <sam@gentoo.org>

 .../virtiofsd/{virtiofsd-1.5.1-r1.ebuild => virtiofsd-1.5.1-r2.ebuild} | 3 +++
 .../virtiofsd/{virtiofsd-1.6.1.ebuild => virtiofsd-1.6.1-r1.ebuild}    | 3 +++
 app-emulation/virtiofsd/virtiofsd-9999.ebuild                          | 3 +++
 3 files changed, 9 insertions(+)