]> git.proxmox.com Git - pve-installer.git/log
pve-installer.git
2 days agobump version to 8.2.6 master
Thomas Lamprecht [Wed, 8 May 2024 14:04:33 +0000 (16:04 +0200)]
bump version to 8.2.6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 days agoassistant: use single dash for xorriso parameter
Aaron Lauterer [Tue, 30 Apr 2024 10:46:09 +0000 (12:46 +0200)]
assistant: use single dash for xorriso parameter

while it works with two, one is what is shown in the man page and what
we already use for the other paramters.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 days agoassistant: keep prepared iso bootable on uefi with flash drives
Aaron Lauterer [Tue, 30 Apr 2024 10:46:08 +0000 (12:46 +0200)]
assistant: keep prepared iso bootable on uefi with flash drives

By mapping files into the ISO, the UUID for the partitions change as
they depend on the timestamp. The result is, that grub cannot find its
partition anymore and the user ends up on the grub shell.

This only happens when booting from a blockdev in UEFI mode. E.g. a USB
flash drive. Alternatively one can `dd` the ISO to a small (2GiB) VM
disk and mark it as the first boot device.

When booting in legacy mode or via CDROM (e.g. pass through via IPMI),
it worked.

Xorriso can report the commands needed to recreate the source ISO. The
'-volume_date uuid' is the one needed to override the same UUIDs. We
therefore read it first from the source iso and pass it as parameter
whenever we inject a file into the iso.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 weeks agoinstall module: getters: correctly use plural in error messages
Alexander Zeidler [Thu, 25 Apr 2024 08:40:21 +0000 (10:40 +0200)]
install module: getters: correctly use plural in error messages

Signed-off-by: Alexander Zeidler <a.zeidler@proxmox.com>
2 weeks agoassistant: fix spelling and precise text in help usage output
Alexander Zeidler [Thu, 25 Apr 2024 08:40:22 +0000 (10:40 +0200)]
assistant: fix spelling and precise text in help usage output

Signed-off-by: Alexander Zeidler <a.zeidler@proxmox.com>
2 weeks agobump version to 8.2.5
Thomas Lamprecht [Wed, 24 Apr 2024 11:11:45 +0000 (13:11 +0200)]
bump version to 8.2.5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch answer: really try lower-case variant of label too
Thomas Lamprecht [Wed, 24 Apr 2024 10:37:39 +0000 (12:37 +0200)]
fetch answer: really try lower-case variant of label too

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agobump version to 8.2.4
Thomas Lamprecht [Wed, 24 Apr 2024 08:55:09 +0000 (10:55 +0200)]
bump version to 8.2.4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoanswer: replace custom display impl with derived one from serde plain
Thomas Lamprecht [Wed, 24 Apr 2024 09:24:10 +0000 (11:24 +0200)]
answer: replace custom display impl with derived one from serde plain

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoanswer: perform basic input validation for keyboard
Christian Ebner [Wed, 24 Apr 2024 08:48:50 +0000 (10:48 +0200)]
answer: perform basic input validation for keyboard

Currently it is possible to validate and create an iso with an
invalid keyboad layout, only failing later during installation.

Add a basic check for correct keyboard layout by defining an enum
with allowed variants.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: updated remaining error messages to reworked CLI
Thomas Lamprecht [Wed, 24 Apr 2024 09:12:55 +0000 (11:12 +0200)]
assistant: updated remaining error messages to reworked CLI

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: fix newline before ':' in help usage output
Dominik Csapak [Wed, 24 Apr 2024 09:02:09 +0000 (11:02 +0200)]
assistant: fix newline before ':' in help usage output

this belongs after the ':' otherwise the output looks weird:

  [..] can be
  : * integrated into [..]
  * needs to be [..]

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch answer: refactor code to find partition path
Thomas Lamprecht [Wed, 24 Apr 2024 08:50:04 +0000 (10:50 +0200)]
fetch answer: refactor code to find partition path

to avoid some repetition

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto-installer: shorten partition label to fit in 11 characters for FAT
Thomas Lamprecht [Wed, 24 Apr 2024 08:23:43 +0000 (10:23 +0200)]
auto-installer: shorten partition label to fit in 11 characters for FAT

(v)FAT is still the most popular FS on removable medias like USB pen
drives, so we need to cope with its legacy..

So, rename the label that we look for again to PROXMOX-AIS, as that
still should allow admins to better recognize what this might be for
by having the "Proxmox" context and the rest is just hard to get
sensible meaning in, so do not bother to invent elaborate explanations
of why AIS is a good choice, it isn't but it's about the best thing
that one can do in these constraints.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agobump version to 8.2.3
Thomas Lamprecht [Tue, 23 Apr 2024 22:16:39 +0000 (00:16 +0200)]
bump version to 8.2.3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoalso skip proxmox-grub if not booted in EFI mode
Thomas Lamprecht [Tue, 23 Apr 2024 22:11:28 +0000 (00:11 +0200)]
also skip proxmox-grub if not booted in EFI mode

This would effectively pull in grub-efi-amd64, which we skip a line
above this if not in EFI mode..

The builder now adds this always to the packages due to the
proxmox-secure-boot-support meta package being present there, at least
that's my current educated guess (confirmed in practice).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agobump version to 8.2.2
Thomas Lamprecht [Tue, 23 Apr 2024 19:30:40 +0000 (21:30 +0200)]
bump version to 8.2.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agounconfigured: start debug shell if auto-installation is enabled without config
Thomas Lamprecht [Tue, 23 Apr 2024 19:13:53 +0000 (21:13 +0200)]
unconfigured: start debug shell if auto-installation is enabled without config

Allows the user to fetch a configuration manually, we might even do
this in a loop, but for now this is better than nothing.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch answer: allow to override fetch-from mode through CLI arguments
Thomas Lamprecht [Tue, 23 Apr 2024 19:02:47 +0000 (21:02 +0200)]
fetch answer: allow to override fetch-from mode through CLI arguments

Allow the user to pass a fetch-from mode also through CLI arguments.

This can be useful for debugging or if the GRUB boot entry from the
advanced menu is used with a ISO that did not (yet) got prepared for
automatic installation.

This is done in a quite crudely way, probably still beats most C
programs though. Only real bigger ugliness the user will notice is
that it exits with a failure code when the user asking for help
through passing `-h` or `--help`.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch answer: split main for easier error handling
Thomas Lamprecht [Tue, 23 Apr 2024 18:51:06 +0000 (20:51 +0200)]
fetch answer: split main for easier error handling

Making the top-level main a simple match around a result allows us to
use normal rust error handling inside the actual do_main code, making
it much more ergonomic.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: collapse nested if
Thomas Lamprecht [Tue, 23 Apr 2024 18:50:06 +0000 (20:50 +0200)]
assistant: collapse nested if

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch answer: drop unused clap dependency from cargo toml
Thomas Lamprecht [Tue, 23 Apr 2024 18:24:31 +0000 (20:24 +0200)]
fetch answer: drop unused clap dependency from cargo toml

before someone starts to use this complexity pile here too..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agolow level installer: only log about creating SWAP if there's any
Thomas Lamprecht [Tue, 23 Apr 2024 17:22:01 +0000 (19:22 +0200)]
low level installer: only log about creating SWAP if there's any

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agolow level installer: avoid undef warning in progress log when using ZFS
Thomas Lamprecht [Tue, 23 Apr 2024 17:16:05 +0000 (19:16 +0200)]
low level installer: avoid undef warning in progress log when using ZFS

The $rootdev variable is not set in the ZFS branch, and ZFS is not
mounted here, so just move the progress update inside the non-ZFS
branch.

Reported-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto installer: report every progress update and include text
Thomas Lamprecht [Tue, 23 Apr 2024 16:57:16 +0000 (18:57 +0200)]
auto installer: report every progress update and include text

now that we do not print about extracting every package through stderr
we can explicitly log progress output without duplicating lots of
information

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agolow level installer: drop printing about extracting deb packages to stderr
Thomas Lamprecht [Tue, 23 Apr 2024 16:53:05 +0000 (18:53 +0200)]
low level installer: drop printing about extracting deb packages to stderr

we already log that and printing that to stderr does not provides that
much extra value and is also not done for similar actions like the
configuration of packages.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: fix mentioning outdated fetch-from mode in error
Thomas Lamprecht [Tue, 23 Apr 2024 16:26:55 +0000 (18:26 +0200)]
assistant: fix mentioning outdated fetch-from mode in error

... and unify the branches for non-http mode.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: rework prepare-iso doc comment to recent changes
Thomas Lamprecht [Tue, 23 Apr 2024 16:26:20 +0000 (18:26 +0200)]
assistant: rework prepare-iso doc comment to recent changes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: prepare iso: s/direct/included to match current naming
Alexander Zeidler [Tue, 23 Apr 2024 09:00:26 +0000 (11:00 +0200)]
assistant: prepare iso: s/direct/included to match current naming

Signed-off-by: Alexander Zeidler <a.zeidler@proxmox.com>
2 weeks agoassistant: error out on set network config for dhcp
Stoiko Ivanov [Tue, 23 Apr 2024 15:18:06 +0000 (17:18 +0200)]
assistant: error out on set network config for dhcp

potentially will not happen too often in practice if the sample files
always contain the right source. Still having settings in an answer
file that get ignored does not seem right.

tested with `validate-answer` on a file without `source` in the
network section (which initially caused confusion for me)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 weeks agoauto-installer: move ssh keys setup to low-level installer
Christoph Heiss [Tue, 23 Apr 2024 14:44:29 +0000 (16:44 +0200)]
auto-installer: move ssh keys setup to low-level installer

.. thereby, also fixing a accidental shell injection.

Since run_cmd{,s}() is nowhere else used anymore, they can be removed
too.

Also mostly reverts commit

  5878dc4ae "auto-installer: handle auto-reboot info messages directly"

in the process too.

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 weeks agorun cargo fmt
Thomas Lamprecht [Tue, 23 Apr 2024 14:08:43 +0000 (16:08 +0200)]
run cargo fmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agotui: update screen during installation only when necessary
Christoph Heiss [Tue, 23 Apr 2024 13:23:39 +0000 (15:23 +0200)]
tui: update screen during installation only when necessary

This can significantly reduces CPU load and even speed up the
installation a lot on single-core machines. While the latter may not be
a realistic target for obvious reasons, lowering overall CPU usage is
always a good thing.

Also helps with flickering during the installation process quite a bit
too.

E.g. a test installation on a single-core VM goes down from 47:35 min
w/o the patch to 2:26 min w/ the patch, a ~94%(!) decrease in time.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 weeks agoskip proxmox-secure-boot-support if secureboot is not enabled
Fabian Grünbichler [Tue, 23 Apr 2024 12:27:54 +0000 (14:27 +0200)]
skip proxmox-secure-boot-support if secureboot is not enabled

while it doesn't hurt to be installed, it also doesn't help in any fashion on
such systems.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 weeks agomove secure boot state to RunEnv
Fabian Grünbichler [Tue, 23 Apr 2024 12:27:53 +0000 (14:27 +0200)]
move secure boot state to RunEnv

as preparation for using it in more than one place.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 weeks agoauto installer: rename fetch mode type and included variant
Thomas Lamprecht [Tue, 23 Apr 2024 13:11:11 +0000 (15:11 +0200)]
auto installer: rename fetch mode type and included variant

This is not a installation mode but rather tells us where to fetch the
answer file from.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto installer: rework the default filename suffix addded to the prepared iso
Thomas Lamprecht [Tue, 23 Apr 2024 13:10:36 +0000 (15:10 +0200)]
auto installer: rework the default filename suffix addded to the prepared iso

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto installer: fetch mode: move http settings into own struct
Thomas Lamprecht [Tue, 23 Apr 2024 13:09:45 +0000 (15:09 +0200)]
auto installer: fetch mode: move http settings into own struct

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: default to output directory for tmp iso file on prepare
Thomas Lamprecht [Tue, 23 Apr 2024 13:06:37 +0000 (15:06 +0200)]
assistant: default to output directory for tmp iso file on prepare

The directory where the input ISO is on might be read-only and so it
makes more sense to use the output directory to derive the default tmp
directory from.

Note that by default the output directory is the same as the one from
the input file, so this commit won't have a change for those that do
not override the output file explicitly.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: rework prepare-iso command line interface
Thomas Lamprecht [Tue, 23 Apr 2024 13:03:10 +0000 (15:03 +0200)]
assistant: rework prepare-iso command line interface

Use input and output for the input and output files, drop various
short options, we can always re-add them later and forcing the use of
the more telling long options is a UX gift to sites with multiple
admins working on this stuff.

Further rename the "install-mode" to "fetch-from" as the option does
not changes the installation mode but rather the mode where the answer
file is fetched from.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto installer: drop fetch-from auto mode
Thomas Lamprecht [Tue, 23 Apr 2024 12:43:52 +0000 (14:43 +0200)]
auto installer: drop fetch-from auto mode

It simpler to force the user to chose, as then they will always know
where an ISO pulls the answer file from without any complex automatic
fallback logic, which might be also undesired, especially in
environments where one has not full control (trust) over the network.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agomake auto install source mode use a singular name
Thomas Lamprecht [Tue, 23 Apr 2024 10:37:47 +0000 (12:37 +0200)]
make auto install source mode use a singular name

A enum is always only one specific variant, not multiple.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto-installer: support UTC as timezone
Christoph Heiss [Tue, 23 Apr 2024 11:29:50 +0000 (13:29 +0200)]
auto-installer: support UTC as timezone

Reported-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoremaining clippy fixes
Wolfgang Bumiller [Tue, 23 Apr 2024 08:08:20 +0000 (10:08 +0200)]
remaining clippy fixes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agocargo clippy --fix
Wolfgang Bumiller [Tue, 23 Apr 2024 08:01:02 +0000 (10:01 +0200)]
cargo clippy --fix

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agoanyhow usage consistency
Wolfgang Bumiller [Tue, 23 Apr 2024 07:59:37 +0000 (09:59 +0200)]
anyhow usage consistency

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agodrop glob helper and tests
Wolfgang Bumiller [Mon, 22 Apr 2024 09:19:47 +0000 (11:19 +0200)]
drop glob helper and tests

The tests weren't testing our code, but the glob crate itself, which
is not really our job...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agocleanup unnecessary clones
Wolfgang Bumiller [Mon, 22 Apr 2024 08:06:43 +0000 (10:06 +0200)]
cleanup unnecessary clones

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agosimplify some code
Wolfgang Bumiller [Tue, 23 Apr 2024 07:51:23 +0000 (09:51 +0200)]
simplify some code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agodowngrade internal doc comment to regular comment
Wolfgang Bumiller [Mon, 22 Apr 2024 07:52:07 +0000 (09:52 +0200)]
downgrade internal doc comment to regular comment

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agouse qr// for regex variable
Wolfgang Bumiller [Mon, 22 Apr 2024 07:45:40 +0000 (09:45 +0200)]
use qr// for regex variable

and don't wrap it within `m//` when using it...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agoless strict regex for matching udev env variables
Wolfgang Bumiller [Mon, 22 Apr 2024 07:42:43 +0000 (09:42 +0200)]
less strict regex for matching udev env variables

looking through /usr/lib/udev/rules.d there are at least some which
also have digits (eg. `IEEE1394_...`), so let's just match [^=]+ for
the variable name.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agobump resolver to 2
Wolfgang Bumiller [Tue, 23 Apr 2024 08:02:04 +0000 (10:02 +0200)]
bump resolver to 2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agorename .cargo/config to .cargo/config.toml
Wolfgang Bumiller [Tue, 23 Apr 2024 08:00:39 +0000 (10:00 +0200)]
rename .cargo/config to .cargo/config.toml

as the old name is deprecated and newer rust compilers warn about it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agoauto-installer: move `system.root_ssh_keys` option to `global` section
Christoph Heiss [Mon, 22 Apr 2024 17:47:37 +0000 (19:47 +0200)]
auto-installer: move `system.root_ssh_keys` option to `global` section

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 weeks agoauto-installer: rename `global.password` option to `global.root_password`
Christoph Heiss [Mon, 22 Apr 2024 17:47:36 +0000 (19:47 +0200)]
auto-installer: rename `global.password` option to `global.root_password`

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 weeks agogitignore: sort and ignore package build-directory
Thomas Lamprecht [Mon, 22 Apr 2024 15:56:44 +0000 (17:56 +0200)]
gitignore: sort and ignore package build-directory

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agobump version to 8.2.1
Thomas Lamprecht [Mon, 22 Apr 2024 15:51:34 +0000 (17:51 +0200)]
bump version to 8.2.1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agod/control: recommend xorriso for assistant package
Thomas Lamprecht [Mon, 22 Apr 2024 15:49:39 +0000 (17:49 +0200)]
d/control: recommend xorriso for assistant package

Not all commands require it, so do not make it a hard-dependency, but
a recommend fits quite well here.

Reported-by: Mira Limbeck <mira.limbeck@gmail.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: prepare iso: avoid an useless intermediate copy of the answer file
Thomas Lamprecht [Mon, 22 Apr 2024 14:48:39 +0000 (16:48 +0200)]
assistant: prepare iso: avoid an useless intermediate copy of the answer file

This fixes a bug for the case where the answer file was named
"answer.toml", as then the code tried to copy the file to itself,
which just caused the file being truncated.

This was quite confusing for the user, as the validation of the answer
file happened before the copy step, so one would see that it got
correctly validated only to then turn up empty inside the ISO..

