[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



Hi Helge,

On Mon, Jan 23, 2023 at 10:48:27PM +0100, Helge Deller wrote:
> --- ./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

This is as bashism and init runs with dash as far as I can see.

Also note that RUNSIZE may legitimately be given as "1g" or "19%", both
of which should work. I suggest just not handling the case where RUNSIZE
is set by the user and letting them break their system however they
like rather than risk breaking legitimate configuration.

> +	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

Given that you initialize a default here, I think it would make the code
more obvious if you pulled the 10% default 4 lines later into an else
branch.

> +	fi
> +fi
> +
>  mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run
>  mkdir -m 0700 /run/initramfs

Helmut


Reply to: