hashicorp / packer-plugin-proxmox

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

Autoinstall stuck on language selection #241

Closed mcbenjemaa closed 12 months ago

mcbenjemaa commented 12 months ago

Overview of the Issue

I used packer to build proxmox template using this plugin, although that was working recently. But, now, there's something strange happening.

The VM gets booted to the installer, and then it says, Waiting for Cloudinit... and then unexpectedly goes to the language selection page ??? That's not true!

Screenshot 2023-11-20 at 17 46 27

Screenshot 2023-11-20 at 17 47 10

Screenshot 2023-11-20 at 17 42 25

I'm using Ubuntu: ubuntu-22.04.2-live-server-amd64.iso

Reproduction Steps

Steps to reproduce this issue

Plugin and Packer version

From packer version

Packer v1.9.4

Simplified Packer Buildfile

https://github.com/kubernetes-sigs/image-builder/blob/main/images/capi/packer/proxmox/packer.json

Operating system and Environment details

Ubuntu: ubuntu-22.04.2-live-server-amd64.iso

Log Fragments and crash.log files

proxmox-iso.ubuntu-2204: output will be in this color.

2023/11/20 16:53:29 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:53:29 using token auth
==> proxmox-iso.ubuntu-2204: Retrieving ISO
==> proxmox-iso.ubuntu-2204: Trying https://old-releases.ubuntu.com/releases/jammy/ubuntu-22.04.2-live-server-amd64.iso
2023/11/20 16:53:29 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:53:29 Acquiring lock for: https://old-releases.ubuntu.com/releases/jammy/ubuntu-22.04.2-live-server-amd64.iso?checksum=sha256%3A5e38b55d57d94ff029719342357325ed3bda38fa80054f9330dc789cd2d43931 (/root/.cache/packer/d6c27ed78f385b7455c218ba93bf575d7bb4c89e.iso.lock)
==> proxmox-iso.ubuntu-2204: Trying https://old-releases.ubuntu.com/releases/jammy/ubuntu-22.04.2-live-server-amd64.iso?checksum=sha256%3A5e38b55d57d94ff029719342357325ed3bda38fa80054f9330dc789cd2d43931
==> proxmox-iso.ubuntu-2204: https://old-releases.ubuntu.com/releases/jammy/ubuntu-22.04.2-live-server-amd64.iso?checksum=sha256%3A5e38b55d57d94ff029719342357325ed3bda38fa80054f9330dc789cd2d43931 => /root/.cache/packer/d6c27ed78f385b7455c218ba93bf575d7bb4c89e.iso
2023/11/20 16:53:38 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:53:38 Leaving retrieve loop for ISO
==> proxmox-iso.ubuntu-2204: Creating VM
==> proxmox-iso.ubuntu-2204: No VM ID given, getting next free from Proxmox
==> proxmox-iso.ubuntu-2204: Starting VM
2023/11/20 16:54:26 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:54:26 Found available port: 8067 on IP: 0.0.0.0
==> proxmox-iso.ubuntu-2204: Starting HTTP server on port 8067
==> proxmox-iso.ubuntu-2204: Waiting 10s for boot
==> proxmox-iso.ubuntu-2204: Typing the boot command
2023/11/20 16:54:36 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:54:36 [INFO] Waiting 1s
2023/11/20 16:54:39 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:54:39 [INFO] Waiting 5s
2023/11/20 16:54:44 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:54:44 [INFO] Waiting 5s
2023/11/20 16:54:49 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:54:49 [INFO] Waiting 5s
2023/11/20 16:54:57 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:54:57 [DEBUG] Unable to get address during connection step: 500 QEMU guest agent is not running
2023/11/20 16:54:57 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:54:57 [INFO] Waiting for SSH, up to timeout: 2h0m0s
==> proxmox-iso.ubuntu-2204: Waiting for SSH to become available...
2023/11/20 16:55:00 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:55:00 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2023/11/20 16:55:08 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:55:08 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2023/11/20 16:55:16 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:55:16 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2023/11/20 16:55:24 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:55:24 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2023/11/20 16:55:33 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:55:33 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2023/11/20 16:55:41 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:55:41 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2023/11/20 16:55:49 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:55:49 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2023/11/20 16:55:57 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:55:57 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2023/11/20 16:56:05 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:56:05 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2023/11/20 16:56:13 packer-plugin-proxmox_v1.1.6_x5.0_linux_amd64 plugin: 2023/11/20 16:56:13 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
amcharles91 commented 12 months ago

I ran into a similar issue where the cloud init drive is failing to be unmounted. Pretty much after the cloud init does it's thing, it's supposed to get unmounted and boot with the hard disk but since the unmount fails, it ends up going to the select screen of trying to install ubuntu and etc again and that ultimately thanks you to the select the language. If we have a way to configure the boot order on packer, might be a good work around but for now I opted to just manually select boot from the next volume when that screen comes up as a small work around.

mcbenjemaa commented 12 months ago

That's not what I'm expecting.

Ideally, I guess the Ubuntu team has changed something in the installer.

mcbenjemaa commented 12 months ago

I tested the same setup in a different instance, which worked fine.

mcbenjemaa commented 12 months ago

the issue was there's no DHCP

WanderingZombie commented 9 months ago

the issue was there's no DHCP

How did you resolve that?

mcbenjemaa commented 9 months ago

the issue was there's no DHCP

How did you resolve that?

Please start new dhcp server for example with dnsmasq or dhcpd

bumfighter commented 9 months ago

start new dhcp server on proxmox or where? I have my router configured to give out dhcp leases already.

GalletFlorian commented 8 months ago

I'm migrating a working automatic installation of an Ubuntu server 18.04 to 22.04 and I'm currently facing the same issue. Can you add more details on how you fixed this specific issue ?

Did you added a "network" section in your meta-data YAML file ?

GalletFlorian commented 8 months ago

I'm migrating a working automatic installation of an Ubuntu server 18.04 to 22.04 and I'm currently facing the same issue. Can you add more details on how you fixed this specific issue ?

Did you added a "network" section in your meta-data YAML file ?

At the end my user-date yaml was not correct. RTFM !!

bumfighter commented 8 months ago

Where are the docs you looked at to find this manual?

GalletFlorian commented 8 months ago

Where are the docs you looked at to find this manual?

Mainly here

https://ubuntu.com/server/docs/install/autoinstall https://ubuntu.com/server/docs/install/autoinstall-quickstart

And I used these 2 tutos as well

https://www.pugetsystems.com/labs/hpc/ubuntu-22-04-server-autoinstall-iso/ https://www.jimangel.io/posts/automate-ubuntu-22-04-lts-bare-metal/

You indeed need a DHCP connection for the installation.

WanderingZombie commented 7 months ago

For mine to work I needed to add ip=::::::dhcp::: before autoinstall, e.g. linux /casper/vmlinuz --- ip=::::::dhcp::: autoinstall ...

For ease of use with consistent assignment of fixed IP address, I also added mac_address

    network_adapters {
        :
        mac_address = "repeatable"
        mtu = 1 # Use the special value '1' to inherit the MTU value from the underlying bridge
    }
m19v commented 6 months ago

Where are the docs you looked at to find this manual?

Mainly here

https://ubuntu.com/server/docs/install/autoinstall https://ubuntu.com/server/docs/install/autoinstall-quickstart

And I used these 2 tutos as well

https://www.pugetsystems.com/labs/hpc/ubuntu-22-04-server-autoinstall-iso/ https://www.jimangel.io/posts/automate-ubuntu-22-04-lts-bare-metal/

You indeed need a DHCP connection for the installation.

Can you please describe where the DHCP connection for the installation is needed and how to set it up? In proxmox? Or where?

m19v commented 6 months ago

the issue was there's no DHCP

Can you please describe it where DHCP should be setup? On proxmox? This seems to be a common issue, can you please add some description how you exactly solved it? Thanks!

rtacconi commented 6 months ago

I still cannot pass the language selection, I do have a network config:

#cloud-config
autoinstall:
  version: 1
  locale: en_GB
  keyboard:
    layout: gb
  network:
    version: 2
    ethernets:
      ens18:
        dhcp4: true
  ssh:
    install-server: true
    allow-pw: true
    disable_root: true
    ssh_quiet_keygen: true
    allow_public_ssh_keys: true
  packages:
    - qemu-guest-agent
    - sudo
  storage:
    layout:
      name: direct
    swap:
      size: 0
  user-data:
    package_upgrade: false
    timezone: Europe/London
    users:
      - name: ubuntu
        groups: [adm, sudo]
        lock-passwd: false
        sudo: ALL=(ALL) NOPASSWD:ALL
        shell: /bin/bash
        passwd: secret
