Systemd mounts the /run tmpfs filesystem at bootup with a given/calculated size (I assume ~ 10% of free memory?). The problem is, that this size needs to be at least 16MB (probaly better 20MB), because otherwise systemd refuses to reload when exiting emergency mode. I noticed that problem on my hppa machine. It has 160MB RAM (which is not much of course). Anyway, on this machine systemd had mounted /run at bootup with ~15MB: tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=14812k,mode=755) During bootup the system failed to mount some other drive and thus fell into emergency mode. I then entered the password to enter the shell, mounted the drive and exited the shell to continue with normal bootup, but then systemd reported: ... Reloading system manager configuration Failed to reload daemon: Refusing to reload, not enough space available on /run/systemd. Currently, 14.2M are free, but a safety buffer of 16.0M is enforced. Starting default.target ... My suggestion: Please check that the /run mountpoint is mounted with at least 20MB, independend of the installed RAM memory in the machine... Thanks! Helge
Hi Helge, Your suggestion makes sense in principle. However, it is /usr/share/initramfs-tools/init that performs the mount, so that's what would need changing. As a workaround for your situation, I suggest adding a kernel parameter initramfs.runsize=20M. Would you be able to provide a patch here? I think that if a runsize is given, it should be honoured, so it would probably work like: if test -z "$RUNSIZE"; then if system_has_at_least_200mb_ram; then RUNSIZE=10% else RUNSIZE=20M fi fi Helmut
Hi Helmut, Ah, ok. Thanks Helmut! Yes, that should work. I just wonder, what's the best way to get the amount of physical memory? Something like this should work which gives size in kB: mem_kb=$(grep MemTotal /proc/meminfo | (read txt mem txt2; echo $mem)) && echo $mem_kb Is there a better way? I think glibc isn't running in initramfs, so "getconf _PHYS_PAGES" will probably not work? Helge
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>
Hi Helge, 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. 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. Helmut
Hi Helmut, Hmm... I did tested it, at it seemed to work... Which part of that line exactly do you think is problematic? I'm open for any other idea how to code it. Both will work, because I assume that on such systems you probably have more than 200MB RAM and thus my patch won't touch the user-provided value at all. Yes, I fully agree with you and had hoped to implement it that way. Ideally RUNSIZE shouldn't be changed if it was already provided. But the problem is, that on some/many systems RUNSIZE is *automatically* provided and added to the bootloader via a default value (of 10%) given in /etc/initramfs-tools/update-initramfs.conf. So, even if the user didn't changed or provided anything, the 10% is always set and thus my check would never trigger.... Again, the default value is the problem... Not sure I understand this...? Thank you Helmut! Helge
Hi Helge,
The lexicographic comparison is outside the realm of POSIX shell, but to
my surprise this actually is supported by dash. So fixing this would be
academic.
Fair enough.
else
: "${RUNSIZE:=10%}"
This is the other line that contains a default. I suggested moving this
default up to make it more obvious, but this is really only a cosmetic
improvement.
As such LGTM, but I am not an initramfs maintainer.
Helmut
Hi Helge,
Sorry for not reviewing this patch earlier.
This test is extremely dodgy. RUNSIZE could have been specified as a
percentage, a raw number, or a number with a letter suffix ('k', 'M',
'G', etc.).
This is being very sloppy with units. systemd wants 16 MiB (16384 kiB)
and this bumps to a minimum of 20000 kiB (which is neither 20 MiB nor 20
MB).
Suppose the system has 192 MiB RAM and initramfs.conf (or the kernel
command line) sets RUNSIZE=15%. That should result in a maximum size of
29491 kiB but this *reduces* it to 20480 kiB.
I think that a correct fix for this would add a lot of complication to
handle what is now an extremely rare case. And the alternative
configuration change on those rare systems is not hard to do (though
users might not know which configuration file to edit).
So I'm inclined to mark this wontfix. I could be persuaded otherwise by
a patch that's simple and correct, but I don't think that's possible.
Ben.