Bugzilla – Bug 829
Cannot compile sudo in a container LXC
Last modified: 2018-05-01 07:04:33 MDT
Hello, I don't know if the error should be open here or to LXC (v2.0.7). Nevertheless I open it here. I am trying to compile sudo 1.8.22 (and even tried the latest 1.8.23b2) and the compilation works without any problems, until I do the "make check", and at that moment, I get that everything is ok except for one test: check_starttime: test 2: unexpected start time for pid 691525: Mon Mar 16 07:51:39 1970 check_starttime: 3 tests run, 1 errors, 66% success rate After trying to figure out the problem, I have found that the check_starttime.c is using /proc/uptime to check the uptime of the container (and it is correct), but the function in starttime.c is using /proc/$$/stat (field 22) to get the time when the process was started. Unfortunately the this field is not relative to the start of the container, but from the start of the physical host. And the delta is of course not 30 seconds, but a lot more! So I don't know if there are other ways to calculate the start of a process without using /proc/$$/stat, like the 'ps' command which seems to work correctly...
Looks like procps-ng uses the btime field of/proc/stat instead of /proc/uptime. Can you verify that this value is the boot time of the physical host and not the container?
Yes I can confirm that. on the host: $ grep btime /proc/stat btime 1516440869 on the container $ grep btime /proc/stat btime 1516440869
Created attachment 507 [details] Use btime in /proc/stat to determine system start time instead of /proc/uptime
I can confirm that it works :-) Thank you!
Fixed in sudo 1.8.23