Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--systemd=true auto-detection should consider /usr/local/sbin/init #7287

Closed
tiran opened this issue Aug 11, 2020 · 0 comments · Fixed by #7288
Closed

--systemd=true auto-detection should consider /usr/local/sbin/init #7287

tiran opened this issue Aug 11, 2020 · 0 comments · Fixed by #7288
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@tiran
Copy link
Contributor

tiran commented Aug 11, 2020

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

podman run defaults to --systemd=true. With --systemd=true podman checks whether the command is either /sbin/init, /usr/sbin/init, or systemd.

if len(command) > 0 {
if command[0] == "/usr/sbin/init" || command[0] == "/sbin/init" || (filepath.Base(command[0]) == "systemd") {
useSystemd = true
}
}

The check was introduced in podman 1.6.2. Previously podman only checked that the command ended in init or systemd. The change broke FreeIPA container. Our containes uses a custom shell script at /usr/local/sbin/init that prepares the system and then execs systemd at /sbin/init. The container used to run fine with older versions of podman. It took our team a while to realize that more recent versions of podman no longer active systemd support with --systemd=true for our container. We thought that --systemd=true always activates systemd support. At first it didn't occur to us that it merely activates systemd detection mode. @frasertweedale eventually connected the dots when he saw a BZ comment with --systemd=always.

Steps to reproduce the issue:

  1. sudo podman run --rm --name freeipa-server-container -ti -h ipa.example.test --sysctl net.ipv6.conf.all.disable_ipv6=0 -v /var/lib/ipa-data:/data:Z -v /etc/machine-id:/etc/machine-id:ro --read-only --systemd=true freeipa-server

Describe the results you received:

Container fails to start with error message:

systemd v245.7-1.fc32 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified)
Detected virtualization podman.
Detected architecture x86-64.
Set hostname to <ipa.example.test>.
Failed to create /init.scope control group: Read-only file system
Failed to allocate manager object: Read-only file system
[!!!!!!] Failed to allocate manager object.
Exiting PID 1...

Describe the results you expected:

FreeIPA container should start and work.

Additional information you deem important (e.g. issue happens only occasionally):

The container starts correctly with --systemd=always.

Please extend systemd auto-detection to include /usr/local/sbin/init. It would also be helpful to print a debug message whether podman has detected systemd or not.

Output of podman version:

Version:      2.0.4
API Version:  1
Go Version:   go1.14.6
Built:        Thu Jan  1 01:00:00 1970
OS/Arch:      linux/amd64

1.6.4 is also affected

Package info (e.g. output of rpm -q podman or apt list podman):

podman-2.0.4-1.fc32.x86_64

Additional environment details (AWS, VirtualBox, physical, etc.):

n/a/

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 11, 2020
tiran added a commit to tiran/podman that referenced this issue Aug 11, 2020
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]>
mheon pushed a commit to mheon/libpod that referenced this issue Aug 17, 2020
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]>
mheon pushed a commit to mheon/libpod that referenced this issue Aug 20, 2020
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]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants