Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.kernel > #77826 > unrolled thread
| Started by | Helge Deller <deller@gmx.de> |
|---|---|
| First post | 2023-01-04 17:20 +0100 |
| Last post | 2023-01-25 06:50 +0100 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.debian.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Bug#1027915: systemd requires /run to be mounted with a minimum size of 20MB Helge Deller <deller@gmx.de> - 2023-01-04 17:20 +0100
Bug#1027915: systemd requires /run to be mounted with a minimum size of 20MB Helge Deller <deller@gmx.de> - 2023-01-23 23:00 +0100
Bug#1027915: systemd requires /run to be mounted with a minimum size of 20MB Helmut Grohne <helmut@subdivi.de> - 2023-01-24 21:20 +0100
Bug#1027915: systemd requires /run to be mounted with a minimum size of 20MB Helge Deller <deller@gmx.de> - 2023-01-24 22:40 +0100
Bug#1027915: systemd requires /run to be mounted with a minimum size of 20MB Helmut Grohne <helmut@subdivi.de> - 2023-01-25 06:50 +0100
| From | Helge Deller <deller@gmx.de> |
|---|---|
| Date | 2023-01-04 17:20 +0100 |
| Subject | Bug#1027915: systemd requires /run to be mounted with a minimum size of 20MB |
| Message-ID | <FKeEF-fydt-3@gated-at.bofh.it> |
Hi Helmut, On 1/4/23 14:26, Helmut Grohne wrote: > On Wed, Jan 04, 2023 at 02:08:00PM +0100, Helge Deller wrote: >> My suggestion: >> Please check that the /run mountpoint is mounted with at least 20MB, independend >> of the installed RAM memory in the machine... > > 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. Ah, ok. Thanks Helmut! > As a workaround for your situation, I suggest adding a kernel parameter > initramfs.runsize=20M. Yes, that should work. > 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 Yes, I'll try to send a patch. 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
[toc] | [next] | [standalone]
| From | Helge Deller <deller@gmx.de> |
|---|---|
| Date | 2023-01-23 23:00 +0100 |
| Message-ID | <FRd17-EZQ-23@gated-at.bofh.it> |
| In reply to | #77826 |
[Multipart message — attachments visible in raw view] — view raw
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>
[toc] | [prev] | [next] | [standalone]
| From | Helmut Grohne <helmut@subdivi.de> |
|---|---|
| Date | 2023-01-24 21:20 +0100 |
| Message-ID | <FRxVU-SYj-7@gated-at.bofh.it> |
| In reply to | #78033 |
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
[toc] | [prev] | [next] | [standalone]
| From | Helge Deller <deller@gmx.de> |
|---|---|
| Date | 2023-01-24 22:40 +0100 |
| Message-ID | <FRzbj-TF1-3@gated-at.bofh.it> |
| In reply to | #78046 |
Hi Helmut,
On 1/24/23 06:27, Helmut Grohne wrote:
> 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.
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.
> Also note that RUNSIZE may legitimately be given as "1g" or "19%", both
> of which should work.
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.
> I suggest just not handling the case where RUNSIZE
> is set by the user
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....
> and letting them break their system however they
> like rather than risk breaking legitimate configuration.
Again, the default value is the problem...
>> + 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.
Not sure I understand this...?
>> + fi
>> +fi
>> +
>> mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run
>> mkdir -m 0700 /run/initramfs
>
> Helmut
Thank you Helmut!
Helge
[toc] | [prev] | [next] | [standalone]
| From | Helmut Grohne <helmut@subdivi.de> |
|---|---|
| Date | 2023-01-25 06:50 +0100 |
| Message-ID | <FRGPv-YsD-1@gated-at.bofh.it> |
| In reply to | #78047 |
Hi Helge,
On Tue, Jan 24, 2023 at 10:30:37PM +0100, Helge Deller wrote:
> On 1/24/23 06:27, Helmut Grohne wrote:
> > 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.
>
> 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.
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.
> 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.
Fair enough.
> > > + 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
else
: "${RUNSIZE:=10%}"
> >
> > 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.
>
> Not sure I understand this...?
>
> > > + fi
> > > +fi
> > > +
> > > mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.kernel
csiph-web