Stoiko Ivanov [Fri, 17 Nov 2023 17:30:23 +0000 (18:30 +0100)]
tui: fix interface sort order
Currently, when multiple NICs are present in a system the TUI
sometimes selects the wrong interface (not the one that has the
default gateway/dhcp lease)
I assume this is due to HashMap's values yielding an iterator in
arbitrary order
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com> Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
[ TL: avoid intermediate vector, reuse the SelectView's iter()] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Stefan Sterz [Fri, 17 Nov 2023 16:32:18 +0000 (17:32 +0100)]
tui: bootdisk zfs config: add a maximum value to the `copies` option
according to `man zfsprops` the copies option can only be 1, 2, or 3.
limit the field to 3 just like we do for the GTK based UI, as setting
higher options can't work anyway.
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
[ TL: fleece in note that we already limit this in the GTK UI ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Christoph Heiss [Fri, 17 Nov 2023 13:45:27 +0000 (14:45 +0100)]
tui: install progress: use ok/cancel as button text for installer prompt
The GTK installer/UI module in the low-level installer does the same.
Messages used with this are worded for this, using yes/no instead can be
quite confusing (e.g.
Proxmox::Install::ask_existing_vg_rename_or_abort())
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Christoph Heiss [Fri, 17 Nov 2023 12:12:18 +0000 (13:12 +0100)]
tui: fix changing between non-LVM and LVM filesystem in bootdisk chooser
Happens due to a force-unwrap() under the false assumption that the
disk for LVM configurations always exists when switching to a LVM
filesystem.
This fails spectacularly with a panic when switching from e.g. Btrfs to
ext4 in the filesystem chooser.
Fixes: eda9fa0 ("fix #4856: tui: bootdisk: use correct defaults in advanced dialog") Reported-by: Christian Ebner <c.ebner@proxmox.com> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Stoiko Ivanov [Thu, 16 Nov 2023 19:59:47 +0000 (20:59 +0100)]
run env: do not store emtpy hostname
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>
Stoiko Ivanov [Thu, 16 Nov 2023 15:00:41 +0000 (16:00 +0100)]
zfs: set acltype=posix for root-dataset
journald as a core component tries setting a ACL on the journal files
for (non-root) users and fails on our ZFS installs.
Resulting in dmesg being spammed with messages from journald upon each
journal-rotation for each user upon their first login.
This is also suggested by OpenZFS in their Debian guide for root on
ZFS:
https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Bookworm%20Root%20on%20ZFS.html
Tested by setting this on a machine of mine, where this has been
bugging for quite a while.
Stoiko Ivanov [Thu, 16 Nov 2023 15:00:38 +0000 (16:00 +0100)]
fix #4747: pass kernel cmdline parameters to target system
Parameters needed for booting during installation are best preserved
in the target cmdline as well - e.g. if you need a particular
cmdline switch for your system to boot at all - not having to add it
for the first boot of the installed system and manually adding it to
the bootloader config is an improvement.
This additionally enables us to drop the console parameter handling
for serial consoles (it is just one of the parameters to pass along).
Finally it fixes the regular expressions for the installer settings we
read from the cmdline (swapsize, maxroot,...) which were broken if
added as last entry.
Stoiko Ivanov [Tue, 14 Nov 2023 17:31:48 +0000 (18:31 +0100)]
serial install: fix console parameter parsing
The regex matching in Proxmox::Install::Config was blindly copied from
above - so the other parameters are also likely to not get recognized
if they are the last on the cmdline
Stoiko Ivanov [Thu, 22 Jun 2023 20:08:48 +0000 (22:08 +0200)]
pass optional console parameter from installer to target
If an installation needs to provide a dedicated console parameter
(e.g. because it runs on the serial console) the target system most
likely will need the parameter too.
This patch adds the parameter to the kernel-commandline (in case zfs
is used for both grub and systemd)
Christoph Heiss [Fri, 10 Nov 2023 14:17:26 +0000 (15:17 +0100)]
low-level, tui: count down auto-reboot timeout
The GUI installer already has the same functionality, with this the TUI
installer gains the same. It is a nice touch anyway, primarily to
indicate to the user that the installer is not frozen or similar.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Christoph Heiss [Thu, 9 Nov 2023 09:40:56 +0000 (10:40 +0100)]
fix #4856: tui: bootdisk: use correct defaults in advanced dialog
The size of the install disk was set to the size of the first disk,
regardless of what disk was selected. This only happened if the advanced
options dialog was never opened, and only a disk was selected in the
main bootdisk dialog.
Properly solving this involved restructuring the LVM advanced bootdisk
dialog, to also hold the selected disks, like the ZFS and Btrfs dialogs.
In addition to that, the `BootdiskOptionsRef` needs quite some passing
around, to cover all the cases, since the dialog also needs to be
"reentrant-safe".
I tested (among other things):
* Only select disk, don't open the advanced dialog, go to summary,
then back to the bootdisk dialog -> selected disk should be kept
* Select disk, open advanced dialog but leave everything as is, go to
summary, then go back again -> selected disk should be kept
* Same as previous, but change the "Total size" for the disk, go to
summary and back -> selected disk and size should be kept
* Same as previous, but additionally change filesystem to XFS -> disk,
filesystem and size should be kept
* Same as previous, but then create a ZFS RAID, go to summary & back,
ZFS RAID should be kept with all parameters
* etc ..
Further I also verified that the correct disk size(s) get written into
the setup structure for the low-level installer.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Christoph Heiss [Thu, 9 Nov 2023 09:47:56 +0000 (10:47 +0100)]
low level: testmode: take path to disk image instead of using /dev/null
.. in exactly the same way GUI and TUI installer do, streamlining them.
Up until now, testing the TUI installer often involved hand-editing the
`run-env-info.json` to put some proper disk sizes > 0 in place. This
makes this process a lot easier.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
install: install correct grub metapackage for the current boot-mode
grub packages in debian split between:
* meta-packages, which handles (among other things) the reinstalling
grub to the actual device/ESP in case of a version upgrade (grub-pc,
grub-efi-amd64)
* bin-packages, which contain the actual boot-loaders
The bin-packages can coexist on a system, but the meta-package
conflict with each other (didn't check why, but I don't see a hard
conflict on a quick glance)
Currently our ISO installs grub-pc unconditionally (and both bin
packages, since we install the legacy bootloader also on uefi-booted
systems). This results in uefi-systems not getting a new grub
installed automatically upon upgrade.
Reported in our community-forum from users who upgraded to PVE 8.0,
and still run into an issue fixed in grub for bookworm:
https://forum.proxmox.com/threads/.123512/
Reproduced and analyzed by Friedrich.
This patch changes the installer, to install the meta-package fitting
for the boot-mode.
We do not set the debconf variable install_devices, because the
'install_devices' variable is only defined for 'grub-pc', and thus
(still) only set for that package/namespace.
Christoph Heiss [Tue, 31 Oct 2023 12:10:54 +0000 (13:10 +0100)]
tui: views: add optional suffix label for `NumericEditView`s
Most of the churn here is due to changing the inner view from an
`EditView` to a `LinearLayout`. Also prompted the introduction of two
small helpers .inner() and .inner_mut() to simplify things everywhere
else in the view.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Christoph Heiss [Wed, 25 Oct 2023 08:56:23 +0000 (10:56 +0200)]
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>
Christoph Heiss [Fri, 20 Oct 2023 09:46:48 +0000 (11:46 +0200)]
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>
Thomas Lamprecht [Thu, 19 Oct 2023 11:37:04 +0000 (13:37 +0200)]
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>
Christoph Heiss [Mon, 21 Aug 2023 08:53:59 +0000 (10:53 +0200)]
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.
Christoph Heiss [Thu, 10 Aug 2023 10:31:57 +0000 (12:31 +0200)]
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>
Christoph Heiss [Thu, 10 Aug 2023 10:31:56 +0000 (12:31 +0200)]
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>
Christoph Heiss [Wed, 9 Aug 2023 13:44:25 +0000 (15:44 +0200)]
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>
Christoph Heiss [Wed, 9 Aug 2023 13:44:24 +0000 (15:44 +0200)]
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.
Christoph Heiss [Wed, 9 Aug 2023 13:44:23 +0000 (15:44 +0200)]
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>
Christoph Heiss [Wed, 9 Aug 2023 13:44:22 +0000 (15:44 +0200)]
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>
Christoph Heiss [Wed, 19 Jul 2023 16:31:30 +0000 (18:31 +0200)]
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>
Philipp Hufnagl [Thu, 13 Jul 2023 09:38:53 +0000 (11:38 +0200)]
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>