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

Stuck at 'Waiting for SSH to become available...' when building Ubuntu VM using Packer #12832

Closed
YashPimple opened this issue Feb 4, 2024 · 4 comments

Comments

@YashPimple
Copy link

I'm encountering an issue while building an Pytorch-Ubuntu VM using Packer. The process seems to get stuck at the 'Waiting for SSH to become available...' step and doesn't proceed further. I've provided my pytorch-ubuntu.pkr.hcl file for reference.

packer {
  required_plugins {
    qemu = {
      version = "~> 1"
      source  = "github.com/hashicorp/qemu"
    }
  }
}

variable "pytorch_version" {
  default = "2.2.0"
}

source "qemu" "pytorch" {
  iso_url        = "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img"
  iso_checksum   = "sha256:9f8a0d84b81a1d481aafca2337cb9f0c1fdf697239ac488177cf29c97d706c25"
  ssh_username   = "root"
  format         = "qcow2"
  vm_name        = "pytorch-ubuntu-vm"
  net_device     = "virtio-net"
  disk_interface = "virtio"
  boot_wait      = "10s"
  headless       = "true"
  memory         = 2048
}

build {
  sources = ["source.qemu.pytorch"]

  provisioner "shell" {
    inline = [
      "sudo apt update",
      "sudo apt install -y python3-pip",
      "pip3 install torch==${var.pytorch_version}",
    ]
  }

  provisioner "shell" {
    inline = ["echo Running ${var.pytorch_version} VM image."]
  }
}

Expected Behavior:
The Packer build process should proceed beyond the 'Waiting for SSH to become available...' stage and complete successfully.

Actual Behavior:
The process gets stuck at the SSH waiting stage.

Copy link

github-actions bot commented Feb 4, 2024

Hi 👋 thanks for reaching out.

For general questions we recommend reaching out to the [community forum](https://discuss.hashicorp.com/c/packer) for greater visibility.
As the GitHub issue tracker is only watched by a small subset of maintainers and is really reserved for bugs and enhancements, you'll have a better chance of finding someone who can help you in the forum.
We'll mark this issue as needs-reply to help inform maintainers that this question is awaiting a response.
If no activity is taken on this question within 30 days it will be automatically closed.

If you find the forum to be more helpful or if you've found the answer to your question elsewhere please feel free to post a response and close the issue.

@deric
Copy link

deric commented Feb 6, 2024

@YashPimple You can't connect via ssh, if there is no sshd running or no network available.

Shell provisioner is using ssh communicator, but you don't have username/password or ssh keys configured yet.

See e.g. qemu example

the boot_command is used to configure ssh server (in preseed.cfg)

d-i pkgsel/include string openssh-server

and also configures username and password. Have a look at debugging logs:

PACKER_LOG=1 packer build pytorch-ubuntu.pkr.hcl

Copy link

github-actions bot commented Mar 1, 2024

Hi,

This issue has not received any update in the last 3 weeks, and will automatically be closed in 7 days if it does not receive any activity by then.

If you find the community forum to be more helpful or if you've found the answer to your question elsewhere please feel free to post a response and close the issue.

Copy link

github-actions bot commented Apr 3, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants