Bug#987316: initscripts: tmpfs has wrong size

Thorsten Glaser t.glaser at tarent.de
Wed Apr 21 18:38:44 BST 2021


severity 987316 minor
thanks

On Wed, 21 Apr 2021, Roger Lynn wrote:

> Thanks for the clarification. I think that reduces this bug to "Why is my
> tmpfs set to 20% of physical RAM rather than 20% of total virtual memory?"

There’s a difference betwen setting it to 20% and to 20%VM.
The default value is 20%VM though.

tmpfs_size_vm uses vm_size which combines RAM and swap size
and calculates a size in KiB based on it (with some extra
rounding down due to dividing by 100 first in order to stay
within values shell arithmetic can do without UB). However
ram_size and swap_size rely on /proc/meminfo, grep and a
pretty involved sed command, which can even fail badly, as
it doesn’t use sed -n.

If anything fails in calculating vm_size, or if using 20%
instead of 20%VM, the value is passed as '20%' instead of
a size in KiB to mount, so the kernel will do the rest.

I think our best bet to tracking this down would be:

• add “set -x” as first and “set +x” as last line to
  /lib/init/tmpfs.sh
• perhaps also add “grep Total /proc/meminfo” in there
  for extra debugging
• reboot with serial console, so we can actually capture
  all the debug messages

I suspect one of the operations involved fails for you,
or swap is initialised later. Hrm.

I have TMP_SIZE=80%VM in my /etc/default/tmpfs and I get…

$ df -k
Filesystem  1K-blocks  Used       Available  Use%  Mountpoint
tmpfs       6458640    3624664    2833976    57%   /tmp

$ fgrep Total /proc/meminfo 
MemTotal:        8073324 kB
SwapTotal:       3206140 kB

Okaaay, I guess I can reproduce this. Then I can probably
debug this in a VM, as to easier get serial console (I do
have a physical serial port, but…).

> (And the rewording of the manual page would be nice too.)

Agreed, but I believe this is now of minor severity. If
nobody complains I’ll commit that change for the next
regular upload.

bye,
//mirabilos
-- 
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

*************************************************

Mit dem tarent-Newsletter nichts mehr verpassen: www.tarent.de/newsletter

*************************************************



More information about the Debian-init-diversity mailing list