Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QEmu: virtiofsd prone to be garbage collected. #113172

Closed
YellowOnion opened this issue Feb 15, 2021 · 5 comments · Fixed by #162635
Closed

QEmu: virtiofsd prone to be garbage collected. #113172

YellowOnion opened this issue Feb 15, 2021 · 5 comments · Fixed by #162635

Comments

@YellowOnion
Copy link
Contributor

Describe the bug
libvirt can't find virtfiofsd
I'm unsure how to reference virtiofsd via libvirt xml without it being garbage collected.
I'm currently hard coding nix store:

$ find /nix -name 'virtiofsd'
/nix/store/c3nr4r9ld8np3yz31circxfqipinfchq-qemu-5.2.0/libexec/virtiofsd
/nix/store/2h7s274cwhw708giflvr1p3329ypm3vr-qemu-5.2.0/libexec/virtiofsd

Expected behavior
A consistent reference to virtiofsd either via a link in /run/current-system or putting it on the $PATH.

Additional context
https://libvirt.org/kbase/virtiofs.html#host-setup

Notify maintainers
@eelco

@anton-dessiatov
Copy link
Contributor

anton-dessiatov commented Feb 15, 2021

It's not perfect, but adding the following snippet to configuration.nix does the trick for me.

  environment.systemPackages = [
    (pkgs.stdenv.mkDerivation {
      name = "virtiofsd-link";
      buildCommand = ''
        mkdir -p $out/bin
        ln -s ${pkgs.qemu}/libexec/virtiofsd $out/bin/
      '';
    })
  ];

I have the following line in my virtual machine XML to make use of it:

<binary path='/run/current-system/sw/bin/virtiofsd' xattr='on'>

@stale
Copy link

stale bot commented Aug 17, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 17, 2021
@Madouura
Copy link
Contributor

Still important to me.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 21, 2021
ckiee added a commit to ckiee/nixpkgs that referenced this issue Dec 31, 2021
Fixes NixOS#113172. This is needed to get libvirt to find the virtiofsd
binary through PATH, working around systemPackages only adding things in
/bin to PATH.
@ckiee
Copy link
Member

ckiee commented Dec 31, 2021

Sorry about the spam, I had to push to my fork in order to test it and I managed to have this crappy typo that I missed for a while.. Anyway, that PR should fix it.

alyssais added a commit to alyssais/nixpkgs that referenced this issue Mar 3, 2022
According to the QEMU documentation, virtiofsd is supposed to be run
directly by users.  It therefore makes sense to have it in bin/, so it
will be in PATH.  Such a change wouldn't make sense upstream, because
it would then conflict with the virtiofsd package, which is generally
preferred if available.  But in Nixpkgs, we don't have to worry about
that and can just make QEMU's virtiofsd a lower priority than the one
from the dedicated package.

[1]: https://qemu.readthedocs.io/en/latest/tools/virtiofsd.html

Fixes: NixOS#113172 ("QEmu: virtiofsd prone to be garbage collected.")
Fixes: NixOS#153007 ("nixos/libvirtd: add ${cfg.qemu.package}/libexec to PATH")
alyssais added a commit that referenced this issue Mar 4, 2022
According to the QEMU documentation, virtiofsd is supposed to be run
directly by users.  It therefore makes sense to have it in bin/, so it
will be in PATH.  Such a change wouldn't make sense upstream, because
it would then conflict with the virtiofsd package, which is generally
preferred if available.  But in Nixpkgs, we don't have to worry about
that and can just make QEMU's virtiofsd a lower priority than the one
from the dedicated package.

[1]: https://qemu.readthedocs.io/en/latest/tools/virtiofsd.html

Fixes: #113172 ("QEmu: virtiofsd prone to be garbage collected.")
Fixes: #153007 ("nixos/libvirtd: add ${cfg.qemu.package}/libexec to PATH")
@kvtb
Copy link
Contributor

kvtb commented May 1, 2022

That's what /run/libvirt/nix-emulators/ and /run/libvirt/nix-helpers/ are for.
To have stable links in xml files which survive upgrades of libvirt and qemu, hibernation of guests, reboots of host, GCs and all of those interleaved.

Maintaining <binary path='/run/current-system/sw/bin/virtiofsd' xattr='on'> through all XML's seems ugly

ckiee added a commit to ckiee/nixpkgs that referenced this issue May 5, 2022
Fixes NixOS#113172. This is needed to get libvirt to find the virtiofsd
binary through PATH, working around systemPackages only adding things in
/bin to PATH.
ckiee added a commit to ckiee/nixpkgs that referenced this issue Dec 12, 2022
Fixes NixOS#113172. This is needed to get libvirt to find the virtiofsd
binary through PATH, working around systemPackages only adding things in
/bin to PATH.
ckiee added a commit to ckiee/nixpkgs that referenced this issue Jan 1, 2023
Fixes NixOS#113172. This is needed to get libvirt to find the virtiofsd
binary through PATH, working around systemPackages only adding things in
/bin to PATH.
ckiee added a commit to ckiee/nixpkgs that referenced this issue Jan 12, 2023
Fixes NixOS#113172. This is needed to get libvirt to find the virtiofsd
binary through PATH, working around systemPackages only adding things in
/bin to PATH.
ckiee added a commit to ckiee/nixpkgs that referenced this issue Jan 25, 2023
Fixes NixOS#113172. This is needed to get libvirt to find the virtiofsd
binary through PATH, working around systemPackages only adding things in
/bin to PATH.
ckiee added a commit to ckiee/nixpkgs that referenced this issue Nov 14, 2023
Fixes NixOS#113172. This is needed to get libvirt to find the virtiofsd
binary through PATH, working around systemPackages only adding things in
/bin to PATH.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants