I have went through the steps and tested them on real device, last resort was a working WS/GW but it didnt happened without adjusting and improving the steps:
Minor Notes
Wont needed commands
[user ~/Downloads]% virsh -c qemu:///session net-autostart "default"
error: failed to get network 'default'
error: this function is not supported by the connection driver: virNetworkLookupByName
zsh: exit 1 virsh -c qemu:///session net-autostart "default"
[user ~/Downloads]% virsh -c qemu:///session net-autostart default
error: failed to get network 'default'
error: this function is not supported by the connection driver: virNetworkLookupByName
zsh: exit 1 virsh -c qemu:///session net-autostart default
[user ~/Downloads]%
Not needed, as this is only for qemu:///system.
Path must be created beforehand
mv Whonix-Gateway*.qcow2 ~/.local/share/libvirt/images/Whonix-Gateway.qcow2
mv Whonix-Workstation*.qcow2 ~/.local/share/libvirt/images/Whonix-Workstation.qcow2
Path wont be created automatically, so it must be created before hand:
mkdir -p ~/.local/share/libvirt/images
How to edit WS/GW xml (missing step)
virsh -c qemu:///session edit Whonix-Gateway
virsh -c qemu:///session edit Whonix-Worstation
Remove <blkiotune> From both GW and WS
Remove this entire block of text from both of them:
<blkiotune>
<weight>250</weight>
</blkiotune>
More clear step on how to change GW/WS connection
Default GW:
<interface type='network'>
<mac address='xx:xx:xx:xx:xx:xx'/>
<source network='Whonix-External'/>
<model type='virtio'/>
<driver name='qemu'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
<interface type='network'>
<mac address='xx:xx:xx:xx:xx:xx''/>
<source network='Whonix-Internal'/>
<model type='virtio'/>
<driver name='qemu'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
</interface>
Going to be changed to:
<interface type='user'>
<mac address='xx:xx:xx:xx:xx:xx'/>
<model type='virtio'/>
<driver name='qemu'/>
<backend type='passt'/>
<ip family='ipv4' address='172.17.5.4' prefix='24'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
<interface type='udp'>
<mac address='xx:xx:xx:xx:xx:xx'/>
<source address='127.0.0.1' port='5577'>
<local address='127.0.0.1' port='6688'/>
</source>
<model type='virtio'/>
<driver name='qemu'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
</interface>
WS configs just in case:
<interface type='udp'>
<mac address='xx:xx:xx:xx:xx:xx'/>
<source address='127.0.0.1' port='6688'>
<local address='127.0.0.1' port='5577'/>
</source>
<model type='virtio'/>
<driver name='qemu'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
Virt-Manager GUI default is qemu:///system not session
WS and GW wont be shown in the default opening of Virt-Manager, because it assumes your VMs on normal QEMU/KVM or qemu:///system, so you need to change that to QEMU/KVM user session:
Go to virt-manager → File → Add Connection → Switch Hypervisor from QEMU/KVM to QEMU/KVM user session → Connect
Bad usability: This change wont stay if you shutdown virt-manager, so you need to do that every-time you access virt-manager.
Solution to make the change permanent run:
echo "export LIBVIRT_DEFAULT_URI='qemu:///session'" >> ~/.zshrc
source ~/.zshrc
(If someone is using Bash instead of Zsh, change .zshrc to .bashrc, This tells your entire user profile including the GUI to always target your local user session by default).
Critial Notes
libvirt: error : cannot limit core file size of process 7077 to 18446744073709551615: Operation not permitted
When trying to run GW:
Error starting domain: internal error: Process exited prior to exec: libvirt: error : cannot limit core file size of process 7077 to 18446744073709551615: Operation not permitted
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 71, in cb_wrapper
callback(asyncjob, *args, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 107, 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 1384, in startup
self._backend.create()
~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3/dist-packages/libvirt.py", line 1390, in create
raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: internal error: Process exited prior to exec: libvirt: error : cannot limit core file size of process 7077 to 18446744073709551615: Operation not permitted
Why its happening: The giant number 18446744073709551615 represents RLIM_INFINITY (unlimited). When libvirt tries to set the VM process maximum core dump file size to “unlimited”, the system blocks it because unprivileged users not allowed (part of the protection in debian) to raise their own hard resource limits (setrlimit).
Since there is no root access to modify system-wide limits, then we need to tell libvirt to stop trying to adjust this limit by forcing libvirt to skip resource limits.
So we need to override the memory/core limits for QEMU inside user configuration directory:
mkdir -p ~/.config/libvirt/
nano ~/.config/libvirt/qemu.conf
Copy/Paste:
max_core = 0
max_processes = 0
max_files = 0
Then stop and start the daemon:
systemctl --user stop libvirtd.service 2>/dev/null
systemctl --user stop virtqemud.service 2>/dev/null
pkill -9 -f libvirtd
pkill -9 -f virtqemud
libvirt.libvirtError: unsupported configuration: unable to open vhost-vsock device
If you get this error when trying to run WS:
Error starting domain: unsupported configuration: unable to open vhost-vsock device
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 71, in cb_wrapper
callback(asyncjob, *args, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 107, 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 1384, in startup
self._backend.create()
~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3/dist-packages/libvirt.py", line 1390, in create
raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: unsupported configuration: unable to open vhost-vsock device
Go to virt-manager → Press on Whonix-Workstation → Then click on Open from the top bar → Press on the light bulb (Virtual hardware details) → Right-Click on VirtiO VSOCK then remove it.
WS will start normally.
@HulaHoop check if something needs to be improved further.
@Patrick i think its a good idea if we can add KVM and these configs easy by default (Windows Pro edition has hyper-v by default but user must pay for this version, KS (maybe Whonix host later) do this for free to the community).