systemd NetworkNamespacePath for rootful podman run
container
#26890
-
On Debian 12 for the past two years I've used
On occasion the container would fail to exit cleanly and an orphaned interface would remain in the myvpn namespace. A little googling led me to a systemd change between Debian 12 and 13 which now necessitates an additional 1 - Is it safe/supported for 2 - Since only netavark needs to run inside the vpn network namespace and not the rest of podman, is it possible to run only netavark inside the namespace and not all of podman? Do quadlet's I was using podman version 5.5.2 (from guix) on both Debian 12 and Debian 13. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Here's a simple way to reproduce the issue.
In a different terminal
The |
Beta Was this translation helpful? Give feedback.
-
PrivateMounts=no is 100% a requirement, your reproducer doesn't seem to use it. Different network namespaces can work but it means you must be very very careful from where you run podman commands. You cannot run podman stop/rm from a different netns and then expect the cleanup to work. Podman has no idea what the "host" namespace originally was when it created the container so it must be the same when stopping so it finds the right interfaces. In general I would strongly recommend against doing such things. If you want the container to join the vpn namespace you can use something like sysfs should not matter as we don't use it netvark, we do use /proc/sys/net tough to configure network sysctl's but AFAIK that does not require a mount namespace, it switches properly with the netns. Maybe a better option is to use vrf interfaces to route the container bridge traffic via your vpn. podman network create supports setting
No that is not how things work at all, the network create command is simply creating a json file it doesn't do anything in terms of network setup so setting namespaces there is pointless. |
Beta Was this translation helpful? Give feedback.
-
Thanks @Luap99 . I will look into the vrf option further to see if it can work for me. Directly joining with |
Beta Was this translation helpful? Give feedback.
-
Thanks again @Luap99 . I created a ticket asking if podman could support specifying the network namespace the bridge is created in. I expect it'll be closed as a wontfix since I already have a solution that works, but just putting the idea out there. Thank you for thoroughly answering my questions. |
Beta Was this translation helpful? Give feedback.
PrivateMounts=no is 100% a requirement, your reproducer doesn't seem to use it.
When you run podman in different mount namespaces you basically break all sort of mount tracking.
Different network namespaces can work but it means you must be very very careful from where you run podman commands. You cannot run podman stop/rm from a different netns and then expect the cleanup to work. Podman has no idea what the "host" namespace originally was when it created the container so it must be the same when stopping so it finds the right interfaces.
In general I would strongly recommend against doing such things. If you want the container to join the vpn namespace you can use something like
--netwo…