I'm trying to use a tool called SecGen that creates a virtual machine with a random vulnerability for hacking. I'm not using the newer repo because I've been having unrelated issues that I won't state here. Once I run ruby secgen.rb run, i encounter an error that states:
Call to virConnectOpen failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory`
With some further investigation, have noticed that the file /var/run/libvirt doesnt exist, and when I try to run systemctl start libvirtd (with or without sudo) it comes up with an error stating that it failed to start because the host is down.
A few things to note: I have installed most packages for libvirt using apt-get (including libvirt-clients, libvirt-daemon-system which includes the libvirtd command, and libvirt-dbus). Also, I've installed vagrant (also through apt-get) and Virtualbox (through apt-get and the website for windows 10). Most other files do exist for libvirt within the files.
I do apologies if this question seems vague (as a lot of you like to mention for my questions), however I couldn't find anything upon this subject other than people not finding libvirt-socket in the libvirt file, but my question is a bit more different because of the fact that the file in /var/run doesnt exist at all. I am more than willing to provide any info necessary if asked. id also like to mention I'm using Ubuntu for Windows with WSL.
Edit: Heres the error made by systemctl when starting libvirtd: System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down
/var/run/libvirtis missing whenlibvirtdis not running. Please add the precise error issued bysystemctl start libvirtdto your question, and perhaps journal messages (journalctl -u libvirtd) if they are relevant. I don't think that Vagrant and Virtualbox do anything tolibvirtd, but I do wonder whether you can run VMs of any sort in WSL.systemdcan't be used in WSL out of the box. This has been discussed on Stackoverflow. You need to find another way to startlibvirtd. There is also a Serverfault thread about running KVM in WSL2. Seems to be possible in principle, but requires work.