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

Cannot call GetContainerStats through varlink for rootless containers #3749

Closed
marusak opened this issue Aug 7, 2019 · 2 comments · Fixed by #3753
Closed

Cannot call GetContainerStats through varlink for rootless containers #3749

marusak opened this issue Aug 7, 2019 · 2 comments · Fixed by #3753
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

@marusak
Copy link
Contributor

marusak commented Aug 7, 2019

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

/kind bug

Description
I cannot call GetContainerStats through varlink for rootless containers. It works for root containers.

Steps to reproduce the issue:

  1. Execute
/usr/bin/podman varlink -t 100000 unix:/run/user/1000/podman/io.podman

in one terminal

  1. Start a new user owned container in another terminal
    podman run -dit --name foobar fedora

  2. Try to get stats
    varlink call unix:/run/user/1000/podman/io.podman/io.podman.GetContainerStats '{ "name": "foobar" }'

Describe the results you received:

{
  "reason": "unable to load cgroup at /libpod_parent/libpod-4e9f3f856cdd2d1cb9d50d5daa12d06d1a258f0ad2c692316c438e2586399163: cgroups: cgroup deleted"
}

Describe the results you expected:
Expected proper stats about the container

Additional information you deem important (e.g. issue happens only occasionally):
Works fine for root contianers:

$ sudo /usr/bin/podman varlink -t 100000 unix:/run/podman/io.podman
$ sudo podman run -dit --name foobar fedora
$ sudo  varlink call unix:/run/podman/io.podman/io.podman.GetContainerStats '{ "name": "foobar" }'
{
  "container": {
    "block_input": 0,
    "block_output": 0,
    "cpu": 5.325716717611001679778e-08,
    "cpu_nano": 208393314,
    "id": "f2b57dda297602034f20fb6f9e73e39dfbd866201374eab172384659bbe12e8a",
    "mem_limit": 16452386816,
    "mem_perc": 1.481316982913319715842e-02,
    "mem_usage": 2437120,
    "name": "foobar",
    "net_input": 628,
    "net_output": 11184,
    "pids": 1,
    "system_nano": 0
  }
}

Also works fine for other methods like ListContainers for rootless containers.

Output of podman version:

Version:            1.4.4
RemoteAPI Version:  1
Go Version:         go1.12.7
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: ""
  go version: go1.12.7
  podman version: 1.4.4
host:
  BuildahVersion: 1.9.0
  Conmon:
    package: podman-1.4.4-4.fc30.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.0.0-dev, commit: 164df8af4e62dc759c312eab4b97ea9fb6b5f1fc'
  Distribution:
    distribution: fedora
    version: "30"
  MemFree: 4705746944
  MemTotal: 16452386816
  OCIRuntime:
    package: containerd.io-1.2.1-2.0.rc.0.1.fc29.x86_64
    path: /usr/sbin/runc
    version: |-
      runc version 1.0.0-rc5+dev
      commit: 10d38b660a77168360df3522881e2dc2be5056bd
      spec: 1.0.1-dev
  SwapFree: 0
  SwapTotal: 0
  arch: amd64
  cpus: 4
  hostname: trv1819.localdomain
  kernel: 5.1.20-300.fc30.x86_64
  os: linux
  rootless: true
  uptime: 21h 36m 54.73s (Approximately 0.88 days)
registries:
  blocked: null
  insecure: null
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /home/mmarusak/.config/containers/storage.conf
  ContainerStore:
    number: 6
  GraphDriverName: overlay
  GraphOptions:
  - overlay.mount_program=/usr/bin/fuse-overlayfs
  GraphRoot: /home/mmarusak/.local/share/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 6
  RunRoot: /run/user/1000
  VolumePath: /home/mmarusak/.local/share/containers/storage/volumes

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 7, 2019
@mheon
Copy link
Member

mheon commented Aug 7, 2019

Stats does not work for rootless right now, as it requires the container to have CGroups - rootless containers presently do not have privileges to create their own.

With the crun OCI runtime and a CGroups v2 enabled system, this may work - @giuseppe

@baude baude self-assigned this Aug 7, 2019
@baude
Copy link
Member

baude commented Aug 7, 2019

i will add a proper error response.

baude added a commit to baude/podman that referenced this issue Aug 12, 2019
obtaining containerstats requires the use of cgroups. at present,
rootless users do not have privileges to create cgroups.  add an error
message that catches this for the varlink endpoint and return a proper
error.

Fixes: containers#3749

Signed-off-by: baude <[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.

4 participants