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?

I think you’re right that the “live” iso is using the subiquity installer: https://ubuntu.com/blog/updatable-ubuntu-server-live-installer

If that’s the case, I think you need to use 18.04 instead of 18.05, and the legacy server for 20.04: http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/

IF NOT:

What if you try

preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",

Can you share a screenshot of where it’s getting stuck? That’ll tell us right quick which installer you’re getting stuck on

You should be able to manually take over the build when it freezes and drop into an emergency shell, so you can validate whether you can actually curl that preseed file.

Not sure what you mean by 18.04 instead of 18.05. I’m using 18.04.5.
I don’t see a version of 18.04 server that is not “live”.
Screenshot(s) attached with the new preseed; I was using that before and get the same results, but did it again just to be sure (on the screenshot run).
Eventually it times out with
==> virtualbox-iso: Timeout waiting for SSH.

Can you give me a link for setting up packer with ubuntu 18.x for the live server? A bare-bones .json would probably be a big help. I’m trying to set this up on a local fbsd box before uploading to gcloud, so starting from cloud images doesn’t seem like it will work.