hashicorp / packer-plugin-proxmox

Packer plugin for Proxmox Builder
https://www.packer.io/docs/builders/proxmox
Mozilla Public License 2.0
159 stars 70 forks source link

Proxmox 6, vm Debian 9, problem with the preseed.cfg file, when we get to the storage configuration it does not continue with the installation, the screen remains blue and does not continue #6

Open ghost opened 3 years ago

ghost commented 3 years ago

This issue was originally opened by @3nueves as hashicorp/packer#10403. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Overview of the Issue

Before we start, I apologize for my English.

When the packer reaches the boot_command and uploads the preseed.cfg file this file works the problem is when we get to the step to configure the storage, at this moment the process stops and does not continue, we only see the blue screen.

Reproduction Steps

I have a 6.2-4 version of the proxmox server where I run virtual machines and I would like to have my custom ISO.

To create ISO I have two files, a configuration file and the packer file. I launch the command from my desktop:

$ packer build -var-file = config.json debian-9.13.json proxmox: the output will be in this color.

==> proxmox: Creating VM ==> proxmox: Starting VM ==> proxmox: starting the HTTP server on port 8902 ==> proxmox: Waiting 10 seconds for boot ==> proxmox: typing boot command ==> proxmox: Waiting for SSH to be available ...

It loads the proseed.cfg file without problems and runs the whole process until it reaches the storage configuration. It stops here and does not continue, it reaches the timeout.

Packer version

From packer v1.6.5

Simplified Packer Buildfile

debian-9.13.json

{
  "builders": [
    {
      .....
      "disks": [
        {
            "type": "virtio",
            "disk_size": "{{ user `disk_size`}}",
            "storage_pool": "{{user `datastore`}}",
            "storage_pool_type": "{{user `datastore_type`}}"
        }
      ],
         ......

      "iso_file": "{{user `iso`}}",
      "http_directory": "http",
      "template_description": "{{ user `template_description` }}",

      "boot_wait": "10s",
      "boot_command": [
        "{{ user `boot_command_prefix` }}",
        "install <wait>",
        "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
        "debian-installer=en_US.UTF-8 <wait>",
                "auto <wait>",
                "locale=en_US.UTF-8 <wait>",
                "kbd-chooser/method=es <wait>",
                "keyboard-configuration/xkb-keymap=es <wait>",
                "netcfg/get_hostname=node0 <wait>",
                "netcfg/get_domain=test.lan <wait>",
                "fb=false <wait>",
                "debconf/frontend=noninteractive <wait>",
                "console-setup/ask_detect=false <wait>",
                "console-keymaps-at/keymap=es <wait>",
                "grub-installer/bootdev=/dev/sda <wait>",
        "<enter><wait>"
         ]
      }
    ],
    ...
}

Vars file: config.json

{
  "template_description": "debian 9.13, generated by packer on {{ isotime \"2020-01-02T15:04:05Z\" }}",

  "hostname": "node0",
  "local_domain": "internal.test",
  "vmid": "400",
  "locale": "es_ES",
  "cores": "1",
  "sockets": "1",
  "memory": "2048",
  "disk_size": "50G",
  "datastore": "local-lvm",
  "datastore_type": "lvm",
  "iso": "local:iso/debian-9.13.0-amd64-netinst.iso",

  "boot_command_prefix": "<esc><wait>",
  "preseed_file": "preseed.cfg"
}

proseed.cfg

#Early
d-i partman/early_command string \
echo "Starting install" \
sleep 60

# Localization ----------------------------------------------------------
# d-i debian-installer/language string en
# d-i debian-installer/country string ES
# d-i debian-installer/locale string en_GB.UTF-8

# Keymap & Console ------------------------------------------------------
# d-i keyboard-configuration/xkb-keymap select es

# Network ---------------------------------------------------------------
d-i netcfg/enable boolean true
d-i netcfg/choose_interface select auto
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually

# Mirror settings ------------------------------------------------------
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.es.debian.org
d-i mirror/http/directory string /debian/
d-i mirror/http/proxy string

# Root password ---------------------------------------------------------
d-i passwd/root-password password user
d-i passwd/root-password-again password pass

# user account ----------------------------------------------------------
d-i passwd/user-fullname string user1
d-i passwd/username string user1
d-i passwd/user-password password pass
d-i passwd/user-password-again password pass
d-i passwd/user-uid string 1010

# Clock and time zone setup --------------------------------------------
d-i clock-setup/utc boolean true
d-i time/zone string Europe/Madrid
d-i clock-setup/ntp boolean true

