Hi all,
I was trying out some virtualization this weekend trying to get virt-manager flatpak running (unsuccessfully). Though somehow that messed up permissions somewhere and I’m unsure where to look.
I’m running a cockpit VM that just exists:
Cockpit bots/vm-run
📦[spytec@cockpit]/var/home/spytec/projects/cockpit/cockpit% bots/vm-run -s cockpit.socket fedora-41 -v
qemu-img create -q -f qcow2 -b /var/home/spytec/projects/cockpit/cockpit/test/images/fedora-41 -F qcow2 /run/host/var/tmp/bots-run/cockpit-xb_353l0.qcow2
+ ! test -f /run/nologin && cat /proc/sys/kernel/random/boot_id
# systemctl enable --now cockpit.socket
+ systemctl enable --now cockpit.socket
Created symlink '/etc/systemd/system/sockets.target.wants/cockpit.socket' → '/usr/lib/systemd/system/cockpit.socket'.
SSH ACCESS
$ ssh -p 2201 -i bots/machine/identity root@127.0.0.2
COCKPIT
https://127.0.0.2:9091
Username: admin
Password: foobar
[ ^C to terminate ]
📦[spytec@cockpit]/var/home/spytec/projects/cockpit/cockpit%
That should create a VM for me, but journalctl says:
journalctl -f
mar 10 14:06:05 sabre audit[20210]: USER_START pid=20210 uid=1000 auid=1000 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_limits,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
mar 10 14:06:05 sabre systemd[20303]: Created slice session.slice - User Core Session Slice.
mar 10 14:06:05 sabre systemd[20303]: Starting dbus-broker.service - D-Bus User Message Bus...
mar 10 14:06:05 sabre dbus-broker-launch[20326]: Policy to allow eavesdropping in /usr/share/dbus-1/session.conf +31: Eavesdropping is deprecated and ignored
mar 10 14:06:05 sabre dbus-broker-launch[20326]: Policy to allow eavesdropping in /usr/share/dbus-1/session.conf +33: Eavesdropping is deprecated and ignored
mar 10 14:06:05 sabre systemd[20303]: Started dbus-broker.service - D-Bus User Message Bus.
mar 10 14:06:05 sabre dbus-broker-launch[20326]: Ready
mar 10 14:06:08 sabre virtqemud[20418]: libvirt version: 10.1.0, package: 4.fc40 (Fedora Project, 2024-08-27-14:14:13, )
mar 10 14:06:08 sabre virtqemud[20418]: hostname: sabre
mar 10 14:06:08 sabre virtqemud[20418]: internal error: Unable to get system bus connection: Could not connect: No such file or directory
mar 10 14:06:09 sabre virtqemud[20418]: Domain id=1 name='fedora-41-127.0.0.2-2201' uuid=ac5e05a9-6131-4126-80d4-31cb78d4c135 is tainted: custom-argv
mar 10 14:06:14 sabre systemd[1]: flatpak-system-helper.service: Deactivated successfully.
mar 10 14:06:14 sabre audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=flatpak-system-helper comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
mar 10 14:06:16 sabre virtqemud[20418]: missing device in NIC_RX_FILTER_CHANGED event
mar 10 14:06:16 sabre virtqemud[20418]: missing device in NIC_RX_FILTER_CHANGED event
mar 10 14:06:21 sabre systemd[1]: Starting virtqemud.service - libvirt QEMU daemon...
mar 10 14:06:21 sabre systemd[1]: Started virtqemud.service - libvirt QEMU daemon.
mar 10 14:06:21 sabre audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=virtqemud comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
mar 10 14:06:21 sabre audit[20770]: AVC avc: denied { search } for pid=20770 comm="rpc-virtqemud" name="20765" dev="proc" ino=110753 scontext=system_u:system_r:virtqemud_t:s0 tcontext=unconfined_u:unconfined_r:spc_t:s0 tclass=dir permissive=1
mar 10 14:06:21 sabre audit[20770]: AVC avc: denied { read } for pid=20770 comm="rpc-virtqemud" name="stat" dev="proc" ino=98259 scontext=system_u:system_r:virtqemud_t:s0 tcontext=unconfined_u:unconfined_r:spc_t:s0 tclass=file permissive=1
mar 10 14:06:21 sabre audit[20770]: AVC avc: denied { open } for pid=20770 comm="rpc-virtqemud" path="/proc/20765/stat" dev="proc" ino=98259 scontext=system_u:system_r:virtqemud_t:s0 tcontext=unconfined_u:unconfined_r:spc_t:s0 tclass=file permissive=1
mar 10 14:06:23 sabre systemd[1]: Starting setroubleshootd.service - SETroubleshoot daemon for processing new SELinux denial logs...
mar 10 14:06:23 sabre systemd[1]: Started setroubleshootd.service - SETroubleshoot daemon for processing new SELinux denial logs.
mar 10 14:06:23 sabre audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=setroubleshootd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
mar 10 14:06:23 sabre systemd[1]: Started dbus-:1.3-org.fedoraproject.SetroubleshootPrivileged@2.service.
mar 10 14:06:23 sabre audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dbus-:1.3-org.fedoraproject.SetroubleshootPrivileged@2 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
mar 10 14:06:24 sabre SetroubleshootPrivileged.py[20853]: failed to retrieve rpm info for path '/etc/selinux/targeted/active/modules/100/virt':
mar 10 14:06:24 sabre setroubleshoot[20816]: SELinux is preventing rpc-virtqemud from search access on the directory 20765. For complete SELinux messages run: sealert -l 01ade45a-f9e2-4a33-8561-cd7ea203c8b5
mar 10 14:06:24 sabre setroubleshoot[20816]: SELinux is preventing rpc-virtqemud from search access on the directory 20765.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that rpc-virtqemud should be allowed search access on the 20765 directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'rpc-virtqemud' --raw | audit2allow -M my-rpcvirtqemud
# semodule -X 300 -i my-rpcvirtqemud.pp
mar 10 14:06:24 sabre setroubleshoot[20816]: SELinux is preventing rpc-virtqemud from read access on the file stat. For complete SELinux messages run: sealert -l a512a410-6c68-4037-af79-df206ceeadd1
mar 10 14:06:24 sabre setroubleshoot[20816]: SELinux is preventing rpc-virtqemud from read access on the file stat.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that rpc-virtqemud should be allowed read access on the stat file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'rpc-virtqemud' --raw | audit2allow -M my-rpcvirtqemud
# semodule -X 300 -i my-rpcvirtqemud.pp
mar 10 14:06:24 sabre setroubleshoot[20816]: SELinux is preventing rpc-virtqemud from open access on the file /proc/<pid>/stat. For complete SELinux messages run: sealert -l 1cbc196c-c256-45e3-bf33-c94cae64f76c
mar 10 14:06:24 sabre setroubleshoot[20816]: SELinux is preventing rpc-virtqemud from open access on the file /proc/<pid>/stat.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that rpc-virtqemud should be allowed open access on the stat file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'rpc-virtqemud' --raw | audit2allow -M my-rpcvirtqemud
# semodule -X 300 -i my-rpcvirtqemud.pp
Checking one of the errors with sealert gives me this
sealert -l 01ade45a-f9e2-4a33-8561-cd7ea203c8b5
~/projects/cockpit
❯ sealert -l 01ade45a-f9e2-4a33-8561-cd7ea203c8b5
SELinux is preventing rpc-virtqemud from search access on the directory 20765.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that rpc-virtqemud should be allowed search access on the 20765 directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'rpc-virtqemud' --raw | audit2allow -M my-rpcvirtqemud
# semodule -X 300 -i my-rpcvirtqemud.pp
Additional Information:
Source Context system_u:system_r:virtqemud_t:s0
Target Context unconfined_u:unconfined_r:spc_t:s0
Target Objects 20765 [ dir ]
Source rpc-virtqemud
Source Path rpc-virtqemud
Port <Unknown>
Host sabre
Source RPM Packages
Target RPM Packages
SELinux Policy RPM selinux-policy-targeted-41.33-1.fc41.noarch
Local Policy RPM
Selinux Enabled True
Policy Type targeted
Enforcing Mode Enforcing
Host Name sabre
Platform Linux sabre 6.13.5-102.bazzite.fc41.x86_64 #1 SMP
PREEMPT_DYNAMIC Fri Feb 28 10:23:59 UTC 2025
x86_64
Alert Count 9
First Seen 2025-03-10 12:53:51 CET
Last Seen 2025-03-10 14:06:21 CET
Local ID 01ade45a-f9e2-4a33-8561-cd7ea203c8b5
Raw Audit Messages
type=AVC msg=audit(1741611981.227:360): avc: denied { search } for pid=20770 comm="rpc-virtqemud" name="20765" dev="proc" ino=110753 scontext=system_u:system_r:virtqemud_t:s0 tcontext=unconfined_u:unconfined_r:spc_t:s0 tclass=dir permissive=1
Hash: rpc-virtqemud,virtqemud_t,spc_t,dir,search
Any ideas where to look?