In preparation for fixing #6285 [0].
`0` means to just skip writing the module parameter. But (especially)
with the upcoming change in ZFS 2.3 - which makes the size basically
that of the system memory minus 1 GiB - we want to always write some
value.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=6285
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Reduce the maximum ARC size to 10% of total memory instead of the
default 50% not only for PVE, but always if the system has less than 2
GiB, or less than 4 GiB for PMG, i.e. less than the recommended
minimum memory we document.
We might want to fine-tune this further in the future, e.g. so that
PMG and PDM won't use 50% of memory even if they got more memory
installed. As they both are not IO-heavy, thus a big ARC won't gain
one that much, but as memory is mainly used for the base system there,
unlike PVE where it's mainly for virtual guests, it might make sense
to use something like 25% there for a better trade-of. Anyway, that's
something that needs closer evaluation, so not relevant for now.
Adapt the tests accordingly.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
To not allow the max ARC size to be the same as the total memory size.
Note that 1 GiB is often still not enough for a fully working system,
but for one, this can only happen if the user manually overrides ARC
max, and for another, it's only a general crude safety net to allow
the basic system to boot so that one can correct this if it's a
problem as for some products, like PBS or PDM, the base system's RSS
usage might be below 1 GiB, and we are not doing product-aware stuff
here.
Adapt the tests accordingly.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
When debugging or otherwise deliberately running the `dump-env`
low-level installer command in test mode, chances are that you'd want
the run env file to be re-created as well.
No impact on the normal installation flow.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
For non-PVE products, simply use the ZFS defaults (aka. 50%) and leave
unset, if the user never touches that setting.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Needed for the post-hook functionality, which sends this information as
part of its information set.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Previously, in the "false" case, it would serialize to an empty string.
In the future this property will be deserialized by (type-safe) Rust
code.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Bit of perl fun again.
$err from detect_country_tracing_to() can be empty string under certain
circumstances (according to a forum post [0]). The // operator
evaluates an empty as true, thus `warn` receives an empty string to and
just prints
Warning: something wrong at /usr/share/perl5/proxmox/Install/RunEnv.pm line 305
Which isn't particular helpful. Use the || operator instead, that
evaluates an empty string as false and thus would fall back to the
generic error message.
A minimal reproducer/example for completeness sake:
#!/usr/bin/env perl
use strict;
use warnings;
warn ('' // "unable to detect country\n");
warn ('' || "unable to detect country\n");
gives
Warning: something's wrong at ./test.pl line 5.
unable to detect country
[0] https://forum.proxmox.com/threads/blank-screen-while-installing.143928/
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
To avoid a misinterpretation of the auto-return value:
> In the absence of an explicit return, a subroutine, eval, or do FILE
> automatically returns the value of the last expression evaluated.
-- https://perldoc.perl.org/functions/return
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This fixes a rather longstanding issue [0][1] with the country
detection, in that it might get completely stuck and thus hangs the
installation.
This is due how Perl, signals and line reading interacts.
A minimal reproducer, how the installer currently works, looks like
this:
```
#!/usr/bin/env perl
use strict;
use warnings;
open (my $fh, '-|', 'sleep', '1000') or die;
my $prev = alarm(2);
eval {
local $SIG{ALRM} = sub { die "timed out!\n" };
my $line;
while (defined ($line = <$fh>)) {
print "line: $line";
}
};
alarm($prev);
close($fh);
```
One might expect that this times out after 2 seconds, as specified in
`alarm(2)`. The thruth is that `$line = <$fh>` apparently prevents the
signal to go through. This then causes the installer to hang there
indefinitely, if `traceroute` never progresses - which seems to happen
on lots of (weird) networks, as evidently can be seen in the forum [1].
Proxmox::Sys::Command::run_command() handles of these weird cases, takes
care of the nitty-gritty details and - most importantly - interacts
properly with SIGALRM, so just use that instead.
This _should_ really fix that issue, but reproducing it 1:1 as part of
the installation process is _very_ hard, basically pure luck. But
rewriting the reproducer using run_command (in the exact same way that
this patch rewrites detect_country_tracing_to()) fixes the issue there,
so it's the best we can probably do.
NB: This causes that the traceroute command is now printed to the log
(as run_command() logs that by default), which we could also hide e.g.
through another parameter if wanted.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=4872
[1] https://forum.proxmox.com/threads/proxmox-installation-trying-to-detect-country.134301/
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
without this patch the hostname ends up as the empty string in
run-env-info.json, which results in a parse-error in the TUI code
(an empty string is not None, but still too short as hostname)
Minimally tested on a VM.
Fixes: bda1cdf ("run env: retrieve and store hostname from DHCP lease
if available")
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Can later be used by the installer frontends, as well as nicely alinging
with the 'single source of truth' "policy".
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Similar to our actual battle proven get_ip_config, but as the TUI
uses this one, and switching to it rather more risk, make just
addresses optional, add skip for "lo" loopback and don't skip ifaces
that aren't UP in the current helper.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This adds some duplication there, but much safer than restructuring
stuff at this point in time, we can deal with unification later.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Instead of lsblk we use the original `hd_list` to be closer
to what we originally had.
However, from the PVE codebase I copied over the use of the
`E: DEVNAME` property to find the `/dev` node like (since
some weird devices can have '!' in /sys with '/' in /dev),
drop the check for `/sys/block/$d/dev`, and provide both the
`/dev` and `/sys/block` path in the output array.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
we should only use the exact same set of values everywhere any way
for this, a good hint that a singleton is a good fit and this is
global info.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>