kubevirt: Passt network binding plugin fails on Ubuntu Noble 24.04

What happened: A clear and concise description of what the bug is.

Spin up a VM using the network binding plugin for passt interfaces following https://kubevirt.io/user-guide/network/net_binding_plugins/passt/ on Ubuntu 24.04 (Noble). The VM fails to start, citing the errors:

{"component":"virt-launcher","kind":"","level":"error","msg":"Failed to sync vmi","name":"vm-1","namespace":"vm","pos":"server.go:202","reason":"virError(Code=1, Domain=0, Message='internal error: Child process (/usr/bin/passt --one-off --socket /var/run/libvirt/qemu/run/passt/15-vm_vm-1-ua-default.socket --mac-addr 52:54:00:22:d9:3d --pid /var/run/libvirt/qemu/run/passt/15-vm_vm-1-ua-default-passt.pid --interface eth0 --log-file /var/run/kubevirt/passt.log --tcp-ports '~15000,~15001,~15004,~15006,~15008,~15009,~15020,~15021,~15053,~15090,3389,443') unexpected exit status 1: Couldn't create user namespace: Permission denied\n')","timestamp":"2024-07-12T10:25:51.627875Z","uid":"ea8dfc32-eda8-4300-9c86-0c6a201d09fb"}

The same configuration works on Ubuntu 22.04 (Jammy). It seems related to https://github.com/canonical/lxd/issues/12882:

k exec -ti -n vm virt-launcher-vm-1-786s6 -- unshare -U --mount-proc /bin/bash
unshare: unshare failed: Permission denied
command terminated with exit code 1

What you expected to happen: A clear and concise description of what you expected to happen.

VM should start with no errors.

How to reproduce it (as minimally and precisely as possible): Steps to reproduce the behavior.

Deploy a VM using passt network binding on Ubuntu (24.04) Noble. This requires multus to be installed.

Additional context: Add any other context about the problem here.

https://github.com/canonical/lxd/issues/12882 https://github.com/canonical/lxd/issues/11920

Environment:

  • KubeVirt version (use virtctl version): v1.2
  • Kubernetes version (use kubectl version): v1.28.9
  • VM or VMI specifications: N/A
  • Cloud provider or hardware configuration: https://kubevirt.io/user-guide/network/net_binding_plugins/passt/
  • OS (e.g. from /etc/os-release): Ubuntu 24.04 (Jammy)
  • Kernel (e.g. uname -a): 6.8.0-38-generic
  • Install tools: KubeVirt and Multus
  • Others: N/A

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 28 (24 by maintainers)

Most upvoted comments

@sbrivio-rh: You can’t reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

Rotten issues close after 30d of inactivity.

Why? This hasn’t been solved yet, so it shouldn’t be closed.

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

I’ve just revisited this and integrated it with app armor. If you are running k8s v1.31+ you can set the following app armour profile on the virt-launcher pod. Its based on the containerd default but gives it access to mount and userns. It also solves the known issue https://github.com/kubevirt/kubevirt/issues/4290.

I’d suggest adding a similar feature gate KubevirtAppArmorProfile to write the app armor profile to /etc/apparmor.d/kubevirt.vm and modify the security context on the virt-launcher pod to use this profile.

abi <abi/3.0>,

include <tunables/global>

profile kubevirt.passt.vm flags=(attach_disconnected) {
  include <abstractions/passt>

  # Alternatively: include <abstractions/user-tmp>
  owner /tmp/**                         w,      # tap_sock_unix_init(), pcap(),
                                                # write_pidfile(),
                                                # logfile_init()

  owner @{HOME}/**                      w,      # pcap(), write_pidfile()
  mount,
  userns,

  network,
  capability,
  file,
  umount,
  # Host (privileged) processes may send signals to container processes.
  signal (receive) peer=unconfined,
  # runc may send signals to container processes.
  signal (receive) peer=runc,
  # crun may send signals to container processes.
  signal (receive) peer=crun,

  deny @{PROC}/* w,   # deny write for all files directly in /proc (not in a subdir)
  deny @{PROC}/{[^1-9],[^1-9][^0-9],[^1-9s][^0-9y][^0-9s],[^1-9][^0-9][^0-9][^0-9]*}/** w,
  deny @{PROC}/sys/[^k]** w,  # deny /proc/sys except /proc/sys/k* (effectively /proc/sys/kernel)
  deny @{PROC}/sys/kernel/{?,??,[^s][^h][^m]**} w,  # deny everything except shm* in /proc/sys/kernel/
  deny @{PROC}/sysrq-trigger rwklx,
  deny @{PROC}/mem rwklx,
  deny @{PROC}/kmem rwklx,
  deny @{PROC}/kcore rwklx,

  deny /sys/[^f]*/** wklx,
  deny /sys/f[^s]*/** wklx,
  deny /sys/fs/[^c]*/** wklx,
  deny /sys/fs/c[^g]*/** wklx,
  deny /sys/fs/cg[^r]*/** wklx,
  deny /sys/firmware/** rwklx,
  deny /sys/devices/virtual/powercap/** rwklx,
  deny /sys/kernel/security/** rwklx,
}