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 <[email protected]> Signed-off-by: Stoiko Ivanov <[email protected]> --- 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
