all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH common] procfstools: meminfo: handle ksm info not being readable
Date: Fri, 20 Feb 2026 15:09:30 +0100	[thread overview]
Message-ID: <20260220140932.472867-1-s.ivanov@proxmox.com> (raw)

in certain restricted envrironments, e.g. `sbuild`
/sys/kernel/mm/ksm/pages_sharing is present but not readable.

pmg-api relies on memtotal to compute the maximal number of processes
to start in PMG::Config, and this computation is triggered while
building the man-pages. This results in a failure while building with
`sbuild`.

The change follows a commit which addressed running pmg with a kernel
that does not have KSM enabled:
9c1ccaf (ProcFSTools: fix read_meminfo without KSM)

The issue was (last) reported by Fabian, with a diff for pmg-api as
workaround.

Tested by building a libpve-common-perl package with a higher version
than what's available in our repositories and including it when
running mmdebstrap with
`--hook-dir=/usr/share/mmdebstrap/hooks/file-mirror-automount`
and afterwards building pmg-api with `make sbuild`

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PVE/ProcFSTools.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index 18a159d..726248f 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -352,7 +352,7 @@ sub read_meminfo {
     $res->{swapfree} = $d->{swapfree};
     $res->{swapused} = $res->{swaptotal} - $res->{swapfree};
 
-    my $spages = PVE::Tools::file_read_firstline("/sys/kernel/mm/ksm/pages_sharing") // 0;
+    my $spages = eval { PVE::Tools::file_read_firstline("/sys/kernel/mm/ksm/pages_sharing") } // 0;
     $res->{memshared} = int($spages) * 4096;
 
     my $arc_stats = eval { PVE::Tools::file_get_contents("/proc/spl/kstat/zfs/arcstats") };
-- 
2.47.3





                 reply	other threads:[~2026-02-20 14:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260220140932.472867-1-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal