Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boot command not typed properly #220

Open
mcbenjemaa opened this issue Aug 27, 2023 · 16 comments
Open

Boot command not typed properly #220

mcbenjemaa opened this issue Aug 27, 2023 · 16 comments
Labels

Comments

@mcbenjemaa
Copy link

mcbenjemaa commented Aug 27, 2023

I'm trying to create Ubuntu 22.04 with autoinstall, but somehow the boot command is not typed properly

    "boot_command": [
      "c",
      "linux /casper/vmlinuz --- autoinstall ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/' ",
      "<enter><wait>",
      "initrd /casper/initrd<enter><wait>",
      "boot<enter>"
    ],

Overview of the Issue

I'm just trying to create Ubuntu 22.04 template, with the following.

{
    "builders": [
        {
            "communicator": "ssh",
            "template_name": "{{ user `artifact_name` }}",
            "node": "{{ user `node` }}",
            "name": "{{user `build_name`}}",
            "boot_command": [
              "c",
              "linux /casper/vmlinuz --- autoinstall ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/' ",
              "<enter><wait>",
              "initrd /casper/initrd<enter><wait>",
              "boot<enter>"
            ],
            "http_directory": "{{user `http_directory`}}",
            "boot_wait": "{{user `boot_wait`}}",
            "iso_checksum": "{{user `iso_checksum`}}",
            "iso_file": "{{user `iso_file`}}",
            "iso_storage_pool": "{{user `iso_storage_pool`}}",
            "cpu_type": "{{user `cpu_type`}}",
            "memory": "{{user `memory`}}",
            "cores": "{{user `cores`}}",
            "sockets": "{{user `sockets`}}",
            "ssh_password": "{{user `ssh_password`}}",
            "ssh_timeout": "2h",
            "ssh_username": "{{user `ssh_username`}}",
            "vm_id": "{{user `vmid`}}",
            "network_adapters": [
                {
                    "bridge": "{{user `bridge`}}"
                }
            ],
            "disks": [
                {
                    "type": "scsi",
                    "disk_size": "{{user `disk_size`}}",
                    "storage_pool": "{{user `storage_pool`}}",
                    "storage_pool_type": "{{user `storage_pool_type`}}"
                }
            ],
            "insecure_skip_tls_verify": true,
            "type": "proxmox-iso",
            "unmount_iso": "{{user `unmount_iso`}}"
        }
    ],
    "provisioners": [
        {
            "expect_disconnect": true,
            "inline": [
                "ls /",
                "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done"
            ],
            "inline_shebang": "/bin/bash -e",
            "type": "shell"
          },
    ],
    "variables": {
        "proxmox_url": "{{env `PROXMOX_URL`}}",
        "username": "{{env `PROXMOX_USERNAME`}}",
        "token": "{{env `PROXMOX_TOKEN`}}",
        "node": "{{env `PROXMOX_NODE`}}",
        "iso_storage_pool": "{{env `PROXMOX_ISO_POOL`}}",
        "memory": "2048",
        "cores": "2",
        "sockets": "2",
        "disk_size": "20G",
        "storage_pool": "local-lvm",
        "storage_pool_type": "lvm",
        "bridge": "{{env `PROXMOX_BRIDGE`}}",
        "vmid": "",
        "ssh_password": "builder",
        "ssh_username": "builder",
        "boot_wait": "5s"
    }
}

when I execute this, a new VM created, and it's typing the boot command.

Screenshot 2023-08-27 at 21 21 51

and then it's stuck.

when I check the VM UI, I see something like this.
Screenshot 2023-08-27 at 21 22 23

Honestly, I don't know what's happening here.!
from time to time the typed command is different, while the code is the same.

Reproduction Steps

Steps to reproduce this issue.

execute packer build when you go to the VM UI,. you saw it.

Plugin and Packer version

From packer version Packer v1.9.4

packer {
  required_plugins {
    proxmox = {
      version = ">= 1.1.2"
      source  = "github.com/hashicorp/proxmox"
    }
  }
}

Proxmox 7.4-3

Simplified Packer Buildfile

If the file is longer than a few dozen lines, please include the URL to the
gist of the log or use the Github detailed
format

instead of posting it directly in the issue.

Operating system and Environment details

OS, Architecture, and any other information you can provide about the
environment.

Log Fragments and crash.log files

Include appropriate log fragments. If the log is longer than a few dozen lines,
please include the URL to the gist of the log or
use the Github detailed format instead of posting it directly in the issue.

Set the env var PACKER_LOG=1 for maximum log detail.

@mcbenjemaa mcbenjemaa added the bug label Aug 27, 2023
@mabeett
Copy link
Contributor

mabeett commented Aug 27, 2023

Hello @mcbenjemaa,
Can you confirm watching the console in the webUI if the c is being sent during the installer menu and not before it ? ( before there is the bootloader, CD loading, etc ).

