Kicksecure Host - Shared folder not working with Whonix KVM

Yes, I wanted to clarify that I am using Kicksecure as the host operating system rather than using Kicksecure as a VM, and that I am using Whonix as a VM inside Kicksecure

No output, mounting in /mnt/workstation-shared still results in no files showing up in the shared folder unless I’m looking in the wrong place, looking in /mnt/shared in whonix don’t see anything in media either.

/home/user/shared still fails with the original error to even open the vm.

/home/shared still works fine

Whonix for KVM

sudo mkdir /home/user/shared

fixed to:

mkdir /home/user/shared

no reason to use sudo to create a folder inside the home folder. This would make the owner “root” instead of “user”. Leading to permission issues.

KVM: Difference between revisions - Whonix


With a Kicksecure Host, creating a shared folder for Whonix KVM VMs is still completely unassisted as far as the host is concerned.

Kicksecure Host with Whonix KVM VMs should be same as Kicksecure Host with Whonix KVM VMs.

The only applicable documentation chapter is Whonix for KVM

Expected. That package isn’t installed on Kicksecure Host. It’s not supposed to be either. Therefore folders /mnt/workstation-shared / /mnt/gateway-shared aren’t automatically created.

1 Like

While on kicksecure host I was able to work around this problem by putting the shared folder at /home/shared rather than anywhere in the user directory, putting at /mnt/shared yielded a successful launch but without the shared folder actually showing up in the vm.

To restate: I have never been able to solve the original problem that I could not make the shared folder as /home/user/shared because whenever I put it in the user directory even after doing chmod 777 it fails to launch due to a permission error (the same original error)

Even on a Manjaro host I get this issue, but it is even worse because while I can still open the VM with the shared folder attached to /home/shared and /mnt/shared, the shared folder does not actually appear anywhere in the vms in either case, so I can’t get the shared folder working. This problem is occuring both with KVM Kicksecure and KVM Whonix.

Perhaps I should try to fix the permission error with /home/user/shared first?

1 Like

Yes and try searching Manjaro bugtracker for tickets mentioning this

1 Like

I’ve fixed the “cannot initialize fsdev ‘fsdev-fs0’: failed to open ‘/home/user/shared’: Permission denied” problem by editing /etc/libvirt/qemu.conf and adding the line:

user = “user”

I figured this from this post I found on a similar issue on redhat forum

" Daniel Berrangé 2015-01-05 11:01:16 UTC

2014-12-15 qemu-system-x86_64: -device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=shared,bus=pci.0,addr=0x9: Virtio-9p Failed to initialize fs-driver with id:fsdev-fs0 and export path:/home/user/Documents/shared

My guess is that since the QEMU process is probably running under a qemu:qemu user/group account, it will not have permission to access /home/user/… and this then causes QEMU to shutdown."

However, now the other problem persists, while the VM now successfully launches with an attached shared folder inside the user directory, I still can’t find the shared folder anywhere in the vm. Any ideas which logs I should look at to find anything out about this or something?

1 Like

Check the kernel Kconfig in guest and host side and make sure you have the required modules

CONFIG_NET_9P=m
CONFIG_NET_9P_VIRTIO=m

Check kernel log guest side to see if there are any mounting errors during boot. Do you see anything wrong during vm boot?

1 Like

Not sure where kconfig but I’m guessing this is it in the vm

/usr/src/linux-headers-4.19.0-9-amd64/.config

shows the following:

CONFIG_NET_9P=m
CONFIG_NET_9P_VIRTIO=m

In the host I’m guessing this is it

/usr/share/grub/grub-mkconfig_lib

did not find 9p there

but sudo modprobe 9p, sudo modprobe 9pnet_virtio does not return an error
and 9p folder is located in lib modules kernel kernel fs

despite running modprobe 9p and modprobe 9pnet_virtio on the host before opening the vm, the shared folders did not show up, so it might not be this.

Could not find kernel or sys logs in /var/log/ on either my host or vm, where exactly can I find this?

Under /var/log/kern.log

Are you using Apparmor or SELinux? Sometimes the Apparmor profiles could be wrongly configured and interfere with normal VM functions.

/var/log$ ls
prints:

    alternatives.log            btmp            lastlog  tallylog    Xorg.0.log.old
    apparmor                    dpkg.log        lightdm  tor
    apt                         faillog         openvpn  wtmp
    bootclockrandomization.log  fontconfig.log  private  Xorg.0.log

I haven’t modified this, this is what is in my log directory after a fresh 15.0.1.3.4 install of Whonix kvm.

I’m using Apparmor

Follow instructions here to see f you get any access denied notifications when the guest boots up:

https://wiki.archlinux.org/index.php/AppArmor#Get_desktop_notification_on_DENIED_actions

Working according to:

type=VIRT_RESOURCE msg=audit(1592414710.025:377): pid=866 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='virt=kvm resrc=fs reason=start vm="0KS-X" uuid=b47c8674-9fac-4246-9afa-f6acdeb4497b old-fs="?" new-fs="/home/user/Documents/SharedFiles/X" exe="/usr/bin/libvirtd" hostname=? addr=? terminal=? res=success'

I think the bug is something in libvirt or qemu. Please file a bug report with Manjaro so they can take a look. I can;t help beyond this point.

1 Like

Inside the vm, what program or configuration are you using to try to automatically detect and mount the shared folder?

I posted on manjaro forum and they suggested qemu being version 5.0 is new and maybe it’s not working with that

Yep we’ve had it for some time.

@Patrick can you please show him the shared folder help code? The package was merged, but I don’t remember where.

package vm-config-dist

https://gitlab.com/whonix/vm-config-dist

Related files:

What’s happening at most is this:

sudo mkdir --parents /mnt/shared
sudo chmod 777 /mnt/shared
sudo /bin/mount -t 9p -o trans=virtio shared /mnt/shared -oversion=9p2000.L

Therefore I strongly suggest to not concentrate on vm-config-dist. It is very most likely not the cause of issues.

Once commands are known to (auto) mount a shared folder, I am happy to automate these in vm-config-dist package.

In other words: Forget about vm-config-dist. What are the commands required to auto mount the shared folder?

I uninstalled whonix & ks and then reinstalled with version 15.0.1.3.9, and now the shared folder shows up in /mnt/shared and moving files across works. Not sure what happened

2 Likes

Good! Sometimes weird stuff happens and it’s best to move on.