# Partitioning ----------------------------------------------------------
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-auto/expert_recipe string                         \
      boot-root ::                                                                         \
              40 300 300 ext4                                                             \
                      $primary{ }                             \
                      $bootable{ }                            \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      mountpoint{ /boot }                     \
              .                                               \
              2000 10000 100000000 ext4     \                                                        \
                      $primary{ }                             \
                      method{ lvm }               \
                      device{ /dev/sda}   \
                      vg_name{ vg-root }                     \
                .                                                       \
              2000 10000 100000000 ext4                      \
                      $lvmok{ }                               \
                      in_vg{ vg-root }             \
                      lv_name{ lv-root }     \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      mountpoint{ / }                         \
              .                                                              \
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
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

#  Package selection -------------------------------------------------------------------
tasksel tasksel/first multiselect standard 

# Additional packages ------------------------------------------------------------------
d-i pkgsel/include string console-setup console-data openssh-server

# Custom config ------------------------------------------------------------------------
d-i preseed/late_command string  \
cp install.sh /target/root/install.sh; \
in-target apt update -y; \
in-target apt install -y sudo; \
in-target usermod -aG sudo kub; \
in-target chmod +x /root/install.sh; \
in-target  sh -c /root/install.sh;

# Boot loader installation ----------------------------------------------------
# Install grub in the first device (assuming it is not a USB stick)
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 -----------------------------------------------
d-i finish-install/reboot_in_progress note

Operating system and Environment details

proxmox: pve-manager/6.2-4/9824574a kernel version: Linux 5.4.34-1-pve hashicorp/packer#1 SMP PVE 5.4.34-2

ISO: debian-9.13.0-amd64-netinst.iso

Log Fragments and crash.log files

$ packer build -debug -var-file=config.json debian-9.13.json

==> proxmox: Pausing after run of step 'StepDownload'. Press enter to continue. ==> proxmox: Pausing after run of step 'stepUploadISO'. Press enter to continue. ==> proxmox: Pausing after run of step 'stepUploadAdditionalISOs'. Press enter to continue. ==> proxmox: Creating VM ==> proxmox: Starting VM ==> proxmox: Pausing after run of step 'stepStartVM'. Press enter to continue. ==> proxmox: Starting HTTP server on port 8605 ==> proxmox: Pausing after run of step 'StepHTTPServer'. Press enter to continue. ==> proxmox: Waiting 10s for boot ==> proxmox: Typing the boot command ==> proxmox: Pausing after run of step 'stepTypeBootCommand'. Press enter to continue. ==> proxmox: Waiting for SSH to become available... Cancelling build after receiving interrupt ==> proxmox: Pausing before cleanup of step 'stepTypeBootCommand'. Press enter to continue. ==> proxmox: Pausing before cleanup of step 'StepHTTPServer'. Press enter to continue. ==> proxmox: Pausing before cleanup of step 'stepStartVM'. Press enter to continue. ==> proxmox: Stopping VM ==> proxmox: Deleting VM ==> proxmox: Pausing before cleanup of step 'stepUploadAdditionalISOs'. Press enter to continue. ==> proxmox: Pausing before cleanup of step 'stepUploadISO'. Press enter to continue. ==> proxmox: Pausing before cleanup of step 'StepDownload'. Press enter to continue. Build 'proxmox' errored after 2 minutes 52 seconds: build was cancelled

karliemeads commented 3 years ago

@3nueves Can you please confirm that your preseed.cfg works by creating a VM without using packer? It looks like you might have a typo in it on this line, with two backslashes \:

              2000 10000 100000000 ext4     \                                                        \
3nueves commented 3 years ago

@karliemeads, Oooh, I haven't seen this typo. I will try to build a VM now by correcting this typo and testing if it works. The truth is that now I do not remember if it works without using packer. I think so but I don't remember. Thank you!!

3nueves commented 3 years ago

Hi @karliemeads , I've tried it but it hasn't worked, it behaves the same, thanks anyway.

sfratini commented 3 months ago

@3nueves Were you able to fix it? I am having the same issue. Blue screen after network config with DHCP, however the same preseed file works well and install Debian 12 correctly when creating the VM manually. I am on Proxmox 8.1, packer 1.9.4. Proxmox plugin 1.1.8

sfratini commented 3 months ago

Update on my side, it was a networking issue. Running the same preseed from S3 would work. I had two routers, and the provisioning machine was in a different subnet than the guest. I was expecting Debian to not find the file and stop but I guess it runs up to the DHCP section and halts.