Commit Graph

979 Commits

Author SHA1 Message Date
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
Thomas Lamprecht
87c98625ca bump version to 8.0.12
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-27 16:44:50 +02:00
Stefan Sterz
cc655f8b9d tui: persist disk selection for zfs and btrfs
previously the disk selection was reset if the advanced options
dialogue was re-opened. this commit adapts the behavior to restore
the previous selection.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-27 16:44:50 +02:00
Thomas Lamprecht
5ed7f4951f tui: block & notify if same disk gets selected twice
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-27 14:58:55 +02:00
Thomas Lamprecht
e77ab7d0d9 tui: only show warning for missing hyper-visor CPU flags for PVE
that feature isn't useful for neither Proxmox Mail Gateway nor
Proxmox Backup Server

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-27 11:17:44 +02:00
Thomas Lamprecht
ce8fdebb80 bump version to 8.0.11
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-26 21:40:01 +02:00
Thomas Lamprecht
6719eda6b5 tui: hide max-vz and max-root inputs if product isn't PVE
like we do in the GTK based installer

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-26 21:38:50 +02:00
Thomas Lamprecht
0a48c149be buildsys: copy over .cargo config directory to build-dir
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-26 19:23:26 +02:00
Thomas Lamprecht
eab366db0e bump version to 8.0.10
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-26 19:10:06 +02:00
Thomas Lamprecht
a96dc91688 tui: boot disks: filter out Btrfs if setup info disallows it
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-26 19:08:03 +02:00
Thomas Lamprecht
ce76d4c0a1 buildsys: add check-pbs-tui target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-26 19:06:58 +02:00
Thomas Lamprecht
7e569bd6cd buildsys: add check-pmg-tui target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-26 19:05:50 +02:00
Wolfgang Bumiller
f57b120627 tui: rustfmt
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-26 16:01:31 +02:00
Wolfgang Bumiller
13f9bbae33 tui: use product for default hostname
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-26 16:01:31 +02:00
Wolfgang Bumiller
3f0477a811 tui: make ProxmoxProduct Copy
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-26 16:01:31 +02:00
Wolfgang Bumiller
fabd468edc tui: add global 'setup_info'
This is basically "installer information" and will is used
for things such as default values for which we do not want
to pass around all the data.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-26 16:01:31 +02:00
Thomas Lamprecht
f8a5d0412f bump version to 8.0.9
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-22 16:49:29 +02:00
Thomas Lamprecht
c9482d0e38 disk selection: save both, order and disk id
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-22 16:46:33 +02:00
Stoiko Ivanov
120bc64902 fix space calculation for small disks for pve product
The convoluted calculation logic in case the disks is 8GB leads to
datasize becoming 16EiB further down:
* after calculating and removing the rootsize from $rest, $rest becomes
  smaller than $space (which should be the minimal non-used space in the
  volume-group) - this leads to a negative value, which overflows in
  the `& ~0xFFF` opration.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2023-06-22 16:26:49 +02:00
Fiona Ebner
98c856e86a always align rootdisk size to 4 MiB
While this was already done in the $rest < 48 GiB cases, it wasn't yet
done for the else branch and also not if $maxroot_mb was assigned,
because of being smaller.

Second and last step towards fixing an issue reported in the community
forum [0] where using 250.00 hdsize, 250 maxroot and 0 minfree would
fail.

Turns out two extents would be missing because of lvcreate implicitly
rounding up, one of them for the root LV (the one for metadata was
already handled in the previous commit).

[0]: https://forum.proxmox.com/threads/129320/post-566375

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-06-22 16:26:49 +02:00
Fiona Ebner
22b7837283 align metadatasize to 4 MiB
First step towards fixing an issue reported in the community forum [0]
where using 250.00 hdsize, 250 maxroot and 0 minfree would fail.

Turns out two extents would be missing because of lvcreate implicitly
rounding up, one of them for the metadata.

[0]: https://forum.proxmox.com/threads/129320/post-566375

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-06-22 16:26:49 +02:00
Thomas Lamprecht
0632d4790a gtk: raid disk selector: separate UI state from config state
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-22 16:22:10 +02:00
Thomas Lamprecht
25de20e33a sys block: fix id for test disks
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-22 16:20:41 +02:00
Maximiliano Sandoval
e1eb2ac947 tui: do not auto reboot on failures
Otherwise the user only has 5 seconds to see the error message before
the machine reboots.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2023-06-22 15:30:53 +02:00