I don't have templating using the ubuntu installer, but I see from my logs in myy context the default boot_wait fits.

==> proxmox-iso.VM: Waiting 10s for boot

In order to reproduce the bug the information about the ISO will be helpful, checksum and URL for the file.
Regards,

@mcbenjemaa
Copy link
Author

mcbenjemaa commented Aug 27, 2023

  "iso_checksum": "sha256:5e38b55d57d94ff029719342357325ed3bda38fa80054f9330dc789cd2d43931",
  "iso_url": "https://old-releases.ubuntu.com/releases/jammy/ubuntu-22.04.2-live-server-amd64.iso",

@mcbenjemaa
Copy link
Author

Can you confirm watching the console in the webUI if the c is being sent during the installer menu and not before it ? ( before there is the bootloader, CD loading, etc ).

what do you mean?

I see the c is being typed on the grub

@mcbenjemaa
Copy link
Author

Screenshot 2023-08-27 at 23 56 23

@rgl
Copy link
Contributor

rgl commented Sep 5, 2023

@mcbenjemaa try to play with the PACKER_KEY_INTERVAL=10ms environment variable and increase its value before running packer build.

FWIW, at rgl/proxmox-ve@6bcbb10 I've added support, using this provider, for installing proxmox in proxmox (its using proxmox 8; no idea if it works in your proxmox 7); it works in my machine, maybe give it a try to see if it works in yours too.

@mcbenjemaa
Copy link
Author

I'm so confused why it doesn't type /casper/initrd

Screenshot 2023-09-12 at 13 33 51

@mcbenjemaa
Copy link
Author

I need to fix this, for kubernetes-sigs/image-builder#1282

@rgl
Copy link
Contributor

rgl commented Sep 12, 2023

Oh, in my last comment, I misunderstood that you were trying to install proxmox instead of ubuntu.

The latest ubuntu 22.04.3 had some behavior changes. I had to change my vagrant template as-in the diff at:

rgl/ubuntu-vagrant@84ee2c6#diff-16562733d0990fc54d812c190627e7cd2da614c08677b85785f5e6d73bc32d58L77-L88

Maybe you should try with those changes.

@mcbenjemaa
Copy link
Author

mcbenjemaa commented Sep 13, 2023

@rgl Thanks this actually works

"c<wait>linux /casper/vmlinuz --- autoinstall ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/22.04/'<enter><wait5s>initrd /casper/initrd <enter><wait5s>boot <enter><wait5s>"

@koolwilly72
Copy link

@rgl Thanks this actually works

"c<wait>linux /casper/vmlinuz --- autoinstall ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/22.04/'<enter><wait5s>initrd /casper/initrd <enter><wait5s>boot <enter><wait5s>"

Auto-install gets stuck on the language screen. How can this be resolved?
Promox V.E 8.0.3

@vivshaw
Copy link

vivshaw commented Oct 31, 2023

I had this problem for quite some time, and was able to get past it by increasing boot_key_interval. In order to completely make the problem vanish, I had to set mine to crazy high values like "500ms". For anything lower than that, the boot command would still occasionally be mistyped.

@mcbenjemaa
Copy link
Author

There is something wrong,
The ubuntu installer was showing Waiting for cloudinit ... and then shows the language selection.
which is completely wrong,
this is was working, is it because cloud-init failed or what's the problem?

@tommy31
Copy link

tommy31 commented Jan 17, 2024

An update on this ? i keep ending on the language screen :(

@mcbenjemaa
Copy link
Author

Please try this:

#220 (comment)

If your installation got stuck in language selection, that means there's no DHCP.
So you need to add a dhcp server

@wickedgenius
Copy link

@tommy31 and anyone else that stumbles across this, I post in the hope someone else doesn't spend 3 hours chasing their own tail.

I was following the video from Christian Lempa on using Proxmox and Packer and after running into the problem initially posted here (which I resolved by setting the boot_key_interval to 200ms) I started running into an issue hitting the select language page continuously, eventually I've discovered that was caused by omitting the #cloud-config line at the start of my user-data file, I suspect other invalid entries could also cause a similar behaviour, so recommend double checking your user-data if you stumble into this issue as well.

@mpywell
Copy link
Contributor

mpywell commented Mar 7, 2024

Please try this:

#220 (comment)

If your installation got stuck in language selection, that means there's no DHCP. So you need to add a dhcp server

Also make sure the Packer HTTP IP and Port are reachable from the network the VM is attached to.. I've also seen this issue occur where an IP is acquired via DHCP, but then there are references to a Packer HTTP server somewhere in the initrd config, eg kickstart/preseed file URL path, and the VM and Packer host are unable to talk directly to each other so the installation stalls at the language selection dialog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants