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

The podman generate systemd command generated the wrong file. #9373

Closed
daiaji opened this issue Feb 15, 2021 · 3 comments · Fixed by #9375
Closed

The podman generate systemd command generated the wrong file. #9373

daiaji opened this issue Feb 15, 2021 · 3 comments · Fixed by #9375
Assignees
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

@daiaji
Copy link

daiaji commented Feb 15, 2021

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

/kind bug

Description
The podman generate systemd command generated the wrong file.
This usually only occurs in the cgroups v2 environment, it does not seem to happen in the cgroups v1 environment.

Steps to reproduce the issue:

1.podman pod create --name test-pod

2.podman run -d --name test --pod test-pod docker.io/hello-world

3.cat ~/.config/systemd/user/container-test.service

Describe the results you received:

# container-test.service
# autogenerated by Podman 3.0.0
# Mon Feb 15 22:05:59 CST 2021

[Unit]
Description=Podman container-test.service
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
BindsTo=pod-test-pod.service
After=pod-test-pod.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/container-test.pid %t/container-test.ctr-id
ExecStart=/usr/bin/podman run --conmon-pidfile %t/container-test.pid --cidfile %t/container-test.ctr-id --cgroups=no-conmon --pod-id-file %%t/pod-test-pod.pod-id --replace -d --name test docker.io/hello-world
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-test.ctr-id -t 10
ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-test.ctr-id
PIDFile=%t/container-test.pid
Type=forking

[Install]
WantedBy=multi-user.target default.target

--pod-id-file %%t/pod-test-pod.pod-id
The content of line 21 is obviously wrong.
When I changed %%t to %t, everything seemed to be normal.

Describe the results you expected:

Let the podman generate systemd command work properly.

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

Output of podman version:

podman version
Version:      3.0.0
API Version:  3.0.0
Go Version:   go1.15.8
Git Commit:   5b2585f5e91ca148f068cefa647c23f8b1ade622
Built:        Fri Feb 12 06:22:46 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.19.2
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.0.26-1
    path: /usr/bin/conmon
    version: 'conmon version 2.0.26, commit: 0e155c83aa739ef0a0540ec9f9d265f57f68038b'
  cpus: 1
  distribution:
    distribution: manjaro
    version: unknown
  eventLogger: journald
  hostname: vps
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 10000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 10000
      size: 65536
  kernel: 5.10.16-1-MANJARO
  linkmode: dynamic
  memFree: 10375168
  memTotal: 498393088
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 0.17-1
    path: /usr/bin/crun
    version: |-
      crun version 0.17
      commit: 0e9229ae34caaebcb86f1fde18de3acaf18c6d9a
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    selinuxEnabled: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.8-1
    version: |-
      slirp4netns version 1.1.8
      commit: d361001f495417b880f20329121e3aa431a8f90f
      libslirp: 4.4.0
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.1
  swapFree: 439668736
  swapTotal: 498388992
  uptime: 45m 18.56s
registries:
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  configFile: /home/test/.config/containers/storage.conf
  containerStore:
    number: 7
    paused: 0
    running: 6
    stopped: 1
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: /usr/bin/fuse-overlayfs is owned by fuse-overlayfs 1.4.0-1
      Version: |-
        fusermount3 version: 3.10.2
        fuse-overlayfs: version 1.4
        FUSE library version 3.10.2
        using FUSE kernel interface version 7.31
  graphRoot: /home/test/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 7
  runRoot: /run/user/1000/containers
  volumePath: /home/test/.local/share/containers/storage/volumes
version:
  APIVersion: 3.0.0
  Built: 1613082166
  BuiltTime: Fri Feb 12 06:22:46 2021
  GitCommit: 5b2585f5e91ca148f068cefa647c23f8b1ade622
  GoVersion: go1.15.8
  OsArch: linux/amd64
  Version: 3.0.0

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

Name            : podman
Version         : 3.0.0-1
Description     : Tool and library for running OCI-based containers in pods
Architecture    : x86_64
URL             : https://github.com/containers/libpod
Licenses        : Apache
Groups          : None
Provides        : None
Depends On      : cni-plugins  conmon  containers-common  device-mapper  iptables  libseccomp  runc  slirp4netns  libsystemd  fuse-overlayfs  libgpgme.so=11-64
Optional Deps   : podman-docker: for Docker-compatible CLI
                  btrfs-progs: support btrfs backend devices [installed]
                  catatonit: --init flag support
                  crun: support for unified cgroupsv2 [installed]
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 79.32 MiB
Packager        : Morten Linderud <[email protected]>
Build Date      : Fri Feb 12 06:22:46 2021
Install Date    : Mon Feb 15 17:42:49 2021
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

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

KVM

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 15, 2021
@Luap99 Luap99 self-assigned this Feb 15, 2021
@vrothberg
Copy link
Member

Thanks for reaching out!

@Luap99 already self-assigned, so expect a fix in the next few minutes :-)

@daiaji
Copy link
Author

daiaji commented Feb 15, 2021

Thanks for reaching out!

@Luap99 already self-assigned, so expect a fix in the next few minutes :-)

Is there a lack of testing for pod function? In fact, I have encountered more pod function bugs (compared with not using pod function).

@Luap99
Copy link
Member

Luap99 commented Feb 15, 2021

I opened #9375 to fix this issue. It is a recent regression introduced in #9178.

Luap99 pushed a commit to Luap99/libpod that referenced this issue Feb 16, 2021
The unit generation accidentally escaped the %t in the pod id file path.
This is a regression caused by containers#9178. This was not caught by the tests
because the test itself was wrong. It used a full path instead of the
systemd variable %t like the actual code does.

Fixes containers#9373

Signed-off-by: Paul Holzinger <[email protected]>
mheon pushed a commit to mheon/libpod that referenced this issue Feb 18, 2021
The unit generation accidentally escaped the %t in the pod id file path.
This is a regression caused by containers#9178. This was not caught by the tests
because the test itself was wrong. It used a full path instead of the
systemd variable %t like the actual code does.

Fixes containers#9373

Signed-off-by: Paul Holzinger <[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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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.

4 participants