From 8de60f7a8c37e7badf319a26e189d4588b5776e5 Mon Sep 17 00:00:00 2001 From: Angel Cervera Roldan <48255007+angelcerveraroldan@users.noreply.github.com> Date: Wed, 18 Mar 2026 16:07:43 +0000 Subject: [PATCH] Limit smp to 255 for libguestfish libguestfs will fail with `-set-smp v` for `v` greater than 255. This can be seen in their source code: https://github.com/libguestfs/libguestfs/blob/5011bea96da06878864149767650bcc41f425fb9/lib/handle.c#L916 --- src/libguestfish.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libguestfish.sh b/src/libguestfish.sh index d67036fa2a..79dd4553b1 100755 --- a/src/libguestfish.sh +++ b/src/libguestfish.sh @@ -45,8 +45,16 @@ coreos_gf_run() { return fi coreos_gf_launch "$@" + + # set-smp has a limit of 255 vcpus, anything over that will error + # See: https://github.com/libguestfs/libguestfs/blob/5011bea96da06878864149767650bcc41f425fb9/lib/handle.c#L916 + local ncpus + ncpus=$(kola ncpu) + if [ "$ncpus" -gt 255 ]; then + ncpus=255 + fi # Allow mksquashfs to parallelize - coreos_gf set-smp "$(kola ncpu)" + coreos_gf set-smp "$ncpus" coreos_gf run GUESTFISH_RUNNING=1 }