Why does "pgrep -O 600" fail in an LXC? procps bug?
2
votes
1
answer
54
views
Debian 12.2 in an unpriviledged LXC (proxmox). It's almost 11:45 AM local time. At 5:00 AM in the morning, cron started a script:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
jan 26633 0.0 0.0 8500 2056 ? S 05:00 0:00 /usr/sbin/CRON -f
I'm using
pgrep -f CRON -O 600
and I expect pgrep to return PID 26633, because the process is way older than 600 seconds. But pgrep returns nothing. If I leave out the -O
, it correctly returns the PID.
Doing the same on the host machine, i.e. outside of the LXC, it works correctly.
As pgrep uses procps, I looked there.
ps -o etime -p $pid
in the LXC: 441077225-02:04:48
(wrong, because since 5:00, ~6:45h passed)
ps -o etime -p $pid
on the host: 06:43:29
(correct)
Would that be a bug in procps or does it rather have to do with LXC?
Asked by Jan
(7962 rep)
Nov 30, 2023, 10:47 AM
Last activity: Dec 1, 2023, 01:09 AM
Last activity: Dec 1, 2023, 01:09 AM