[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1027915: systemd requires /run to be mounted with a minimum size of 20MB



The attached patch ensures that the /run mount point
is always mounted with at least 20MB.

This is important since systemd requires at least 16MB
in /run, otherwise it will give errors and warnings and
will refuse to boot further after an emergency shell.

This patch has been tested on x86 (with VirtualBox VMs)
in configurations with 160MB RAM and 900MB RAM, as well
on a debian parisc installation with 160MB RAM.

This patch will adapt the size of /run, even if the
default value of 10% (of physical memory) is given
in the /etc/initramfs-tools/update-initramfs.conf file
(e.g. on x86).

Please apply to the next initramfs-tools update.

Signed-off-by: Helge Deller <deller@gmx.de>
diff -up ./init.org ./init
--- ./init.org	2023-01-23 21:40:33.079738389 +0000
+++ ./init	2023-01-23 21:40:45.983861851 +0000
@@ -205,6 +205,15 @@ else
 	resume=${RESUME:-}
 fi
 
+if [ -z "${RUNSIZE}" ] || [[ "${RUNSIZE}" \< "20" ]]; then
+	read MemTotal mem_kb rest < /proc/meminfo
+	# systemd requires at minumum 16MB for /run, so reserve
+	# 20MB for machines which have less than 200MB RAM
+	if [ "$mem_kb" -lt "200000" ]; then
+		RUNSIZE=20M	# for machines <= 200MB RAM
+	fi
+fi
+
 mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run
 mkdir -m 0700 /run/initramfs
 

Reply to: