Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Wrong 'ps' process start times shown inside containers #3517
Inside a container, the process start times shown by
Steps to reproduce
Inside a container (which was launched from
Note the start time of the transient "grep" process (pid 1356) is shown as 21:38, although the system time is 08:12 ! The system time is correct in UTC.
I did wonder whether the timezone on the outer host made a difference. As it happens, this is set for a different zone (UTC+3)
Notice that (a) ntp is running on the outer host, and (b) the process start time for the
I first discovered this on a different, production host. Inside a container there:
Notice how this time it gives the
I don't think it means July 2017: there are other processes showing
Since the nagios process is stable and showing this problem, I can investigate. I presume the start time information comes from the
According to kernel doc the process start time is column 22 of
Aha. I wonder if
The difference between 945951.46 and 354711.0 (in seconds) is 6.84 days, hence the 7 days difference I'm seeing.
Going back to the test host I used at the start:
DIfference of 48335.76 seconds, or 13 hours 25.6 minutes, which gets you from 08:12 to 21:38 (in the future). Matches exactly what I saw.
So in summary: it appears that the kernel is giving process start times relative to host boot, but
The way to reproduce this reliably is to start a fresh lxd container on a host which has itself been running for a long period of time; the longer the host has been running, the longer the ps offset will be seen.