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

Packer fails to build Vagrant box for Ubuntu 20.04 #9115

Open
fasmat opened this issue Apr 24, 2020 · 139 comments
Open

Packer fails to build Vagrant box for Ubuntu 20.04 #9115

fasmat opened this issue Apr 24, 2020 · 139 comments
Labels
core Core components of Packer enhancement

Comments

@fasmat
Copy link

fasmat commented Apr 24, 2020

Feature Description

Ubuntu has switched its installer from the debian installer to subiquity. Starting with 20.04 no more alternate images will be provided: https://discourse.ubuntu.com/t/server-installer-plans-for-20-04-lts/13631

This breaks unattended packer builds (vmware-iso, virtualbox-iso, hyperv-iso) for Ubuntu. Starting with 20.04 no alternate images seem to be available that could be used until recently to build vagrant boxes with packer.

Use Case(s)

If unattended installations for ubuntu will be supported in the future, subiquity has to be used instead of d-i.

@JulyIghor
Copy link

JulyIghor commented Apr 25, 2020

Right, we need packer template for cloud-init config.
Some part of code:

 "boot_command": [
     "<enter><wait><enter><wait><f6><esc>",
     "autoinstall ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/",
     "<enter>"
  ],

@fasmat
Copy link
Author

fasmat commented Apr 26, 2020

One problem I have is that grub now automatically boots the live system after a few seconds and before packer starts typing the boot_command over VNC. Maybe this can be adjusted with the boot_wait parameter but I didn't try yet.

@JulyIghor
Copy link

JulyIghor commented Apr 26, 2020

"iso_checksum": "36f15879bd9dfd061cd588620a164a82972663fdd148cce1f70d57d314c21b73",
"iso_url": "http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/ubuntu-20.04-legacy-server-amd64.iso",

@fasmat
Copy link
Author

fasmat commented Apr 26, 2020

@JulyIghor Thanks for the link to the legacy installer. This can be used as a substitute for now, but Ubuntu has been using subiquity since Ubuntu 18.04 as the official installer and with 20.04 dropped support for d-i.

@rubenst2013
Copy link

On top of that, the new installer runs its own ssh server during installation which packer picks up on in error.
We actuslly need to let the autoinstall finish AND reboot, which THEN runs the ssh server we want.
No idea how to accomplish that so far. :/

@JulyIghor
Copy link

JulyIghor commented Apr 27, 2020

On top of that, the new installer runs its own ssh server during installation which packer picks up on in error.
We actuslly need to let the autoinstall finish AND reboot, which THEN runs the ssh server we want.
No idea how to accomplish that so far. :/

Actually with cloud-init we can do everything without SSH server at all.
So this packer template is deprecated.

I have managed to use this #9115 (comment) and get #cloud-config applied. But it does not work in UEFI mode.
As I understand it requires to add additional parameters to initd command line.
I would fix it if I knew Ubuntu better.
I got grub command line, what to do next to get it booted?

@fasmat
Copy link
Author

fasmat commented Apr 27, 2020

@JulyIghor how did you achieve to get to the grub command line? For me Grub always boots up ubuntu before packer starts typing, so unless I manually intervene the boot command isn't sent to the VM before it is too late.

I'm unfortunately also not sure how to proceed. According to https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/QuickStart the boot_command you provided should already be sufficient to install the ubuntu system, assuming the cloud-config contains all information necessary for an autoinstall.

@rubenst2013
Copy link

@JulyIghor how did you achieve to get to the grub command line? For me Grub always boots up ubuntu before packer starts typing, so unless I manually intervene the boot command isn't sent to the VM before it is too late.

I'm unfortunately also not sure how to proceed. According to https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/QuickStart the boot_command you provided should already be sufficient to install the ubuntu system, assuming the cloud-config contains all information necessary for an autoinstall.

You actually just need to be quick enough to stop the ISO's grub boot loader from starting the installer and instead type the boot command.
In my experiments, based on the work of @geerlingguy and @nickcharlton, a boot wait of 5s was spot on. The exact value for you may differ depending on the system performance.

@JulyIghor
Copy link

@JulyIghor how did you achieve to get to the grub command line? For me Grub always boots up ubuntu before packer starts typing, so unless I manually intervene the boot command isn't sent to the VM before it is too late.

I'm unfortunately also not sure how to proceed. According to https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/QuickStart the boot_command you provided should already be sufficient to install the ubuntu system, assuming the cloud-config contains all information necessary for an autoinstall.

I was able to do it only when UEFI disabled in VM bios. And this is not we need.

@tknerr
Copy link

tknerr commented Apr 28, 2020

FYI - this is the work from @nickcharlton with a working cloud-init configuration template for 20.04:

In the mean time, if someone wants to take a look at this, I've written up my notes which have a working configuration: https://nickcharlton.net/posts/automating-ubuntu-2004-installs-with-packer.html

(via chef/bento#1281 (comment))

@nickcharlton
Copy link

On top of that, the new installer runs its own ssh server during installation which packer picks up on in error.
We actuslly need to let the autoinstall finish AND reboot, which THEN runs the ssh server we want.
No idea how to accomplish that so far. :/

On this problem specifically, @rubenst2013, a potential solution is to use pause_before_connecting to stop us connecting to the installer's ssh.

In practice with my experiments, I'd been seeing random build failures because of it.

@JulyIghor
Copy link

FYI - this is the work from @nickcharlton with a working cloud-init configuration template for 20.04:

In the mean time, if someone wants to take a look at this, I've written up my notes which have a working configuration: https://nickcharlton.net/posts/automating-ubuntu-2004-installs-with-packer.html

(via chef/bento#1281 (comment))

HTTP url is correct? or it should be http://{{.HTTPIP}}:{{.HTTPPort}} ?

@JulyIghor
Copy link

FYI - this is the work from @nickcharlton with a working cloud-init configuration template for 20.04:

In the mean time, if someone wants to take a look at this, I've written up my notes which have a working configuration: https://nickcharlton.net/posts/automating-ubuntu-2004-installs-with-packer.html

(via chef/bento#1281 (comment))

on Parallels Desktop it does not work, ALT+F2 doing nothing, but 'E' does open editor where I can add command.

@nickcharlton
Copy link

Ah, nice catch @JulyIghor. It should indeed be: http://{{ .HTTPIP }}:{{ .HTTPPort }}/. Jekyll/the markdown parser is breaking it.

@JulyIghor
Copy link

This boot command should work, but it doesn't

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

@JulyIghor
Copy link

This boot command should work, but it doesn't

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

It did no requests to http server, and I got Language selection dialog

@nickcharlton
Copy link

I'm wondering if the existing value for the boot options is what's causing this (unless you're entering them differently from my one): I'm appending autoinstall ... onto what's already there, so the boot command ends up being:

initrd=/casper/initrd quiet -- autoinstall ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/

@JulyIghor
Copy link

I'm wondering if the existing value for the boot options is what's causing this (unless you're entering them differently from my one): I'm appending autoinstall ... onto what's already there, so the boot command ends up being:

initrd=/casper/initrd quiet -- autoinstall ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/

image

@rubenst2013
Copy link

@nickcharlton @JulyIghor We could schedule a workshop via discord or some other platform to figure this out and then post the results here. what do you think? 💡

@JulyIghor
Copy link

JulyIghor commented Apr 28, 2020

@nickcharlton @JulyIghor We could schedule a workshop via discord or some other platform to figure this out and then post the results here. what do you think? 💡

https://t.me/joinchat/CO-Y3hxWngKWrsmTUsPV7Q - the chat history lost, sorry

@SwampDragons SwampDragons added the core Core components of Packer label Apr 28, 2020
@SwampDragons SwampDragons added this to the 1.5.7 milestone Apr 28, 2020
rubenst2013 added a commit to rubenst2013/packer-boxes that referenced this issue Apr 29, 2020
The new Ubuntu Server installer starts an SSH server.
The credentials are installer:<random_pw>
Packer wrongfully tries to connect to this SSH, thinking the VM is ready for further provisioning steps - which it is NOT.

Thanks to @JulyIghor we found a workaround.
We simply change the port packer expects the ssh server to run at to something else AND during cloud-init late_commands we override the servers port accordingly. That way once the cloud-init finishes and reboots the VM the ssh server will run at the new port - now packer picks up on that and continues provisiong as we are used to.

As a last step durng provision, we remove the conf file, essentially resettign the ssh server port back to default 22.

@SwampDragons:
hashicorp/packer#9115
Please check on the logic behind communicator setting "pause_before_connecting".
That setting actually does still try to connect ONCE and then waits, instead of waiting for the specified duration and then and only then trying to connect. Thanks!
@JulyIghor
Copy link

I'm wondering if the existing value for the boot options is what's causing this (unless you're entering them differently from my one): I'm appending autoinstall ... onto what's already there, so the boot command ends up being:

initrd=/casper/initrd quiet -- autoinstall ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/

image

Here is working grub command line

set gfxpayload=keep
linux /casper/vmlinuz "ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/" quiet autoinstall ---
initrd /casper/initrd
boot

@rubenst2013
Copy link

Hi @JulyIghor,
The quotes on the command line didn't work for me when I tried them out of curiosity.
Though I think you are simply missing a dash. As explained here, grub uses a tripple-dash to separate different command line parts:
https://stackoverflow.com/questions/11552950/triple-dash-on-linux-kernel-command-line-switches

@JulyIghor
Copy link

Hi @JulyIghor,
The quotes on the command line didn't work for me when I tried them out of curiosity.
Though I think you are simply missing a dash. As explained here, grub uses a tripple-dash to separate different command line parts:
https://stackoverflow.com/questions/11552950/triple-dash-on-linux-kernel-command-line-switches

This example is about grub config. I'm talking about grub command line.
If I remove quotes, it just ignored. As it said in the grub welcome screen, it works bash like. So quotes required to escape some characters I think.

@nywilken nywilken modified the milestones: 1.5.7, 1.6.0 Apr 29, 2020
@vesubramanian
Copy link

OK. Will do. Anyways, thanks a lot for your constant support.

@vesubramanian
Copy link

Before I post, I just need some inputs from you. I was following the link. As per this link, I created an http directory with an empty meta-data file and another user-data file. The user-data file has a section for installing ssh server. Am I doing something wrong with this? I am pasting my user-data content below.

#cloud-config autoinstall: version: 1 locale: en_US keyboard: layout: en variant: us network: network: version: 2 ethernets: ens192: dhcp4: true storage: layout: name: lvm identity: hostname: my-ubuntu username: myUser password: <password> ssh: install-server: yes allow-pw: true authorized-keys: - ssh-rsa <ssh-public-key> myUser@mydomain.com user-data: disable_root: false late-commands: - echo 'myUser ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu

As you mentioned, during the packer build, after it generated the IP, I tried connecting to it using PuTTY, but got access denied when I tried connecting using myUser. Can you please check this once and let me know if I am doing something wrong or missing something?

@jhawk28
Copy link
Contributor

jhawk28 commented Sep 12, 2021

@vesubramanian I have had better success by creating a floppy disk with the cidata tag. You can debug what is happening by opening up the VM's console in vSphere. Use the https://www.packer.io/docs/commands/build#ask -on-error=ask so that the vm stays up.

@vesubramanian
Copy link

@jhawk28 If you don't mind, can you please share your JSON and the user-data files?

@jhawk28
Copy link
Contributor

jhawk28 commented Sep 12, 2021

@vesubramanian Here is an example that has the has the floppy files from earlier in the discussion: https://gist.github.com/DVAlexHiggs/03cdbef887736f03dcfe6d1749c18669

Ubuntu 20.04+ is hard because it often has runtime issues. I have run into cloud-init misconfigurations, installer bugs, network issues, and timing issues. If the cloud-init has syntax errors, it will not be read. If the VM is not able to get an IP, the cloud-init will not be read. A timing issue will not read the file either (if packer waits too long to send in the commands) The usual symptom is that the installer just goes to the manual config screen.

If there is an installer bug or or a misconfiguration in the cloud-init, you will see an error in the install logs. You can view them on the VM by switching to a different TTY.

@vesubramanian
Copy link

@jhawk28 Thank you for sharing. I have a couple of questions.

  1. How did you get the password for ubuntu user in user-data file?
  2. In your builder section, I don't see attributes for DataCenter, Cluster etc.

@jhawk28
Copy link
Contributor

jhawk28 commented Sep 12, 2021

@vesubramanian

  1. you generate the password hash that you want to use: https://askubuntu.com/questions/1261451/how-to-generate-crypted-password-for-auto-install
  2. it was for the virtualbox-iso builder. You would need the datacenter, cluster, etc for the vsphere-iso builder.

NOTE: Ubuntu's documentation on automating server installs may be useful: https://ubuntu.com/server/docs/install/autoinstall

@vesubramanian
Copy link

Also, I managed to do some more troubleshooting. I was watching the console (earlier, I didn't know how to get to the console from the datastore in vSphere, now I figured out, since I am very new to it). It waits at one point asking whether to continue with auto install or not. Although the boot command has auto install mentioned, it doesn't seem to pick it up. So, I typed yes in the console and it proceeded (not sure why manual intervention was required). Then it continued and stopped at a point with the following error "command systemd-cat returned non-zero exit status 3". I couldn't capture the whole error, since I am not sure how to do it. Also, it said the details can be found at /var/crash/some-long-file-name. I am not sure how to export it. Will this be of any help? I don't have much knowledge on Linux. Hence, please excuse me for being naive.

@jhawk28
Copy link
Contributor

jhawk28 commented Sep 12, 2021

you can switch to a different TTY using CTRL+ALT+F2 to get a command prompt to view the logs. (https://ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/)

CTRL+ALT+F1 to get back to the first one.

@jhawk28
Copy link
Contributor

jhawk28 commented Sep 12, 2021

You are going to need a very short "boot_wait" (3-5 seconds) in order for the auto install to initialized by the boot command correctly.

@vesubramanian
Copy link

@dbond007 I have opened an issue and tagged you, as suggested by you. FYI, the issue link is https://github.com/hashicorp/packer-plugin-vsphere/issues/106

@leojonathanoh
Copy link

leojonathanoh commented Sep 21, 2021

The reason that it goes to the welcome screen is because the subiquity installer had an issue.

1. It could be that an inability to connect to retrieve the cloud-init file. You can try using a floppy with the label cidata, debug why the vm cannot connect to the packer http server, or serve the user-data/meta-data files in a different way

2. It could be that the cloud-init file is invalid. Check things like the line endings and use tabs instead of spaces (its a yaml file). Use a minimal known config that has worked for someone else and add things you need from the documentation: https://ubuntu.com/server/docs/install/autoinstall-quickstart

3. there may be an issue with the boot command. vsphere needs the `root=/dev/sr0 ` in order to work. proxmox may need something else

Since you see it typing, that is good (means it caught the grub timing)

NOTE: the ubuntu auto install uses kvm as an example so it should be possible with proxmox

kvm -no-reboot -m 1024 \ -drive file=image.img,format=raw,cache=none,if=virtio \ -cdrom ~/Downloads/ubuntu-20.04-live-server-amd64.iso \ -kernel /mnt/casper/vmlinuz \ -initrd /mnt/casper/initrd \ -append 'autoinstall ds=nocloud-net;s=http://_gateway:3003/'

i've found that the first line of theuser-data file must start with #cloud-config as well. If there is another comment on the first line, it always boots to the welcome screen.

@ashishkurian
Copy link

@vesubramanian : Did you manage to fix the problem? I am also stuck at 'waiting for ssh to become available'

@konstruktoid
Copy link

konstruktoid commented Mar 16, 2022

@g0t4
Copy link

g0t4 commented Oct 14, 2022

FYI I've had good luck with ubuntu 22.04 and 22.10 using a short fixed wait at end of boot_command:

  boot_command = [
    "<esc><esc>c",

    "linux /casper/vmlinuz \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall",
    "<enter>",
    "initrd /casper/initrd",
    "<enter>",
    "boot",
    "<enter>",
    "<wait4m>"
  ]

plus increasing ssh_handshake_attempts to 20

The wait delays the initial packer SSH connection attempts.

@yanhuan0802
Copy link

yanhuan0802 commented Oct 27, 2022

Otherwise it just hangs with Nick's example here:

Screenshot 2020-06-24 at 13 08 48

@alexellis Did you solve it please? I have the same problem, which has been bothering me for a long time

@ashishkurian
Copy link

ashishkurian commented Oct 27, 2022 via email

@nickcharlton
Copy link

I've been having the best (and most) consistent results by disabling SSH early in the build, and I've not needed to change anything for a long time since that change (I run something very similar on 22.04 too): nickcharlton/packer-ubuntu-2004@69a0e27

It's unfortunate that so many have such difficulties with this, but hopefully this can help those still struggling!

@g0t4
Copy link

g0t4 commented Oct 27, 2022

@nickcharlton SSH winds up being re-enabled so I've resorted to adding a fixed (minimal) wait period to the end of my boot command "" or "" depending on what release/arch I'm buidling... and then I bump up connection attempts before failure so the idea is to minimze false positive log messages that the SSH connection failed and then whatever delta of time variability in boot_command execution time exists > wait time is covered by the SSH connection attempts increase. #9115 (comment)

@yanhuan0802 I think you have a different issue as the installer is stuck on picking a language, have you checked what your boot_command should be doing versus what actually happens when the machine boots up initially? Of course the SSH connection will fail given the boot_command failed.

@yanhuan0802
Copy link

yanhuan0802 commented Nov 4, 2022

@g0t4 I have solved the problem. Thank you for your reply.

@Rikill
Copy link

Rikill commented Nov 7, 2022

@g0t4 I have solved the problem. Thank you for your reply.

How?

@yeahdongcn
Copy link

yeahdongcn commented Nov 26, 2022

The following hcl config works for me to install Ubuntu 20.04 (focal):

  firmware               = "/usr/share/ovmf/OVMF.fd"
  boot_command = [
    "c<wait>",
    "set gfxpayload=keep<enter>",
    "linux /casper/vmlinuz ",
    "\"net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/http/${var.config_file}/ \" ",
    "quiet autoinstall ---<enter>",
    "initrd /casper/initrd<enter>",
    "boot<enter>"
  ]
  boot_wait              = "5s"

@marciacristaldo
Copy link

@g0t4 I have de same problem, the installer is stuck on picking a language. I need help.

My json is.

{
"builders": [
{
"type": "vsphere-iso",
"vcenter_server": "{{user vsphere-server}}",
"username": "{{user vsphere-user}}",
"password": "{{user vsphere-password}}",
"insecure_connection": "true",
"datacenter": "{{user vsphere-datacenter}}",
"cluster": "{{user vsphere-cluster}}",
"datastore": "{{user vsphere-datastore}}",
"folder": "{{user vsphere-folder}}",
"guest_os_type": "ubuntu64Guest",
"remove_cdrom": "true",
"cd_files": [
"cidata/user-data",
"cidata/meta-data"
],
"cd_label": "cidata",
"CPUs": 2,
"RAM": 2048,
"RAM_reserve_all": false,
"disk_controller_type": "pvscsi",
"storage": {
"disk_size": 15000,
"disk_thin_provisioned": true
},
"network_adapters": {
"network": "{{user vsphere-network}}",
"network_card": "vmxnet3"
},
"vm_name": "{{user vm-name}}",
"vm_version": 15,
"notes": "Template construído via pipeline em {{ isotime }} (UTC)",
"convert_to_template": true,
"ssh_username": "{{user template_username}}",
"ssh_password": "{{user template_password}}",
"ssh_timeout": "30m",
"ssh_handshake_attempts": "20",
"iso_urls": [
"{{user iso_url}}"
],
"iso_checksum": "{{user iso_checksum_type}}:{{user iso_checksum}}",
"boot_wait": "5s",
"boot_command": [
"",
"",
"/casper/vmlinuz ",
"root=/dev/sr0 ",
"initrd=/casper/initrd ",
"autoinstall ds=nocloud",
""
]
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo '{{user template_password}}' | sudo -S -E bash '{{.Path}}'",
"scripts": [
"cleanup.sh"
]
}
]
}

@sdake
Copy link

sdake commented Apr 10, 2023

Hi Gang,

I am not really sure where to put this, but here seems great.

All over the internet are complaints of:

==> virtualbox-iso.autogenerated_1: Error starting VM: VBoxManage error: VBoxManage: error: The virtual machine 'debian-11.6-49970802104200' has terminated unexpectedly during startup because of signal 6
==> virtualbox-iso.autogenerated_1: VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine

The only solution I have found to this is to set headless=true.

The default is headless=false, and many examples on the internet use headless=false. My system is a linux server and does not have a connected display, so perhaps this is the cause. I am unable to connect to RDS.

If anyone has suggestions on how to view the boot screen, that would be super! Here is my current approach, which is SUPER SLOW:

  vboxmanage = [
    [ "modifyvm", "{{.Name}}", "--recording", "on" ],
  ]

This creates an *webm file, which can then be viewed in a web browser. You have to literally stare at the web browser screen from start to finish though, as it seems webm can't be fast-forwarded.......... gr.

Thanks
-steve

@gomex
Copy link

gomex commented Nov 21, 2023

I have the same problem using Ubuntu 22.04 or 20.04

packer {
  required_plugins {
    virtualbox = {
      version = ">= 1.0.0"
      source  = "github.com/hashicorp/virtualbox"
    }
  }
}
source "virtualbox-iso" "ubuntu" {
  guest_os_type     = "Ubuntu_64"
  iso_url           = "https://releases.ubuntu.com/22.04/ubuntu-22.04.3-live-server-amd64.iso"
  iso_checksum      = "sha256:a4acfda10b18da50e2ec50ccaf860d7f20b389df8765611142305c0e911d16fd"
  ssh_username      = "packer"
  ssh_password      = "packer"
  shutdown_command  = "echo 'packer' | sudo -S shutdown -P now"
  vm_name           = "ubuntu_vm"
  memory            = 1024
  cpus              = 1
  headless          = true
  http_directory    = "http"
  ssh_timeout       = "60m"
  boot_wait         = "5s"
  boot_command = [
    "c<wait>",
    "set gfxpayload=keep<enter>",
    "linux /casper/vmlinuz ",
    "\"net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ \" ",
    "quiet autoinstall ---<enter>",
    "initrd /casper/initrd<enter>",
    "boot<enter>"
  ]
}
build {
  sources = ["source.virtualbox-iso.ubuntu"]
}

On the folder http I have two files:

  • meta-data: empty
  • user-data:
#cloud-config
autoinstall:
  version: 1
  early-commands:
    - systemctl stop ssh
  identity:
    hostname: ubuntu2204
    realname: ubuntu2204
    username: packer
    password: '$6$p1MmQZs.QWmMC/ax$WpR0IOxWGaS288Aoa4jKD7.IL8H5h71DhxNWQeOT3hL1kFTE3IrJk9R9o6cxJ6Ud1ATnSngjFSTxqw3KGaWzq/'
  keyboard:
    layout: en
    variant: us
  locale: en_US
  reporting:
    builtin:
      type: print
  ssh:
    install-server: true
    allow-pw: true
  packages:
    - openssh-server

I am getting this error:

==> virtualbox-iso.ubuntu: Waiting for SSH to become available...
2023/11/21 19:37:42 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:37:42 [INFO] Attempting SSH connection to 127.0.0.1:4075...
...
2023/11/21 19:38:10 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:10 [INFO] Attempting SSH connection to 127.0.0.1:4075...
2023/11/21 19:38:10 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:10 [DEBUG] reconnecting to TCP connection for SSH
2023/11/21 19:38:10 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:10 [DEBUG] handshaking with SSH
2023/11/21 19:38:14 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:14 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2023/11/21 19:38:14 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:14 [DEBUG] Detected authentication error. Increasing handshake attempts.
2023/11/21 19:38:21 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:21 [INFO] Attempting SSH connection to 127.0.0.1:4075...
2023/11/21 19:38:21 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:21 [DEBUG] reconnecting to TCP connection for SSH
2023/11/21 19:38:21 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:21 [DEBUG] handshaking with SSH
2023/11/21 19:38:24 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:24 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2023/11/21 19:38:24 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2023/11/21 19:38:24 [DEBUG] Detected authentication error. Increasing handshake attempts.

@sdake
Copy link

sdake commented Nov 24, 2023

There is so much cargo-cult-copy hence referred to as 3C related to Packer, it is absolutely astounding.

I have completed a very well-documented and described implementation, from first principles here:
https://github.com/artificialwisdomai/origin/tree/main

Thank you,
-steve

@jsundahl
Copy link

A problem with the boot_command many of you are experiencing is due to the semicolon in the ds=nocloud-net;s=http://. If you cat /proc/cmdline once booted into the installer you'll see that everything in the command up until the semicolon is included. If you escape it then it should fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core components of Packer enhancement
Projects
None yet
Development

No branches or pull requests