pve 7 unattended install

dakobg

New Member
Jul 30, 2021
4
3
3
41
Hi,

Any idea about pve 7 unattended install ?
Any up to day wiki/guide ?

If someone can help with advice will be great, currently I'm try to do that with packer . I need a pve img for auto-deployment with maas however I'm not sure from where to start, any specific requirement for debian and pve 7 ?

note: the question is more general not specific for packer or ubuntu maas


Regards,
 
  • Like
Reactions: inf3rno
Also will be greate start with example preseed.cfg for pve6 and probably upgrade pve 6 to 7
 
So,
With pxe/tftp + preseed

debian 10 and PVE6 - no issues
debian 11 and PVE7 - ifupdown2 pkg installation fail, I believe is something related to debian 11 because fail if I try to install it separately via preseed without PVE

When proxmoxe-ve pkg is installed it require ifupdown2 (I think this is the main reason why 6* work 7 not)

however no issues to be post-installed after PVE7 installation is completed

If someone can help with ifupdown2 and preseed will be great

Anyway for info:

pxe config

Code:
label install proxmox ve 7
        kernel debian-installer/amd64/linux
        MENU LABEL Install Proxmox VE ^7
        LINUX debian-installer/amd64/linux
        INITRD debian-installer/amd64/initrd.gz
        APPEND vga=788 preseed/url=http://192.168.168.1/pxe/pve7-preseed.txt debian-installer/locale=en_US debian-installer/country=US debian-installer/language=en debian-installer/allow_unauthenticated_ssl=true keyboard-configuration/xkb-keymap=us hostname=pve7 domain=domain.local netcfg/get_ipaddress=192.168.168.250 netcfg/get_netmask=255.255.255.0 netcfg/get_gateway=192.168.168.1 netcfg/get_nameservers=8.8.8.8 netcfg/choose_interface=auto netcfg/disable_autoconfig=true theme=dark  --- quiet

preseed

Code:
#_preseed_V1
#### Contents of the preconfiguration file (for bullseye)

### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.
#d-i mirror/protocol string ftp
d-i mirror/country string manual
d-i mirror/http/hostname string debian.telecoms.bg
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string

### Account setup
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false

# Root password, either in clear text
d-i passwd/root-password password r00t
d-i passwd/root-password-again password r00t

### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true

# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string Europe/Sofia

# This makes partman automatically partition without confirmation.
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman-auto-lvm/guided_size string max

d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

### Base system installation

### Apt setup
# Additional repositories, local[0-9] available
d-i apt-setup/local0/repository string \
        deb [arch=amd64] http://download.proxmox.com/debian/pve bullseye pve-no-subscription
d-i apt-setup/local0/comment string proxmox ve7
d-i apt-setup/local0/key string https://enterprise.proxmox.com/debian/proxmox-release-bullseye.gpg

### Package selection
tasksel tasksel/first multiselect standard
# Individual additional packages to install
d-i pkgsel/include string openssh-server net-tools vim
popularity-contest popularity-contest/participate boolean false

### Boot loader installation
# This is fairly safe to set, it makes grub install automatically to the UEFI
# partition/boot record if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev  string default

### Finishing up the installation
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note

#### Advanced options
### Running custom commands during the installation
# d-i preseeding is inherently not secure. Nothing in the installer checks
# for attempts at buffer overflows or other exploits of the values of a
# preconfiguration file like this one. Only use preconfiguration files from
# trusted locations! To drive that home, and because it's generally useful,
# here's a way to run any shell command you'd like inside the installer,
# automatically.

# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.

# Install Proxmox VE
d-i preseed/early_command string sed -i '/^iface ens18 inet/i auto ens18' /etc/network/interfaces

d-i preseed/late_command string \
  in-target bash -c "sed -i 's\#PermitRootLogin.*\PermitRootLogin yes\g' /etc/ssh/sshd_config"; \
  in-target bash -c "sed -i '/^127.0.1.1/d' /etc/hosts"; \
  in-target apt-mark hold ifupdown2; \
  in-target apt install -y proxmox-ve postfix open-iscsi; \
  in-target apt remove -y os-prober

NOTE: I believe this is not needed, just when I investigate pve7 install issue I notice this was missing (I'm sure ifupdown2 pkg mess up the interface config), however keep attention on interface name (no time for more testings but I guess the idea is clear)
Code:
d-i preseed/early_command string sed -i '/^iface ens18 inet/i auto ens18' /etc/network/interfaces
 
Last edited:
Quoting my reply from the BTS entry:
This is not a dependency but a "Breaks" for older ifupdown2 versions.

Proxmox VE 7.x bases on Debian Bullseye, but ships its own ifupdown2 version in our repos; *but*, even the Debian Bullseyes provides ifupdown2 in version 3.0.0-1 already, so that "Breaks" will not matter anymore even for plain Bullseye setups.
-- https://bugzilla.proxmox.com/show_bug.cgi?id=3627#c1
debian 11 and PVE7 - ifupdown2 pkg installation fail, I believe is something related to debian 11 because fail if I try to install it separately via preseed without PVE

When proxmoxe-ve pkg is installed it require ifupdown2 (I think this is the main reason why 6* work 7 not)

no it does not, as you can easily confirm:
Code:
# apt show proxmox-ve
Package: proxmox-ve
Version: 7.0-2
...

Provides: proxmox-virtual-environment
Depends: apt, openssh-client, openssh-server, proxmox-archive-keyring, pve-kernel-5.11, pve-kernel-helper, pve-manager, pve-qemu-kvm, qemu-server, spiceterm, vncterm
Conflicts: proxmox-ve-3.10.0, proxmox-virtual-environment, pve-kernel
Replaces: proxmox-ve-3.10.0, proxmox-virtual-environment, pve-kernel

The linked commit is for libpve-common-perl, and it only documents a Breaks for an older version of ifupdown2, but no actual depenency.

pve-manager is the package actually depends on either ifupdown2 or ifenslave (which pulls in original ifupdown 1), but the order was changed in PVE 7, ifupdown2 is now ordered first, and apt/dpkg defaults to the first stated dependency if none of the options is already installed.
 
If you want to keep ifupdown 1 in PVE 7 you could just add that as explicit package in your preseed files, before or with the line where proxmox-ve (and thus pve-manager and thus default ifupdown2) are installed.
 
Alternatively, you can touch the /proxmox_install_mode file before starting to install proxmox-ve (i.e., ifupdown2), so the "automatic config update + reload on first installation" is skipped; that's what we use in the installer too.

That flag file must be removed after installing PVE again though, else normal updates may make trouble.
 
  • Like
Reactions: nana_ncux
you can touch the /proxmox_install_mode file before starting to install proxmox-ve

Thanks for your reply!
After creating the file, the installation completed successfully, but probably something went wrong and the boot with the new kernel failed.
1631870188169.png




Code:
# update-initramfs -u -k 5.11.22-4-pve
update-initramfs: Generating /boot/initrd.img-5.11.22-4-pve
Running hook script 'zz-proxmox-boot'..
Re-executing '/etc/kernel/postinst.d/zz-proxmox-boot' in new private mount namespace..
No /etc/kernel/proxmox-boot-uuids found, skipping ESP sync.
 

Attachments

  • 1631872592488.png
    1631872592488.png
    61.5 KB · Views: 4
Last edited:
After pve7 install no issue to un-hold ifupdown2 and do post-install, I think the main problem with ifupdown2 is because during install change networking systemd service to point to ifupdown2 bin files and restart networking service .. no good for pxe/network install
 
during install change networking systemd service to point to ifupdown2 bin files
that really should not matter
restart networking service .. no good for pxe/network install
that on the other hand does, and the same is true within the installer, that's why I recommended the same trick ;)
Alternatively, you can touch the /proxmox_install_mode file before starting to install proxmox-ve (i.e., ifupdown2), so the "automatic config update + reload on first installation" is skipped; that's what we use in the installer too.

That flag file must be removed after installing PVE again though, else normal updates may make trouble.
 
I'm making a Proxmox VE installer using the Debian 11.2.0 DVD image, and ran into the same problem. This is the source of the error, in DEBIAN/postinst:

Bash:
case "$1" in
    configure)
        fix_dhclient_file_with_space
        process_etc_network_interfaces
        process_udev
        chmod +x /usr/share/ifupdown2/__main__.py
        postinst_remove_diverts
        if [ -f "/tmp/.ifupdown2-first-install" ] && [ ! -e /proxmox_install_mode ]; then
            proxmox_compatibility
            echo "Reloading network config on first install"
            ifreload -a
            rm  /tmp/.ifupdown2-first-install
        fi
    ;;

The issue is that, during installation, in the /target chroot, the directory /run/network does not exist. When ifreload runs, it tries to make a lockfile /run/network/.lockfile and fails, and it thinks that "another instance is already running" (this is from the error message in /var/log/syslog).

IMHO the proper fix here is to use deb-systemd-invoke:

Bash:
            echo "Reloading network config on first install"
            deb-systemd-invoke reload networking

During installation, /usr/sbin/policy-rc.d always returns 101, so deb-systemd-invoke does not actually execute the reload. Also IMHO, an even better fix would be to not check for /proxmox_install_mode, but instead check whether policy-rc.d returns 101, and act accordingly.

There are a couple of workarounds that I have tested, both work just fine:

Bash:
            echo "Reloading network config on first install"
            /usr/share/ifupdown2/sbin/start-networking reload

Bash:
            echo "Reloading network config on first install"
            mkdir /run/network
            ifreload -a

The first one works because the start-networking script creates the /run/network directory before calling ifreload. The second one just creates the /run/network directory.

As for my ISO, it's working right now (via serial console, using text mode, and using GUI). I will share it when it's ready -- I hope it will be useful for the unattended install use case.
 
Hi,

Any idea about pve 7 unattended install ?
Any up to day wiki/guide ?

If someone can help with advice will be great, currently I'm try to do that with packer . I need a pve img for auto-deployment with maas however I'm not sure from where to start, any specific requirement for debian and pve 7 ?

note: the question is more general not specific for packer or ubuntu maas


Regards,
Hi! Was this solved? It would be nice to have a preseed.cfg file for latest Proxmox I could use with Ventoy. https://forum.proxmox.com/threads/unattended-installation-with-ventoy.121416/ I have pretty standard PC hardware, I just want to install the OS and SSH automatically if possible.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!