podman icon indicating copy to clipboard operation
podman copied to clipboard

podman doesn't honour `init_path` for its pause containers

Open gso-gso opened this issue 3 years ago • 18 comments

Issue Description

Changing the init_path parameter in container.conf results in containers using a different init binary than the default (catatonit). However, pause containers created within pods still require catatonit (unless infra_image is explicitly passed). This generates an error if catatonit is not found in the system.

NOTE: since catatonit is GPLv3, it must be replaced in some systems.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Install an alternative container init system (e.g. tini) and uninstall catatonit
  2. Point init_path to the new init binary (e.g. /usr/bin/tini)
  3. Launch a pod (e.g. podman kube play manifest.yml)

Describe the results you received

Error: image for service container: building local pause image: finding pause binary: exec: "catatonit": executable file not found in $PATH

Describe the results you expected

The pod starts normally, using the new init system for the containers.

podman info output

podman >= 4

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

gso-gso avatar Jun 22 '23 11:06 gso-gso

Interested in opening a PR to fix?

rhatdan avatar Jun 22 '23 12:06 rhatdan

Sure, but I'd like to hear your thoughts on what the best approach would be. Currently you are using catatonit's -P flag to start a pause container. However most alternative init systems do not have this flag.

Also do you want catatonit to be a hard dependency of podman? If so, an alternative approach would be to re-license catatonit to Apache.

gso-gso avatar Jun 22 '23 12:06 gso-gso

I think the solution here is to build your own image and then use that as infra_image in containers.conf, you can even customize the command with infra_command.

We cannot use a generic init binary. The -P to catatonit was added to support this use case. And I don't think it makes sense to support another init system for building the pause image. In fact, the init system is not even needed for the infra container, we need just a process that sits there and keeps the namespaces alive.

e.g. you could do:

infra_command = "top"
infra_image = "alpine"

giuseppe avatar Jun 23 '23 08:06 giuseppe

Ok since @giuseppe gave a solution, I am closing. Feel free to continue the conversation here.

rhatdan avatar Jun 23 '23 10:06 rhatdan

@giuseppe you're right that the init system is not directly related to the pause container, conceptually. But how it's currently set up both are entangled:

  1. From a user perspective the current behavior is unexpected. The user changes init_path to replace the init system and immediately gets an error that catatonit is not found.
  2. infra_command and infra_image become not just options, but required arguments when init_path is changed?
  3. Some environments cannot rely on an additional image being available. They may not even have an internet connection to pull it from either, e.g. building locally from scratch

I see two approaches here:

  • If catatonit is seen as a hard dependency of podman (because of default pause containers), then it should always be present in the system. Either merge it into podman or license it equally.
  • If it's not a hard dependency, provide a default pause container that is not based on it.

Please let me know your thoughts

gso-gso avatar Jun 23 '23 12:06 gso-gso

@cyphar WDYT on the license?

rhatdan avatar Jun 23 '23 13:06 rhatdan

I think this is a fair issue. While it's relatively straight forward to install e.g. tini and override init_path, it's not so easy to replace the use of catatonit in the infra container. The fact that Podman can build the pause container image internally is very convenient. Like @gsalvatella mentioned, needing to pull an extra image can become a bit of a burden. So it's a bit unfortunate that Podman is hard wired to use catatonit for this (given its license).

we need just a process that sits there and keeps the namespaces alive.

Looking at the pause process used in the Kubernetes pause containers, and it seems to take on the role of an init / process reaper as well. Not quite sure if / why that's needed. But replacing catatonit with that static pause binary seems to work, i.e. Podman can start pods with the self-generated pause container.

Would it make sense to offer an option to specify an alternative executable for generating the pause container? Or maybe even bake such a pause process into podman, to lighten this GPL3 dependency.

Arctize avatar Jun 23 '23 14:06 Arctize

we've picked catatonit because it is already a dependency for Podman, and it is a static binary. There is no pause process on the host that we can reuse. The same podman binary cannot be used since it has a lot of dynamic dependencies, as well as conmon.

I don't see a way to use tini or any other simple init program unless we add another feature there. There is no generic way to let them sit idle and replace the pause process.

So how exactly would you expect podman to behave in this case?

I still think you can build your image locally and use that for the infra container when you need such a level of control.

giuseppe avatar Jun 23 '23 14:06 giuseppe

If re-licensing is out of the question, could an alternative be using an additional binary that does just the pausing? It would be extremely simple and decouple the init system from the default pause container.

gso-gso avatar Jun 23 '23 14:06 gso-gso

You could do this yourself and just store it where catatonit is installed.

rhatdan avatar Jun 23 '23 15:06 rhatdan

Sure, but it would still be a hack. Users won't expect that changing the init system breaks their application because pause containers can't be started anymore. Why not properly separating these concerns?

gso-gso avatar Jun 23 '23 15:06 gso-gso

Mainly because this is the first time this concern was raised Most users are fine with gplv3 code and use catonit. If you want to change the way it works, I suggest you open a PR and handle all the corner cases.

rhatdan avatar Jun 23 '23 15:06 rhatdan

let's try the simplest thing first :) @cyphar, would you have problems relicensing catatonit to gplv2+?

giuseppe avatar Jun 23 '23 15:06 giuseppe

@rhatdan I'd be ok with it :smiley:, but sure, let's see if the most direct approach works first...

gso-gso avatar Jun 23 '23 16:06 gso-gso

I would have to ask all of the other contributors whether they'd be willing to relicense it. Let me take a look at how feasible that is... (I might go with MPLv2 or something.)

cyphar avatar Jun 24 '23 12:06 cyphar

AFAICS, aside from @vrothberg and @giuseppe and a SUSE guy there's only one other contributor to catatonit.c (who submitted a trivial-but-correct one-line patch). We can try to ping them to ask if they would be okay with changing the license (though I think legally speaking we wouldn't actually need their approval, it's much better to be safe than sorry).

cyphar avatar Jun 24 '23 12:06 cyphar

@cyphar There's actually an issue opened there for more than a year now. Maybe you want to discuss it there?

gso-gso avatar Jun 26 '23 05:06 gso-gso

@cyphar I am OK :+1:

vrothberg avatar Jun 26 '23 06:06 vrothberg