How to use podman krun with passt?

Hello,

I’m trying to start a rootless podman container in krun microvm, but with passt instead lf Transparent Socket Impersonation (TSI). I use the following podman-compose options:

services:
  <service>:
    runtime: krun
    annotations:
      krun.use_passt: 1
    security_opt:
      - no-new-privileges=true
    init: true
    (...)

The container also drops all caps.

But whatever I try, I get:

passt[...]: No interfaces with usable IPv4 routes
passt[...]: No interfaces with usable IPv6 routes
passt[...]: IPv4: no external interface as template, use local mode
passt[...]: IPv6: no external interface as template, use local mode
passt[...]: Could not open /proc/3/uid_map
passt[...]: : Permission denied
passt[...]: Couldn't configure user mappings
passt[...]: Couldn't open user namespace /proc/3/ns/user
passt[...]: : Permission denied
(...)
conmon[...]: conmon (...) <nwarn>: runtime stderr: failed configuring mounts for handler at phase: HANDLER_CONFIGURE_AFTER_MOUNTS: start passt
conmon[...]: conmon (...) <error>: Failed to create container: exit status 1

The container starts fine without krun.use_passt: 1, but then it uses TSI which I need to avoid, because the software I put inside the container does not work with it.

I have tried with network_mode: pasta, but it didn’t help either. I have also tried unmask=/proc security opt.

I did not find anything SELinux-related with journactl or ausearch.

Is there a specific thing to do in order to properly use passt with krun?

Thank you for your reply!

Yes, you will have pasta host-side, but krun will still use TSI that way.

In fact, you could add --annotation=krun.use_passt=1 to your podman run arguments and see how it fails to start the container. And if not, well, then there will be something to dig. :wink:

This is it! Thank you!

So, it should be done the following way:

services:
  <service>:
    runtime: krun
    annotations:
      krun.use_passt: 1
    network_mode: pasta
    security_opt:
      - no-new-privileges=true
    init: true
    (...)

PS. Actually, it’s a crun bug, so we’ll have to wait for crun update. Until then, the following wrapper script put in "${HOME}/.local/bin" fixes the issue:

#!/usr/bin/env bash

set -euo pipefail

if [[ -d '/proc' ]]; then
  exec unshare --mount-proc '/usr/bin/passt' "${@}"
else
  exec '/usr/bin/passt' "${@}"
fi

Well, the workaround no longer works after updating crun to 1.30-1. I guess we have to wait for a release with PR #2334.