Commit Graph

1052 Commits

Author SHA1 Message Date
Aaron Lauterer
2dbee15510 common: make InstallZfsOption public
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:18 +01:00
Aaron Lauterer
eeb062724f common: utils: add dependency for doc test
Was probably missed because it used to be in a binary crate where doc
tests aren't run automatically.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:14 +01:00
Aaron Lauterer
5362c05cd1 common: copy common code from tui-installer
Copy code that is common to its own crate.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:06 +01:00
Aaron Lauterer
2f65a616d3 add proxmox-installer-common crate
It will be used for code shared among the different crates in the
installer. For now between the TUI installer and the upcoming auto
installer.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 [TL: fold in Christoph's buildsys fix ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:02 +01:00
Christoph Heiss
2789d95b71 tui: remove obsolete, global SetupInfo state
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-25 19:03:13 +02:00
Christoph Heiss
e14adfe3a3 tui: bootdisk: pass down product info to advanced dialog
Enables the advanced and LVM dialog to determine what options (max
root/data size and Btrfs RAIDs) by itself, without needing to resort to
the global `setup_info()` function.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-25 19:03:13 +02:00
Christoph Heiss
2f0b4f7c9b tui: refactor NetworkOptions to have a defaults_from() function
This aligns it with the other constructors for options struct by
introducing a `::defaults_from()` function.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-25 19:03:13 +02:00
Christoph Heiss
9f73c54b87 tui: add some tests for NetworkInfo -> NetworkOptions conversion
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 [ TL: merge fix for missing state member when declaring a Interface
   struct in a test on master ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-20 17:12:53 +02:00
Christoph Heiss
ce01876bbc tui: use hostname from run env if available
This now tries to use the hostname from the DHCP lease if it was set,
falling back to the product name as before.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-20 12:31:22 +02:00
Christoph Heiss
8268b2e5b0 proxinstall: use hostname from run env if available
This now tries to use the hostname from the DHCP lease if it was set,
falling back to the product name as before.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-20 12:31:22 +02:00
Christoph Heiss
bda1cdf699 run env: retrieve and store hostname from DHCP lease if available
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-20 12:31:22 +02:00
Christoph Heiss
18f58123e8 net: move hostname/fqdn regexes into common code
Such that they can be re-used by other parts.
No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-20 12:31:22 +02:00
Thomas Lamprecht
9ed182696c buildsys: redirect stderr of TUI in check targets
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-19 14:19:51 +02:00
Thomas Lamprecht
89dfa5c9f1 tui: fix interface sorting
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-19 14:19:06 +02:00
Thomas Lamprecht
55e5c9cdc9 tui: show interface UP state as filled circle
like we do in the GTK UI since recently, there we also color the
filled circle green, but with current cursive crate version this
doesn't seem to be easy, at least not without breaking its theming a
bit (e.g., by just using ANSI escape codes), so just use the circle
for now.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-19 14:18:40 +02:00
Thomas Lamprecht
5c4501655a add interface state to run-time environment
making this slowly compatible with our battle-proven ifaces entry..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-19 13:34:37 +02:00
Maximiliano Sandoval
124ca33f9f fix #4869: Show state in management interface ComboBox
This is a continuation of
https://lists.proxmox.com/pipermail/pve-devel/2023-August/058639.html.

Signed-off-by: Maximiliano Sandoval R <m.sandoval@proxmox.com>
Tested-by: Filip Schauer <f.schauer@proxmox.com>
2023-10-19 11:19:59 +02:00
Christoph Heiss
eccdfb850a sys: block: fix inverted check when detecting block size
We do actually want the block size if it is integer - currently, it is
always set to `undef` (and then `null` in the serialized JSON).

Fixes: 15b2cd7 ("sys: block: fix possible use of `undef`-value when detecting disk sizes")
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-09-21 15:42:40 +02:00
Christoph Heiss
a56e078abb tui: honor test mode flag when starting low-level install session
Even if the installer is run in release mode, the test-mode flag should
be honored on whether to start a test-installation or not.

The test mode is always forced on in debug builds, so the cfg()
conditionals can be dropped.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-09-20 15:38:46 +02:00
Christoph Heiss
c733cb3b26 tui: fix search domain parsing from runtime environment info
Commit 55dc67c ("tui: fix FQDN validation") mostly fixed FQDN
validation, but missed a case when the search domain only has one
component.

As Fqdn::from() requires at least two components to pass validation, the
search domain parsing from the runtime environment info provided by the
low-level installer failed. This resulted in that the network dialog
defaulted to "<product>.example.invalid" as FQDN, instead of
"<product>.<searchdomain>" as it should.

Fixes: 55dc67c ("tui: fix FQDN validation")
Reported-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:38:14 +02:00
Christoph Heiss
fea97303fd tui: disallow legacy BIOS boot from 4Kn disks for all filesystems
The GUI installer already has the same rules in place, not allowing to
boot from 4Kn disks when booting in legacy BIOS mode. The TUI installer
currently only checks that for ZFS RAIDs, so extend that check to all
filesystem configurations.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:31:57 +02:00
Christoph Heiss
8b8efb9d08 raid setup: btrfs: do not allow legacy BIOS boot on 4Kn disks
This is already checked for LVM and ZFS setups, but not for Btrfs. Add
it there too, as it doesn't work anyway.

Tested by creating a block device with 4K sectorsize using
the following QEMU args:
  -device virtio-blk,drive=testdrive4k,logical_block_size=4096,physical_block_size=4096
  -drive file=/path/to/4k-testdisk.img,if=none,id=testdrive4k

The 4k-testdisk.img was created with:
  qemu-img create -f qcow2 /path/to/4k-testdisk.img 16G

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:31:55 +02:00
Christoph Heiss
749572552d tui: setup: handle missing disk block size gracefully
As that value can indeed be undefined, handle that (edge-)case
gracefully. There is only one place where it is checked, in the ZFS RAID
setup dialog. Aligns it with how the low-level installer handles that
case too.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:19:56 +02:00
Christoph Heiss
15b2cd7632 sys: block: fix possible use of undef-value when detecting disk sizes
`$size` and `$logical_bsize` might get unset if there invalid, but then
are unconditionally converted to an int - which throws an error.
This was reported on the forum by a user [0].

Fix it by changing the check a bit to skip the disk immediately if
detecting either of those two values are invalid or simply not present.
The fix for `$logical_bsize` simply avoids trying to convert to value to
an int if invalid.

tl;dr: Should have no impact at all, in the end. The same
`run-env-info.json` is generated w/ and w/o the patch if all disks are
fine. I then also hacked up the script a bit to actually have an invalid
size, this resulted in the "affected" disk simply missing from the disk
array - the expected behavior in this case.

[0] https://forum.proxmox.com/threads/error-installing-proxmox-8.131921/

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:19:54 +02:00
Christoph Heiss
b37e1a92e3 tui: setup: fix disk size for 4Kn block devices
This can be tested by creating a block device with 4K sectorsize using
the following QEMU args:
  -device virtio-blk,drive=testdrive4k,logical_block_size=4096,physical_block_size=4096
  -drive file=/path/to/4k-testdisk.img,if=none,id=testdrive4k

The 4k-testdisk.img was created with:
  qemu-img create -f qcow2 /path/to/4k-testdisk.img 16G

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:19:53 +02:00
Christoph Heiss
b50f7dc1be tui: network: select matching NIC for IP configuration
Instead of always just selecting an essentially random NIC (depending on
the enumeration), use the correct one for the rest of the
(DHCP-obtained) IP configuration.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:19:52 +02:00
Christoph Heiss
fe64752d13 tui: password: include minimum password length in error message
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:19:51 +02:00
Christoph Heiss
a3f04ea016 tui: drop some leftover, commented-out code
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:19:49 +02:00
Christoph Heiss
a199276f6a d/rules: enable dh_auto_test
Since we now have a test suite (or, at least the TUI installer in this
case), we can enable dh_auto_test so that it will be run on package
builds.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-25 11:19:31 +02:00
Christoph Heiss
055a59dd7a tui: add tests for RAID setup checks
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-25 11:19:31 +02:00
Christoph Heiss
ed37980fec tui: add RAID setup checks for ZFS/Btrfs
This adds early checks when setting up ZFS and Btrfs RAIDs, such as
minimum number of disks in the RAID, mirror sizes and legacy BIOS
compatibility.

The same rules as the GUI uses are applied, which unfortunaly means that
this logic is essentially duplicated between the GUI and TUI.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-25 11:19:31 +02:00
Christoph Heiss
597d10f6ee tui: improve bootdisk dialog error handling
Now we don't just fail silently, but instead give the user/developer
some indication what went wrong.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-25 11:19:31 +02:00
Christoph Heiss
ee1ae82500 tui: deserialize boot type and disk blocksize from runtime env info
This is needed later on to check whether a RAID setup is compatible with
BIOS and 4Kn disks, in particular ZFS.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-25 11:19:31 +02:00
Christoph Heiss
4f2c43eef7 tui: simplify duplicate disk checking logic
This reduces the logic from O(n^2) to O(n), which is always a good
thing.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-25 11:19:31 +02:00
Christoph Heiss
69f162a6c9 tui: fix small typo in error message
Fixes: 994c4ff ("tui: add better error handling to BootdiskOptions::get_values()")
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-21 13:45:35 +02:00
Christoph Heiss
7667dbbce3 gitignore: add cd-info.test
It's a testfile and should thus be ignored.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-21 13:45:28 +02:00
Christoph Heiss
55dc67ca39 tui: fix FQDN validation
Add checks to ensure that:
 * It is actually has a hostname, not just a domain name
 * Properly check if the hostname is purely numeric, which was
   broken/different to how the GUI installer does it

The custom error type also allows for easier future adaptions, as the
changes can be entirely contained to the `Fqdn` type.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-21 13:45:10 +02:00
Christoph Heiss
8c9af1e7a3 tui: use EULA path from ISO info instead of hard-coding
.. in the same fashion as the GUI installer.
See also proxinstall:create_intro_view() for reference.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-15 23:41:34 +02:00
Philipp Hufnagl
7b8ac1b805 disk partitioning: fix checking answer for to-small-disk prompt
Currently there is a bug that you only can install < 8 GB when you NOT
accept the warning. This is wrong. A user should have to accept the
warning to install on small systems

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
 [T: reword commit subject & fix typo there ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-07-13 16:15:44 +02:00
Christoph Heiss
2379338ce5 tui: add "Deselect all" button to zfs/btrfs raid disk select
Another puzzle piece in the quest to align the TUI installer more to
its GUI counterpart.

Like the GUI installer, it will only be shown if >3 disks are
detected on the system.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-13 16:07:04 +02:00
Christoph Heiss
9e5cf6b6e9 tui: fix clippy warnings
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-13 16:06:57 +02:00
Noel Ullreich
f9960aa743 tui: don't abort install if min ram requirement is not met
If the minimum requirements are not met, the TUI installer will create a
popup notifying you that the install might not work and then exits the
installer.
While the GUI also creates such a popup, it will not exit the installer.
This patch adapts the behavior of the GUI: the TUI creates a popup
warning you that min spec is not met but doesn't abort the install.

Signed-off-by: Noel Ullreich <n.ullreich@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
 [T: fix conflict in context and drop intermediate variable ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-07-13 16:02:50 +02:00
Christoph Heiss
a6d1f315a9 tui: fix incorrect scrolling of form view contents
See the inline comment for what & why.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-13 15:51:02 +02:00
Christoph Heiss
6bbde21432 d/control: drop unused librust-proxmox-sys-dev build dependency
Since the TUI installer does not use it anymore, we can drop it from
here as well.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-13 15:48:02 +02:00
Christoph Heiss
636da45e9d tui: check hvm support through runtime env info instead of open-coding
As the runtime environment now exports that info, use it. In turn, this
allows us to drop the dependency on `proxmox-sys`, as that check was its
only user.

The dependency graph drops from 107 to 88 crates from this, which
definitively is a nice change.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-13 15:48:02 +02:00
Christoph Heiss
0efa2eed03 proxinstall: check hvm support through runtime env info
As that info is now available through the runtime environment info, use
it and avoid duplicating logic.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-07-13 15:48:02 +02:00
Christoph Heiss
4d8aec8af4 run env: add hardware-accelerated virtualization support flag
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>
2023-07-13 15:48:02 +02:00
Thomas Lamprecht
8186bc7b5e bump version to 8.0.14
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-28 18:39:44 +02:00
Thomas Lamprecht
bf9e79b7ea installation: disable clamav-clamonacc.service by default for PMG
> On-Access [...] leverages a kernel api called fanotify to block
> processes from attempting to access malicious files. This
> prevention occurs in kernel-space, and thus offers stronger
> protection than a purely user-space solution.

This is not really useful for the PMG use case and requires user
configuration as otherwise it refuses to start. In fact, is the sole
unit marked as failed after a fresh installation:

> ERROR: Clamonacc: at least one of OnAccessExcludeUID,
> OnAccessExcludeUname, or OnAccessExcludeRootUID must be specified
> it is recommended you exclude the clamd instance UID or uname to
> prevent infinite event scanning loops.

So disable it by default, if a user really wants this, whyever that
would be, the can just configure it and enable it again via
systemctl.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-28 18:36:21 +02:00
Thomas Lamprecht
aac8082fe4 bump version to 8.0.13
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-27 16:44:50 +02:00