We are observing the following errors when running nginx-agent in a rootless container:
time="2023-01-31T08:40:56Z" level=warning msg="Log level is info"
time="2023-01-31T08:40:56Z" level=info msg="setting displayName to nginx-agent-0b9264a946b3"
time="2023-01-31T08:40:56Z" level=info msg="NGINX Agent v2.22.1 at a0f380fa with pid 4, clientID=bf225f89-f4a9-3768-b747-d3ba66c8c177 name=nginx-agent-0b9264a946b3 features=[features_registration features_nginx-config features_nginx-ssl-config features_nginx-counting features_nginx-config-async features_metrics features_metrics-throttle features_dataplane-status features_process-watcher features_file-watcher features_activity-events features_agent-api]"
time="2023-01-31T08:40:56Z" level=info msg="Attempting to run command: /usr/sbin/nginx with args -V"
time="2023-01-31T08:40:56Z" level=info msg="Agent API not configured"
time="2023-01-31T08:40:56Z" level=info msg="Commander initializing"
time="2023-01-31T08:40:56Z" level=info msg="FileWatcher initializing"
time="2023-01-31T08:40:56Z" level=info msg="FileWatchThrottle initializing"
time="2023-01-31T08:40:56Z" level=info msg="MetricsSender initializing"
time="2023-01-31T08:40:56Z" level=info msg="NginxBinary initializing"
time="2023-01-31T08:40:56Z" level=info msg="OneTimeRegistration initializing"
time="2023-01-31T08:40:56Z" level=info msg="Registering bf225f89-f4a9-3768-b747-d3ba66c8c177"
time="2023-01-31T08:40:56Z" level=info msg="Metrics initializing"
time="2023-01-31T08:40:56Z" level=info msg="MetricsThrottle initializing"
time="2023-01-31T08:40:56Z" level=info msg="DataPlaneStatus initializing"
time="2023-01-31T08:40:56Z" level=info msg="Metrics waiting for handshake to be completed"
time="2023-01-31T08:40:56Z" level=info msg="MetricsThrottle waiting for report ready"
time="2023-01-31T08:40:56Z" level=info msg="ProcessWatcher initializing"
time="2023-01-31T08:40:56Z" level=info msg="Extensions initializing"
time="2023-01-31T08:40:56Z" level=info msg="Events initializing"
time="2023-01-31T08:40:56Z" level=info msg="NGINX Counter initializing { false unix:/var/run/nginx-agent/nginx.sock 6}"
time="2023-01-31T08:40:56Z" level=info msg="OneTimeRegistration completed"
time="2023-01-31T08:40:56Z" level=warning msg="The NGINX API is not configured. Please configure it to collect NGINX metrics."
time="2023-01-31T08:40:56Z" level=info msg="Commander received agent_connect_response:<agent_config:<configs:<configs:<system_id:\"bf225f89-f4a9-3768-b747-d3ba66c8c177\" nginx_id:\"b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437\" > > > status:<statusCode:CONNECT_OK > > , <nil>"
time="2023-01-31T08:40:56Z" level=info msg="config command &{agent_config:<configs:<configs:<system_id:\"bf225f89-f4a9-3768-b747-d3ba66c8c177\" nginx_id:\"b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437\" > > > status:<statusCode:CONNECT_OK > }"
time="2023-01-31T08:40:56Z" level=info msg="Upload: Sending data chunk data 0 (messageId=69c14f0f-eacd-4876-a219-bc82c9bc0c05)"
time="2023-01-31T08:40:56Z" level=info msg="Upload: Sending data chunk data 1 (messageId=69c14f0f-eacd-4876-a219-bc82c9bc0c05)"
time="2023-01-31T08:40:56Z" level=info msg="Upload sending done 69c14f0f-eacd-4876-a219-bc82c9bc0c05 (chunks=2)"
time="2023-01-31T08:41:11Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:41:26Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:41:41Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:41:56Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:42:11Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:42:26Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:42:41Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:42:56Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:43:11Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:43:26Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:43:41Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:43:56Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:44:11Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:44:26Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:44:41Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:44:56Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:45:11Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:45:26Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:45:41Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:45:56Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:46:11Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:46:26Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:46:41Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:46:56Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:47:11Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:47:26Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:47:41Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:47:56Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:48:11Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
time="2023-01-31T08:48:26Z" level=warning msg="Unable to collect container.cpu metrics, open /sys/fs/cgroup/cpu.max: no such file or directory"
[..]
host (Fedora 37):
$ ps waux | grep nginx-agent
builder 227608 0.0 0.0 6952 1992 ? Ss 16:22 0:00 /usr/bin/conmon --api-version 1 -c a5dfd793fa73a7f3c6543e677f4540184473995e2aa80bc199a5cd824a657e1e -u a5dfd793fa73a7f3c6543e677f4540184473995e2aa80bc199a5cd824a657e1e -r /usr/bin/crun -b /run/user/9999/containers/storage/overlay-containers/a5dfd793fa73a7f3c6543e677f4540184473995e2aa80bc199a5cd824a657e1e/userdata -p /run/user/9999/containers/overlay-containers/a5dfd793fa73a7f3c6543e677f4540184473995e2aa80bc199a5cd824a657e1e/userdata/pidfile -n e2e-nginx-agent --exit-dir /run/user/9999/libpod/tmp/exits --full-attach -s -l journald --log-level warning --runtime-arg --log-format=json --runtime-arg --log --runtime-arg=/run/user/9999/containers/overlay-containers/a5dfd793fa73a7f3c6543e677f4540184473995e2aa80bc199a5cd824a657e1e/userdata/oci-log --conmon-pidfile /run/user/9999/containers/overlay-containers/a5dfd793fa73a7f3c6543e677f4540184473995e2aa80bc199a5cd824a657e1e/userdata/conmon.pid --exit-command /usr/bin/podman --exit-command-arg --root --exit-command-arg /run/user/9999/containers/storage --exit-command-arg --runroot --exit-command-arg /run/user/9999/containers --exit-command-arg --log-level --exit-command-arg warning --exit-command-arg --cgroup-manager --exit-command-arg systemd --exit-command-arg --tmpdir --exit-command-arg /run/user/9999/libpod/tmp --exit-command-arg --network-config-dir --exit-command-arg --exit-command-arg --network-backend --exit-command-arg netavark --exit-command-arg --volumepath --exit-command-arg /run/user/9999/containers/storage/volumes --exit-command-arg --runtime --exit-command-arg crun --exit-command-arg --storage-driver --exit-command-arg overlay --exit-command-arg --storage-opt --exit-command-arg overlay.mount_program=/usr/bin/fuse-overlayfs --exit-command-arg --storage-opt --exit-command-arg overlay.mountopt=nodev,metacopy=on --exit-command-arg --events-backend --exit-command-arg journald --exit-command-arg container --exit-command-arg cleanup --exit-command-arg a5dfd793fa73a7f3c6543e677f4540184473995e2aa80bc199a5cd824a657e1e
builder 227614 23.5 0.0 731564 22388 ? Sl 16:22 0:17 nginx-agent
builder 227709 0.1 0.1 2211424 39792 pts/0 Sl+ 16:23 0:00 podman logs -f e2e-nginx-agent
builder 228032 0.0 0.0 6040 1780 pts/2 S+ 16:24 0:00 grep --color=auto nginx-agent
$ cat /proc/227614/cgroup
0::/user.slice/user-9999.slice/[email protected]/user.slice/libpod-a5dfd793fa73a7f3c6543e677f4540184473995e2aa80bc199a5cd824a657e1e.scope/container
container (image created by "make image" from agent's repository):
root@nginx-agent-51c5a52f01de:/agent# ls -l /sys/fs/cgroup/
total 0
-r--r--r--. 1 root root 0 Jan 31 16:22 cgroup.controllers
-r--r--r--. 1 root root 0 Jan 31 16:22 cgroup.events
-rw-r--r--. 1 root root 0 Jan 31 16:22 cgroup.freeze
--w-------. 1 root root 0 Jan 31 16:22 cgroup.kill
-rw-r--r--. 1 root root 0 Jan 31 16:22 cgroup.max.depth
-rw-r--r--. 1 root root 0 Jan 31 16:22 cgroup.max.descendants
-rw-r--r--. 1 root root 0 Jan 31 16:22 cgroup.pressure
-rw-r--r--. 1 root root 0 Jan 31 16:22 cgroup.procs
-r--r--r--. 1 root root 0 Jan 31 16:22 cgroup.stat
-rw-r--r--. 1 root root 0 Jan 31 16:22 cgroup.subtree_control
-rw-r--r--. 1 root root 0 Jan 31 16:22 cgroup.threads
-rw-r--r--. 1 root root 0 Jan 31 16:22 cgroup.type
-rw-r--r--. 1 root root 0 Jan 31 16:22 cpu.pressure
-r--r--r--. 1 root root 0 Jan 31 16:22 cpu.stat
-rw-r--r--. 1 root root 0 Jan 31 16:22 io.pressure
-rw-r--r--. 1 root root 0 Jan 31 16:22 irq.pressure
-r--r--r--. 1 root root 0 Jan 31 16:22 memory.current
-r--r--r--. 1 root root 0 Jan 31 16:22 memory.events
-r--r--r--. 1 root root 0 Jan 31 16:22 memory.events.local
-rw-r--r--. 1 root root 0 Jan 31 16:22 memory.high
-rw-r--r--. 1 root root 0 Jan 31 16:22 memory.low
-rw-r--r--. 1 root root 0 Jan 31 16:22 memory.max
-rw-r--r--. 1 root root 0 Jan 31 16:22 memory.min
-r--r--r--. 1 root root 0 Jan 31 16:22 memory.numa_stat
-rw-r--r--. 1 root root 0 Jan 31 16:22 memory.oom.group
-r--r--r--. 1 root root 0 Jan 31 16:22 memory.peak
-rw-r--r--. 1 root root 0 Jan 31 16:22 memory.pressure
--w-------. 1 root root 0 Jan 31 16:22 memory.reclaim
-r--r--r--. 1 root root 0 Jan 31 16:22 memory.stat
-r--r--r--. 1 root root 0 Jan 31 16:22 memory.swap.current
-r--r--r--. 1 root root 0 Jan 31 16:22 memory.swap.events
-rw-r--r--. 1 root root 0 Jan 31 16:22 memory.swap.high
-rw-r--r--. 1 root root 0 Jan 31 16:22 memory.swap.max
-r--r--r--. 1 root root 0 Jan 31 16:22 memory.zswap.current
-rw-r--r--. 1 root root 0 Jan 31 16:22 memory.zswap.max
-r--r--r--. 1 root root 0 Jan 31 16:22 pids.current
-r--r--r--. 1 root root 0 Jan 31 16:22 pids.events
-rw-r--r--. 1 root root 0 Jan 31 16:22 pids.max
-r--r--r--. 1 root root 0 Jan 31 16:22 pids.peak
Everything is fine when nginx-agent is running under real root, either under Docker or privileged podman.