boilerplates icon indicating copy to clipboard operation
boilerplates copied to clipboard

VM stuck at cloud-init running "init-local"

Open EsharkyTheGreat opened this issue 2 years ago • 9 comments

I was following your video on creating a ubuntu template with cloud-inti on proxmox using packer but ran into this issue -

image The VM doesn't proceed further than this an the script is still waiting for SSH to be accessible

image

Have you faced this issue or do you possibly know of any fix ? Any help is appreciated

EsharkyTheGreat avatar May 20 '22 04:05 EsharkyTheGreat

I am facing the same issue for ubuntu focal with exactly the same error messages. Unfortunately, I have not found a solution myself yet. Mainly because I have no idea how to debug this.

davosian avatar May 20 '22 16:05 davosian

If I am trying to use 22.04 jammy, I get stuck at the following screen:

image

In both cases, packer stops at Waiting for SSH to become available... until it eventually times out.

davosian avatar May 20 '22 16:05 davosian

Can you guys share the logs of your machines and user-data conf?

ChristianLempa avatar May 20 '22 16:05 ChristianLempa

Absolutely! For user-data, I only changed the user to ubuntu and set the password to ubuntu:

#cloud-config
autoinstall:
  version: 1
  locale: en_US
  keyboard:
    layout: de
  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/Berlin
    users:
      - name: ubuntu
        groups: [adm, sudo]
        lock-passwd: false
        sudo: ALL=(ALL) NOPASSWD:ALL
        shell: /bin/bash
        passwd: $6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0

How can I send you the server logs? Since I do not get any further, there is no SSH connection set up yet.

davosian avatar May 20 '22 16:05 davosian

@davosian have you found any fix for it ?

EsharkyTheGreat avatar May 21 '22 18:05 EsharkyTheGreat

Unfortunately not until now. As as workaround, I ditched Packer and went with cloud based images created with qm instead: https://austinsnerdythings.com/2021/08/30/how-to-create-a-proxmox-ubuntu-cloud-init-image/

I prefer the packer approach but I spent way too much time without success. I tried the packer approach with Ubuntu 20.04, 22.04 and Debian 11. Neither one would work for me so it looks like the issue is a more general one (or I have more than one issue with this approach).

Curious to hear if someone has found a solution.

davosian avatar May 25 '22 18:05 davosian

I've got the same error, I was trying with ssh username and password auth for the ubuntu jamy. I switch to ssh key auth and it works. In user-data

#cloud-config
autoinstall:
  version: 1
  locale: en_US
  keyboard:
    layout: en
  ssh:
    install-server: true
    allow-pw: true
    disable_root: false
    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/Paris
    users:
      - name: ubuntu
        groups: [adm, sudo]
        lock-passwd: false
        sudo: ALL=(ALL) NOPASSWD:ALL
        shell: /bin/bash
        #passwd: test
        # - or -
        ssh_authorized_keys:
         - ssh-rsa AAAAB3Nz.......

In ubuntu-server-jammy-docker.pkr

   ssh_username = "ubuntu"

    # (Option 1) Add your Password here
    #ssh_password = "${var.vm_ssh_password}"
    # - or -
    # (Option 2) Add your Private SSH KEY file here
    ssh_private_key_file = "~/.ssh/id_rsa"

    # Raise the timeout, when installation takes longer
    ssh_timeout = "30m"

I hope that it will fix your issue.

thegostisdead avatar Jun 12 '22 09:06 thegostisdead

Hi @EsharkyTheGreat & @davosian

I had the similar issues and it helped me to set the following options:

https://github.com/xcad2k/boilerplates/blob/de7670a9068201b2eb5316ee539ca4446ca10cff/packer/proxmox/ubuntu-server-jammy/ubuntu-server-jammy.pkr.hcl#L90-L93

After settings these options it was a firewall blocking in my home lab. Maybe this helps finding the issue.

dortlii avatar Oct 06 '22 20:10 dortlii

Thanks a lot for the tip @dortlii . Will have to give it another shot 👍

davosian avatar Oct 06 '22 21:10 davosian

Check if you can get a DHCP lease. Also, for me it worked some time ago from my Mac, now, since I got Ventura, even though the HTTP server starts, it seems it does not reach it. I installed a Ubuntu machine in Proxmox and build the images from there.

andrei-matei avatar Nov 10 '22 19:11 andrei-matei