[Lxc-users] What should 'uptime' say inside an lxc container?

Stéphane Graber stgraber at ubuntu.com
Mon Sep 10 18:15:38 UTC 2012


On 12-09-10 02:02 PM, Dan Kegel wrote:
> 'uptime' seems to be the uptime of the host, not of the guest.  Is
> that intended?

uptime reads /proc/uptime which is gets you the time since the kernel
was started.

There are a few ways of "fixing" that issue:
 - Implement a new time namespace allowing us to reset the time to 0
when spawning a new container.
 - Use the fuse filesystem that was described at plumbers (some kind of
lxcfs) that will let us generate the right value in userspace and
bind-mount it over /proc/uptime in the container.


The first is I believe the right way to do it, though it's not an high
priority namespace, we have the user namespace, device namespace and
syslog namespace that seem to be more pressing.

The second solution is a good temporary workaround that'd equally apply
to /proc/cpuinfo, /proc/meminfo, ... and wouldn't require any change in
the kernel (or even lxc for that matter).

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 897 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20120910/d29a088e/attachment.pgp>


More information about the lxc-users mailing list