From 80ffd1883d8d76ed32dab40fc4b10d10217a33f4 Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Tue, 30 Sep 2025 11:13:05 +0200 Subject: [PATCH] refs #2852 do not let mksquashfs take all CPU cores --- CHANGELOG.md | 6 ++++++ boottools/btog.py | 14 ++++++++++++-- includes/etc/initramfs-tools/scripts/VERSION.txt | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8c9e3d..cfa16ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.14.2] - 2025-09-30 + +### Changed + +- Don't let mksquashfs take all CPU cores + ## [3.14.1] - 2025-09-24 ### Fixed diff --git a/boottools/btog.py b/boottools/btog.py index 0f1c463..bab2231 100644 --- a/boottools/btog.py +++ b/boottools/btog.py @@ -327,8 +327,18 @@ def mksquashfs (bttargetdir, btrootfsmnt): now = datetime.datetime.now(datetime.timezone.utc).strftime ('%Y%m%d-%H%M%S%z') os.rename (f'{bttargetdir}/ogclient.sqfs', f'{bttargetdir}/ogclient.sqfs.{now}') - ## uses all CPU cores available, even within docker - utils.run (['mksquashfs', btrootfsmnt, f'{bttargetdir}/ogclient.sqfs', '-e', 'var/lib/apt/lists', '-e', 'usr/share/doc']) + ## for some reason mksqashfs uses all CPU cores available, even within docker + ## so, let's count the number of cores... + fd = open ('/proc/cpuinfo', 'r') + nproc = 0 + while True: + line = fd.readline() + if not line: break + if 'processor' in line: nproc += 1 + ## ...and leave one core unused + nproc = str (nproc-1) + + utils.run (['mksquashfs', btrootfsmnt, f'{bttargetdir}/ogclient.sqfs', '-processors', nproc, '-e', 'var/lib/apt/lists', '-e', 'usr/share/doc']) os.chmod (f'{bttargetdir}/ogclient.sqfs', 0o744) utils.write_md5 (f'{bttargetdir}/ogclient.sqfs') diff --git a/includes/etc/initramfs-tools/scripts/VERSION.txt b/includes/etc/initramfs-tools/scripts/VERSION.txt index d524d5f..3735c80 100644 --- a/includes/etc/initramfs-tools/scripts/VERSION.txt +++ b/includes/etc/initramfs-tools/scripts/VERSION.txt @@ -1 +1 @@ -OpenGnsys Client 3.14.1 +OpenGnsys Client 3.14.2 -- 2.40.1