WanderingZombie commented 6 months ago

@rtacconi My working config is the same as yours except for not having the network section at all and lock_passwd instead of lock-passwd (see the comments on this post). Presumably you have set passwd to a hash, e.g. echo secret | mkpasswd -m sha-512 -s?

WanderingZombie commented 6 months ago

@m19v

the issue was there's no DHCP

Can you please describe it where DHCP should be setup? On proxmox? This seems to be a common issue, can you please add some description how you exactly solved it? Thanks!

My router provides DHCP for the network, but without telling the VM to use DHCP, it wouldn't obtain its networking config during setup.

Further to https://github.com/hashicorp/packer-plugin-proxmox/issues/241#issuecomment-2028897883 above, my settings for boot_command and boot_key_interval got DHCP working

    boot_command = [
        "<wait3s>c<wait3s>",
        "linux /casper/vmlinuz --- ",
        # <client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>:<ntp0-ip>:...
        "ip=::::::dhcp::: ",    # autoconf=dhcp - this is the line I had to add to get DHCP working
        # IP of Windows PC with port mapped to WSL2
        "autoinstall 'ds=nocloud-net;s=http://192.168.0.90:8336/'",    # even got it working with WSL2!
        "<enter><wait>",
        "initrd /casper/initrd",
        "<enter><wait>",
        "boot",
        "<enter>"
    ]

    boot_key_interval = "150ms"   # type slowly!  seems to guarantee more reliable builds even with non-boot_command steps?
m19v commented 6 months ago

@m19v

the issue was there's no DHCP

Can you please describe it where DHCP should be setup? On proxmox? This seems to be a common issue, can you please add some description how you exactly solved it? Thanks!

My router provides DHCP for the network, but without telling the VM to use DHCP, it wouldn't obtain its networking config during setup.

Further to #241 (comment) above, my settings for boot_command and boot_key_interval got DHCP working

    boot_command = [
        "<wait3s>c<wait3s>",
        "linux /casper/vmlinuz --- ",
        # <client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>:<ntp0-ip>:...
        "ip=::::::dhcp::: ",    # autoconf=dhcp - this is the line I had to add to get DHCP working
        # IP of Windows PC with port mapped to WSL2
        "autoinstall 'ds=nocloud-net;s=http://192.168.0.90:8336/'",    # even got it working with WSL2!
        "<enter><wait>",
        "initrd /casper/initrd",
        "<enter><wait>",
        "boot",
        "<enter>"
    ]

    boot_key_interval = "150ms"   # type slowly!  seems to guarantee more reliable builds even with non-boot_command steps?

Thank you very much I got in working if I run packer on Windows cmd, but with WSL2 it is not working. The problem with WSL2 is the http server is only reachable with localhost: and not my local IP address, and hence proxmox node can not reach it

goffinf commented 6 months ago

WSL2 is the http server is only reachable with localhost

You can reach it if you configure Windows to proxy the http server port through to WSL. There are plenty of posts that show how to do that for all kinds of use cases where you want to run a service within WSL but expose it externally. See accessing-a-wsl-2-distribution-from-your-local-area-network-lan

netsh interface portproxy add v4tov4 listenport=<yourPortToForward> listenaddress=0.0.0.0 connectport=<yourPortToConnectToInWSL> connectaddress=(wsl hostname -I)

tbabej commented 5 months ago

The DHCP misconfiguration is not the only way the installer TUI can be triggered, any failure to reach the autoinstall directives will do so -- for example a firewall issue or a blocked port on the machine serving the configuration over HTTP.

ChaoHsin-fang commented 1 week ago

I came across this situation and it bothered me for fews days. Installer stuck on language selection of welcome screen due to lack of user-data, it had nothing to do with the config error of user-data or dhcp server.Pls check the log of http server to see if user-data is being correctly transfered via wget. The download http URL on my grub.cfg is wrong (http:/// There's an extra slash) but manually I test wget user-data using right url http://, the problem was finally discovered