public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH common] procfstools: meminfo: handle ksm info not being readable
@ 2026-02-20 14:09 Stoiko Ivanov
  0 siblings, 0 replies; only message in thread
From: Stoiko Ivanov @ 2026-02-20 14:09 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-20 14:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-20 14:09 [PATCH common] procfstools: meminfo: handle ksm info not being readable Stoiko Ivanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal