Skip to content

Commit

Permalink
Enable systemd mode for /usr/local/sbin/init
Browse files Browse the repository at this point in the history
Podman 1.6.2 changed systemd mode auto-detection from commands ending in
``init`` to hard-coded paths ``/sbin/init`` and ``/usr/sbin/init``. This
broke FreeIPA container. ``podman run`` and ``podman create`` now
activate systemd mode when the command is ``/usr/local/sbin/init``.

Fixes: containers#7287
Signed-off-by: Christian Heimes <[email protected]>
  • Loading branch information
tiran authored and mheon committed Aug 20, 2020
1 parent c539091 commit 76ae0c9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/source/markdown/podman-create.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,8 @@ Run container in systemd mode. The default is *true*.

The value *always* enforces the systemd mode is enforced without
looking at the executable name. Otherwise, if set to true and the
command you are running inside the container is systemd, /usr/sbin/init
or /sbin/init.
command you are running inside the container is systemd, /usr/sbin/init,
/sbin/init or /usr/local/sbin/init.

If the command you are running inside of the container is systemd,
Podman will setup tmpfs mount points in the following directories:
Expand Down
4 changes: 2 additions & 2 deletions docs/source/markdown/podman-run.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,8 @@ Run container in systemd mode. The default is **true**.

The value *always* enforces the systemd mode is enforced without
looking at the executable name. Otherwise, if set to **true** and the
command you are running inside the container is systemd, _/usr/sbin/init_
or _/sbin/init_.
command you are running inside the container is systemd, _/usr/sbin/init_,
_/sbin/init_ or _/usr/local/sbin/init_.

If the command you are running inside of the container is systemd
Podman will setup tmpfs mount points in the following directories:
Expand Down
3 changes: 2 additions & 1 deletion pkg/specgen/generate/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,14 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
}

if len(command) > 0 {
if command[0] == "/usr/sbin/init" || command[0] == "/sbin/init" || (filepath.Base(command[0]) == "systemd") {
if command[0] == "/usr/sbin/init" || command[0] == "/sbin/init" || command[0] == "/usr/local/sbin/init" || (filepath.Base(command[0]) == "systemd") {
useSystemd = true
}
}
default:
return nil, errors.Wrapf(err, "invalid value %q systemd option requires 'true, false, always'", s.Systemd)
}
logrus.Debugf("using systemd mode: %t", useSystemd)
if useSystemd {
// is StopSignal was not set by the user then set it to systemd
// expected StopSigal
Expand Down
2 changes: 1 addition & 1 deletion pkg/varlinkapi/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
if err != nil {
return nil, errors.Wrapf(err, "cannot parse bool %s", c.String("systemd"))
}
if x && (command[0] == "/usr/sbin/init" || command[0] == "/sbin/init" || (filepath.Base(command[0]) == "systemd")) {
if x && (command[0] == "/usr/sbin/init" || command[0] == "/sbin/init" || command[0] == "/usr/local/sbin/init" || (filepath.Base(command[0]) == "systemd")) {
systemd = true
}
}
Expand Down

0 comments on commit 76ae0c9

Please sign in to comment.