From 56b773cf8a349acd48507a9b91acf7783395f441 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Thu, 27 Mar 2025 12:19:05 +0100 Subject: [PATCH] ZRAM config: suppress errors when kernel support is not there --- packages/bsp/common/usr/lib/armbian/armbian-zram-config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/bsp/common/usr/lib/armbian/armbian-zram-config b/packages/bsp/common/usr/lib/armbian/armbian-zram-config index 7d6e2dd64b..6437822d84 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-zram-config +++ b/packages/bsp/common/usr/lib/armbian/armbian-zram-config @@ -25,6 +25,8 @@ ENABLED=false [ -f /etc/default/armbian-zram-config ] && . /etc/default/armbian-zram-config # Exit if not Enabled [[ "$ENABLED" != "true" ]] && exit 0 +# Exit if module not Loaded +if ! modinfo "zram" 2>/dev/null; then exit 0; fi # Do not interfere with already present zram-config package dpkg -l | grep -q 'zram-config' && exit 0 @@ -60,7 +62,7 @@ activate_zram_swap() { # swap file or partition on *capable* storage needs to be chosen and # defined as swap and also in /etc/default/armbian-zram-config SWAP=false # needs to be set. - echo 0 >/sys/module/zswap/parameters/enabled 2>/dev/null + [[ -f /sys/module/zswap/parameters/enabled ]] && echo 0 >/sys/module/zswap/parameters/enabled # Limit Journal size to 20Mb sed -i "s/.*SystemMaxUse=$/SystemMaxUse=20M/" /etc/systemd/journald.conf