Ssh issues for raw build of ubuntu 20.04

New to packer, so probably totally messed up.
Trying to build an ubuntu-20.04 from the iso.
During the ubuntu install, I tell it to install the SSH server, but not copy any keys.
After initial install, ubuntu starts downloading updates, but before it finishes virtualbox terminates it with the message:

==> virtualbox-iso: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain

What are the username and password it is complaining about? I tried setting ssh_username and ssh_password in the .json file but nowhere are they given to the os during the install process, so I suspect I’m doing something wrong.

As the ubuntu os is still updating, it may be the ssh server isn’t even running at this point. I have ssh_timeout set to 1000s, which is about 16 min, and I get the above message much sooner than that.

Any hints would be much appreciated. Thanks.

I am using a preseed file for automated installation and while this process I am also creating a “setup” user (including sudo) for the rest of the Packer run.

Long story short: you will have to create a user (or set a password for root) for the Packer run/ ssh connection. Packer won’t handle it for you.

Thank you.
I am having trouble getting packer to even read my preseed file; it seems to be using a different preseed.cfg. I have tried setting the user variable “preseed_path” to both “preseed.cfg” and “/preseed.cfg”; and I have tried setting the “http_directory” to an absolute path.

 .../packer/ubuntu/http/preseed.cfg
  cd .../packer/ubuntu
  packer build ubuntu_18.04.json

The .json file includes:

 
{
 "builders": [
   {
     "boot_command": [
     ...
      " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user 
          `preseed_path`}}",
      " preseed/url/checksum={{user `preseed_checksum`}}",
     ...
 ],
 ...
 "http_directory": "http",
 ...
 }
 "variables": {
  ...
  "preseed_path": "/preseed.cfg",
  "preseed_checksum": "0037bd1e481f69e7750cf74c47248c4e",
 }
}

Once interpolated, your preseed url will look like:

preseed/url=http://127.0.0.1:1234//preseed.cfg",

I think the double-slash is getting you. Try changing “preseed_path” to

 "preseed_path": "preseed.cfg",

(no slash at the beginning) since you already have the slash defined in your url in the boot command

In these kinds of situations, I recommend trying to avoid variables altogether, and hardcoding it until you figure out what’s gone wrong. Then extract the values to variables so you can make it generalizable.

I don’t know if you’ve had a chance to take a look at the preseed guide we have, but it may be helpful: https://www.packer.io/guides/automatic-operating-system-installs/preseed_ubuntu

Also make sure you’re using the legacy version of 20.04; preseed installation was deprecated in 20.04 so the normal binary requires autoinstall with cloud-init instead. See this thread for details on troubleshooting that process: https://github.com/hashicorp/packer/issues/9115

Thanks @SwampDragons. Unfortunately, the / was not the problem. The original post was for 20.04.1 but I’ve also been trying with 18.04.5. I tried stuffing the url literally as you suggested:
" preseed/url=http://127.0.0.1:1234//preseed.cfg<wait>",
but it’s still not picked up (ubuntu 18.04.5).
Also (re)read the preseed guide. After reading the packer issue 9115 I’m wondering if I should be using a server iso other than this one:
ubuntu-18.04.5-live-server-amd64.iso
What does the “live” part imply?
Given the behavior I see (auto-fill for first few screens, then stops on the disk config screen), I’m guessing it’s using the subiquity installer instead of the debian one, which may mean I need a different iso?