While this was introduced through a14a934 ("assistant: perpare-iso
avoid separate directory and make less verbose"), copying the answer
file before injecting it into the ISO was never required, so just use
the source file directly.

Note that this is still a bit racy w.r.t. validation and inserting
into the ISO, to fix that we'd need to pass around empty files or
write the content directly, both not worth it for now.

Fixes: a14a934
Reported-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto-installer: use new `lvm_auto_rename` option to avoid prompt
Christoph Heiss [Mon, 22 Apr 2024 12:46:43 +0000 (14:46 +0200)]
auto-installer: use new `lvm_auto_rename` option to avoid prompt

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 weeks agolow-level install: add option to automatically rename LVM volumes
Christoph Heiss [Mon, 22 Apr 2024 12:46:42 +0000 (14:46 +0200)]
low-level install: add option to automatically rename LVM volumes

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 weeks agobump version to 8.2.0
Thomas Lamprecht [Thu, 18 Apr 2024 20:37:07 +0000 (22:37 +0200)]
bump version to 8.2.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoadd fixme comment to move ssh-key setup over to installer
Thomas Lamprecht [Mon, 22 Apr 2024 12:31:31 +0000 (14:31 +0200)]
add fixme comment to move ssh-key setup over to installer

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto-installer: handle auto-reboot info messages directly
Christoph Heiss [Mon, 22 Apr 2024 12:11:07 +0000 (14:11 +0200)]
auto-installer: handle auto-reboot info messages directly

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto-installer: add new `system.root_ssh_keys` answer option
Christoph Heiss [Mon, 22 Apr 2024 12:11:06 +0000 (14:11 +0200)]
auto-installer: add new `system.root_ssh_keys` answer option

.. for declaratively adding SSH keys to the installed system. This is a
list of SSH public keys added to `/root/.ssh/authorized_keys` after the
installation has finished.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto install: rename network config source
Thomas Lamprecht [Mon, 22 Apr 2024 06:12:07 +0000 (08:12 +0200)]
auto install: rename network config source

A use_dhcp boolean implies that the network config is set to always
use DHCP, not that the installer uses the info that it got from DHCP
to write out a static network config.

Use a source field that allows to cleanly separate the two possible
options.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto install: drop post/pre command execution for now
Thomas Lamprecht [Mon, 22 Apr 2024 06:00:58 +0000 (08:00 +0200)]
auto install: drop post/pre command execution for now

This can be quite a bit dangerous w.r.t. prepared ISOs as attack
vector or copy cats, we rather should implement the common use cases,
like adding a SSH auth key, as explicit, declarative defined config
option.

Such a overly general command execution might be something to add at a
later stage, but not for the initial MVP.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: improve check if xorriso is installed
Thomas Lamprecht [Fri, 19 Apr 2024 17:20:03 +0000 (19:20 +0200)]
assistant: improve check if xorriso is installed

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: rename identifiers command to system-info
Thomas Lamprecht [Fri, 19 Apr 2024 16:33:15 +0000 (18:33 +0200)]
assistant: rename identifiers command to system-info

better fits to what it does and to the device-info sibling command.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: rustify getting sysinfo
Thomas Lamprecht [Fri, 19 Apr 2024 16:33:02 +0000 (18:33 +0200)]
assistant: rustify getting sysinfo

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoprint paths directly with debug, not display
Thomas Lamprecht [Fri, 19 Apr 2024 16:06:14 +0000 (18:06 +0200)]
print paths directly with debug, not display

A debug print is not only shorter code but also quotes the path
correctly, making it nicer for the user to copy (e.g., if the path is
at the end of a sentence the trailing dot could be misinterpreted as
being part of the path otherwise)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoassistant: perpare-iso avoid separate directory and make less verbose
Thomas Lamprecht [Fri, 19 Apr 2024 15:52:34 +0000 (17:52 +0200)]
assistant: perpare-iso avoid separate directory and make less verbose

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch answers: rename partition search label
Thomas Lamprecht [Fri, 19 Apr 2024 13:14:27 +0000 (15:14 +0200)]
fetch answers: rename partition search label

The new one is far from perfect either, but labels can be at max 16
characters, so that's what we have to work with.

It now is slightly easier to read due to the hyphen separation and
contains the following relevant info:
- proxmox spelled out in full, so anybody seeing that label has a good
  chance to narrow down what it could do already by a lot
- inst is a bit cryptic, but that Proxmox has a installer is a easy to
  find out fact
- src should hopefully relay that this is the source of
  (configuration) for something related to a installer by proxmox

But yeah, please don't limit IDs or names to less than 32, ideally
even 64, characters, that's the bare minimum to get some expressive
names that can have actual meaning..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch answers: avoid utils module
Thomas Lamprecht [Fri, 19 Apr 2024 12:52:33 +0000 (14:52 +0200)]
fetch answers: avoid utils module

utils/helpers/tools are all modules with a way to generic name and
will be misused as dumping ground for basically everything.

Just move the helper to where they are used and drop some bogus
methods like get_answer_file, which neither searches nor gets an
answer file (type) but just is a plain and slightly over engineered
std::fs::read_to_string

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch answers: name DHCP options more explicit
Thomas Lamprecht [Fri, 19 Apr 2024 12:51:57 +0000 (14:51 +0200)]
fetch answers: name DHCP options more explicit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto installer: rework sys-info struct layout and add more details
Thomas Lamprecht [Fri, 19 Apr 2024 12:20:16 +0000 (14:20 +0200)]
auto installer: rework sys-info struct layout and add more details

move the decoded DMI info into a "dmi" object to avoid crowding the
outer layer, add more info from the ISO and Product currently booted
and use the complete mocked variants for the assistant environments so
that users evaluating this have a full picture of possible keys.

Also include the NIC link name with the mach address so that one can
also configure the management interface correctly from a MAC.

Do this all in a slightly more ergonomic rust way, using separate
structs and impls for getting the info.

There could be even more details added, but that's for a future patch,
this one mostly transforms and enhances existing keys.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agocommon: add mocked variants for setup and ISO related info structs
Thomas Lamprecht [Fri, 19 Apr 2024 12:17:52 +0000 (14:17 +0200)]
common: add mocked variants for setup and ISO related info structs

and add necessary derives for debug and serialize so that we can use
this for the auto-installer HTTP payload that gets send to the client
to be able to determine a dynamic answer file.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agounconfigured: accept more telling boot cmdline option names
Thomas Lamprecht [Fri, 19 Apr 2024 11:05:32 +0000 (13:05 +0200)]
unconfigured: accept more telling boot cmdline option names

as alternative accept more telling names too

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agounconfigured: rename auto-installer mode variable for clarity
Thomas Lamprecht [Fri, 19 Apr 2024 11:04:05 +0000 (13:04 +0200)]
unconfigured: rename auto-installer mode variable for clarity

the others are rather bad too, but proxauto is a bit less telling than
these, and no need to keep our existing (bad) style for new stuff.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto installer: make fetch print answer to stdout and explicitly run installer
Thomas Lamprecht [Fri, 19 Apr 2024 10:59:13 +0000 (12:59 +0200)]
auto installer: make fetch  print answer to stdout and explicitly run installer

Instead of executing the actual installer from inside a tool named
`fetch-answer` make it print the answer file content it queried to
stdout and use the outer "unconfigured" init process to redirect this
to a file inside run, which is then piped to the actual installer in a
separate command.

This makes the execution flow a bit easier to grasp when reading
unconfigured and allows to inspect the answer file in a debug session.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto installer: log: implement flush
Thomas Lamprecht [Fri, 19 Apr 2024 10:21:59 +0000 (12:21 +0200)]
auto installer: log: implement flush

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agocommon installer: drop spurious println in FsType serializer
Thomas Lamprecht [Fri, 19 Apr 2024 10:13:32 +0000 (12:13 +0200)]
common installer: drop spurious println in FsType serializer

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto installer: log: print to stderr and include level
Thomas Lamprecht [Fri, 19 Apr 2024 10:07:00 +0000 (12:07 +0200)]
auto installer: log: print to stderr and include level

and use the write! macro to write to the log file to avoid an
intermediate buffer.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agotree-wide: cargo fmt
Thomas Lamprecht [Fri, 19 Apr 2024 09:54:56 +0000 (11:54 +0200)]
tree-wide: cargo fmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto install: fine tune flag/config file names on ISO
Thomas Lamprecht [Fri, 19 Apr 2024 07:47:50 +0000 (09:47 +0200)]
auto install: fine tune flag/config file names on ISO

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agosplit out assistant CLI tool into own debian package
Thomas Lamprecht [Thu, 18 Apr 2024 18:54:37 +0000 (20:54 +0200)]
split out assistant CLI tool into own debian package

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agorename proxmox-autoinst-helper to proxmox-auto-install-assistant
Thomas Lamprecht [Thu, 18 Apr 2024 18:10:37 +0000 (20:10 +0200)]
rename proxmox-autoinst-helper to proxmox-auto-install-assistant

stay on the verbose side

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoautoinst-helper: add prepare-iso subcommand
Aaron Lauterer [Thu, 18 Apr 2024 11:38:41 +0000 (13:38 +0200)]
autoinst-helper: add prepare-iso subcommand

This new subcommand makes it possible to prepare an ISO to use it for an
automated installation.

It is possible to control the behavior of the resulting automated ISO
with optional parameters.
If no target file is specified, the new ISO will be named with suffixes
to indicate it as automated and additional information. This should help
to distinct between the different options that were chosen to create it.

The code for parsing an answer file is moved to its own function.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch-answer: dpcp: improve logging of steps taken
Aaron Lauterer [Wed, 17 Apr 2024 12:31:07 +0000 (14:31 +0200)]
fetch-answer: dpcp: improve logging of steps taken

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch-answer: use ISO specified configurations
Aaron Lauterer [Wed, 17 Apr 2024 12:31:06 +0000 (14:31 +0200)]
fetch-answer: use ISO specified configurations

This patch switches the behavior to use the settings that can be
specified in the ISO.

This means, that it is possible to control how the answer file should be
fetched:

* auto - as usually, go through the options until one works (partition,
  http)
* included - the answer file is included in the ISO
* partition - only check for an answer file in a partition called
  'proxmoxinst' in lower or uppercase
* http - only fetch the answer file via an HTTP POST request.

Additionally it is possible to specify the HTTP URL directly in the ISO.

Placing the SSL fingerprint on a partition is not possible anymore. If
one wants to provide it right away (besides DHCP or DNS), it must be
incluced in the ISO itself. This reduced the need for another USB flash
drive.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto-installer: utils: define ISO specified settings
Aaron Lauterer [Wed, 17 Apr 2024 12:31:05 +0000 (14:31 +0200)]
auto-installer: utils: define ISO specified settings

These will be expected on the ISO itself and define the behavior of the
automated installation.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agofetch-answer: move get_answer_file to utils
Aaron Lauterer [Wed, 17 Apr 2024 12:31:04 +0000 (14:31 +0200)]
fetch-answer: move get_answer_file to utils

and switch to accepting the full path to the answer file. This makes it
possible to use it in more situations than just the partition case.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agod/control: add missing iproute2 and librust-nix (build) dependencies
Thomas Lamprecht [Thu, 18 Apr 2024 14:43:00 +0000 (16:43 +0200)]
d/control: add missing iproute2 and librust-nix (build) dependencies

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoadd proxmox-chroot utility
Aaron Lauterer [Wed, 17 Apr 2024 12:31:02 +0000 (14:31 +0200)]
add proxmox-chroot utility

it is meant as a helper utility to prepare an installation for chroot
and clean up afterwards

It tries to determine the used FS from the previous installation, will
do what is necessary to mount/import the root FS to /target. It then
will set up all bind mounts.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agounconfigured: add proxauto as option to start auto installer
Aaron Lauterer [Wed, 17 Apr 2024 12:30:48 +0000 (14:30 +0200)]
unconfigured: add proxauto as option to start auto installer

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agocommon: skip target_hd when deserializing InstallConfig
Aaron Lauterer [Wed, 17 Apr 2024 12:31:01 +0000 (14:31 +0200)]
common: skip target_hd when deserializing InstallConfig

as only the 'path' property is serialized -> deserialization is
problematic. The information would be present in the 'run-env-info-json',
but for now there is no need for it in any code that deserializes the
low-level config. Therefore we are currently skipping it on
deserialization

If we need it in the future, we need to think about how to handle the
deserialization.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agocontrol: update build depends for auto installer
Aaron Lauterer [Wed, 17 Apr 2024 12:30:57 +0000 (14:30 +0200)]
control: update build depends for auto installer

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
 [ TL: fix dependencies feature/version and indentation ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
d/control: explicitly depend on rust crate features and minimum version

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto-installer: answer: deny unknown fields
Aaron Lauterer [Wed, 17 Apr 2024 12:31:03 +0000 (14:31 +0200)]
auto-installer: answer: deny unknown fields

This way, serde will throw errors if fields are not known.

This can help to reduce frustration if one might think to have set an
option, but for example a small type has happened.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoauto installer: factor out fetch-answer and autoinst-helper
Aaron Lauterer [Wed, 17 Apr 2024 12:30:58 +0000 (14:30 +0200)]
auto installer: factor out fetch-answer and autoinst-helper

Putting proxmox-fetch-answer into it's own crate, will keep the use of
OpenSSL localized to where we need it. Otherwise building other binaries
will always depend on OpenSSL as well, even without actually needing it.

Having a dedicated crate for the proxmox-autoinst-helper should make it
easier to build it independently to have it available outside of the
install environment.

The fetch plugins have been moved to the proxmox-fetch-answer crate,
except for the 'get_nic_list' function and 'sysinfo.rs'. Since both are
also needed by the proxmox-autoinst-helper, they are kept in the
proxmox-auto-installer crate.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>