Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1200517

Bug#1072831: getting memory info fails when running under lxc

From Paul Slootman <paul@debian.org>
Newsgroups linux.debian.bugs.dist
Subject Bug#1072831: getting memory info fails when running under lxc
Date 2024-06-11 11:30 +0200
Message-ID <IO5Zf-27Cl-11@gated-at.bofh.it> (permalink)
References <IN5RD-1vdB-3@gated-at.bofh.it> <INW9z-21d0-3@gated-at.bofh.it> <IN5RD-1vdB-3@gated-at.bofh.it> <INW9z-21d0-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

tags 1072831 patch
thanks

On Tue 11 Jun 2024, Craig Small wrote:

> Could you check to see if in the container that lxcfs has overwritten
> the /proc/meminfo file? They sometimes do this for /proc/uptime. They
> might have messed one of the lines up and choked procps; I'm thinking
> like a tab/space at the end of the line or something that looks right
> to a human but not a computer.

The /proc/meminfo in the lxc container is basically the same as that of
the host, except the total memory reflects the limit imposed on the
container. So

-MemTotal:        7914164 kB$
+MemTotal:        2097152 kB$

and the Slab / SReclaimable / SUnreclaim lines show 0 kB.

> I think we'll need to either run a strace on free or a debugger to see
> where exactly the issue is.

I've been doing this.
Apparently the /proc/meminfo inside the lxc container is not seekable,
errno is ESPIPE.
The code does some seeks to reset to the beginning in preparation for
rereading the file.

I've changed the code to not do an lseek() just after opening the file
(as we should be at the start of the file then anyway), and if the file
is already open, try lseek() and if that returns errno == ESPIPE, then
close and reopen the file.

This works for me. Patch attached.

I don't know whether configure needs to test for existence of ESPIPE;
I do believe it's POSIX.


Paul

Back to linux.debian.bugs.dist | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#1072831: getting memory info fails when running under lxc Paul Slootman <paul@debian.org> - 2024-06-08 17:10 +0200
  Bug#1072831: getting memory info fails when running under lxc Craig Small <csmall@debian.org> - 2024-06-11 01:00 +0200
    Bug#1072831: getting memory info fails when running under lxc Paul Slootman <paul@debian.org> - 2024-06-11 11:30 +0200
      Bug#1072831: getting memory info fails when running under lxc Paul Slootman <paul@debian.org> - 2024-06-11 13:30 +0200
        Bug#1072831: getting memory info fails when running under lxc Jim Warner <james.warner@comcast.net> - 2024-06-12 16:50 +0200
          Bug#1072831: getting memory info fails when running under lxc Jim Warner <james.warner@comcast.net> - 2024-06-12 17:00 +0200
        Bug#1072831: getting memory info fails when running under lxc Craig Small <csmall@debian.org> - 2024-06-23 09:50 +0200
  Bug#1072831: getting memory info fails when running under lxc Craig Small <csmall@dropbear.xyz> - 2024-06-23 23:50 +0200
    Bug#1072831: getting memory info fails when running under lxc Paul Slootman <paul@debian.org> - 2024-06-24 13:40 +0200

csiph-web