Recently I started running into the following error shutting down
containers with podman stop:
* rootless netns: kill network process: permission denied
This error is produced by
golang-github-containers-common/libnetwork/internal/rootlessnetns/netns_linux.go
in the cleanup function:
if err := n.cleanupRootlessNetns(); err != nil {
multiErr = multierror.Append(multiErr, wrapError("kill network process", err))
}
And that function effectively just finds and kills the pasta or
slirp4netns process:
if err == nil {
// kill the slirp/pasta process so we do not leak it
err = unix.Kill(pid, unix.SIGTERM)
if err == unix.ESRCH {
err = nil
}
Looking at my kernel logs, I see that
[ 462.337636] audit: type=1400 audit(1741711021.533:118): apparmor="DENIED" ope
ration="signal" class="signal" profile="pasta" pid=4552 comm="exe" requested_mas
k="receive" denied_mask="receive" signal=term peer="podman"
In other words, apparmor is preventing podman from cleaning up pasta.
Podman is effectively supposed to be unconfined:
Quoting /etc/apparmor.d/podman:
# This profile allows everything and only exists to give the
# application a name instead of having the label "unconfined"
Although it turns out it's not really true that podman can do anything because it turns out that the base abstraction specifically special
cases the unconfined profile:
(quoting /etc/apparmor.d/base)
# Allow unconfined processes to send us signals by default
signal (receive) peer=unconfined,
# Allow us to signal ourselves
signal peer=@{profile_name},
# Checking for PID existence is quite common so add it by default for now
signal (receive, send) set=("exists"),
So, in other words, podman could send the signal if it were in the
unconfined profile, but cannot because it has a profile at all.
There's clearly a race condition involved somewhere. Some of my
containers exhibit this behavior, but some do not.
However, once it starts happening, it keeps happening, and it is common enough that it is breaking a lot of automation.
On the apparmor side, I'd like to either see the bogus/empty podman
profile removed or to see signals from podman permitted by the pasta profile.
On Wed, 12 Mar 2025 14:41:14 +0100
intrigeri <intrigeri@debian.org> wrote:
Thanks for fixing the address, yes, I didn't get the original report.
- It'll be necessary on Ubuntu, where removing the podman profile is
not an option. It's not needed *yet* solely because the profile is
not included in the Ubuntu package, which I'm guessing is a mistake
that will be fixed at some point
(https://bugs.launchpad.net/ubuntu/+source/passt/+bug/2077158).
So we can as well fix this proactively. And the fix should probably
be upstreamed.
I'm not sure what fix you mean here, but Launchpad #2077158 is already
fixed on Debian, and there's no further fix needed upstream.
If we don't do that, then I'm fine with removing the podman profile,
which has limited value anyway in the context of Debian.
Well, eventually, it would make sense to have an actual profile, I
guess.
Anyway, let me know. If somebody is willing to add to change Podman's
profile in the way I mentioned (I can also submit a merge request
eventually, but that will be in a while), I'd prefer that, but I can
also just add a rule in pasta's profile for the moment.
Actually, if you need something quick, you don't really need a
complete/real profile for Podman. You can just add to the current stub (untested, but I'm fairly confident):
On Thu, 13 Mar 2025 18:18:28 +0100
intrigeri <intrigeri@debian.org> wrote:
So at this stage, as far as Debian Trixie is concerned, I'm now
tempted to simply remove the stub podman profile from the apparmor
package: it seems none of us is super comfortable with the workaround
they would have to carry to make it play nicer with pasta. And we
would not be losing much value for our users.
If we lose zero value (do we? what's the value of the stub?) then I
would go ahead with that, definitely.
package: apparmor
version: 4.1.0~beta5-3
severity: important
x-debbugs-cc: podman@packages.debian.org, pasta@packages.debian.org, golang-github-containers-common@packages.debian.org, tim.miller@hadronindustries.com
Recently I started running into the following error shutting down
containers with podman stop:
* rootless netns: kill network process: permission denied
This error is produced by
golang-github-containers-common/libnetwork/internal/rootlessnetns/netns_linux.go
in the cleanup function:
if err := n.cleanupRootlessNetns(); err != nil {
multiErr = multierror.Append(multiErr, wrapError("kill network process", err))
}
And that function effectively just finds and kills the pasta or
slirp4netns process:
if err == nil {
// kill the slirp/pasta process so we do not leak it
err = unix.Kill(pid, unix.SIGTERM)
if err == unix.ESRCH {
err = nil
}
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 483 |
Nodes: | 16 (2 / 14) |
Uptime: | 84:23:12 |
Calls: | 9,576 |
Calls today: | 7 |
Files: | 13,666 |
Messages: | 6,143,357 |
Posted today: | 2 |