Packer virtualbox ssh can't connect to unattended Ubuntu 20.04.1/2/3/4 but can connect to Ubuntu 20.4

Bug #1964642 reported by Barto
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Two years ago I was able to create a Virtualbox Ubuntu 20.04 guest in a Windows 10 host with Packer 1.5.6, using an unattended installation.
The Packer command was:
      "boot_command": [
        "<enter><enter><f6><esc><wait> ",
        "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/",
        "<enter>"
      ],
The user-data file was:
#cloud-config
autoinstall:
  version: 1
  identity:
    realname: mclibre
    hostname: ubuntu
    password: '$6$mclibre$YiuRPSZM3ZXVe4UyIqv1dvy9rUjf5/LsGCkDyaex.WN45wzVTuRmW5QLuctuicGAFZIO2M3QR8NLdtQYatKTn1'
    username: mclibre
  locale: es_ES.UTF-8
  keyboard:
    layout: es
  network:
    network:
      version: 2
      ethernets:
        ens33: {dhcp4: true, dhcp-identifier: mac}
  ssh:
    install-server: true
  late-commands:
    - sed -i 's/^#*\(send dhcp-client-identifier\).*$/\1 = hardware;/' /target/etc/dhcp/dhclient.conf
    - 'sed -i "s/dhcp4: true/&\n dhcp-identifier: mac/" /target/etc/netplan/00-installer-config.yaml'
Now, I have tried to create a Virtualbox Ubuntu 20.04.4/.3/.2/.1 guest using packer 1.5.6 but Packer can't create the image because once the installation is done, after rebooting the SSH server does not answer (the packer log error says: SSH handshake err: Timeout during SSH handshake).
I have tried with the last version of Packer, Packer 1.8.0, and the result is the same. I can create a Ubuntu Server 20.4 image but not a Ubuntu Server 20.4.1, .2, .3 or .4 image.
I can provide as much aditional information as you want.
Thanking you in advance,
Bartolome Sintes

Barto (bartolome-sintes)
description: updated
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Libera.chat.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1964642/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Revision history for this message
Barto (bartolome-sintes) wrote :

I am not sure of this bug being related to the openssh package, but the Ubuntu Foundations Team Bug Bot has asked me to fill this field.

affects: ubuntu → openssh (Ubuntu)
Revision history for this message
Seth Arnold (seth-arnold) wrote :

Yeah it seems unlikely to be ssh to me -- can you ping the machine? does virtualbox networking do interfaces that can ping? Does virtualbox offer a 'console view' that you can use to debug the system?

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for reporting this bug.

As Seth said, it seems unlikely that this is ssh's fault. I don't have an easy way to use virtualbox/packer here, so I'm wondering if you could either provide more info (as Seth also requested) or an out-of-the-box way to reproduce what you're seeing (i.e., without involving third-party applications).

Thanks.

Revision history for this message
Barto (bartolome-sintes) wrote :

sergiojd: The problem I have reported happens using Packer to create VirtualBox .ova images of Ubuntu Server guests. As I have said, everything works OK using the Ubuntu Server 20.04 iso (released in 2020.04), but fails with the 20.04.1, 20.04.2, 20.04.3 or 20.04.4 isos. I would say that something has changed in Ubuntu after 20.04.

seth: During the creation of the VM, Packer uses a NAT network, so I would say I can not ping the machine.
The VM is created OK, I can login into the machine, but as Packer can not connect with SSH, the VM is destroyed some minutes later when Packer cancels the build. Virtualbox defines port forwarding (127.0.0.1:xxxx) and I have tried to connect the guest using WinSCP or Putty, but both can't connect neither.

I send attached the log file created by VirtualBox.

Revision history for this message
Paride Legovini (paride) wrote :

Hello Barto,

If I understand it correctly you can create working images using 20.04 ISOs *right now*, but with the exact same tooling images created with 20.04.x ISOs do not work. I think you have been clear about this, but it is of course very important to know that the only moving part is the ISO image.

Given that you have console access to the machine, at least for a few minutes before Virtualbox tears it down, can you please share the output of the following commands?

 - ip addr
 - systemctl status
 - systemctl status ssh

My wild guess here is that for some reason the 20.04.x images get a different Ethernet interface name (you hardcoded ens33 in cloud-config).

Also: can you login from the machine to itself (ssh mclibre@127.0.0.1)?

Also: can you share the contents of /etc/dhcp/dhclient.conf and /etc/netplan/00-installer-config.yaml?

Thank you.

Paride Legovini (paride)
Changed in openssh (Ubuntu):
status: New → Incomplete
Revision history for this message
Barto (bartolome-sintes) wrote :

Thank you for your help, paride. Now, answering your questions:

Yes, I am using last versions of Packer (1.8.0) and VirtualBox (6.1.32). Host is Windows 10. Ubuntu 20.04 works, but .1, .2, .3 and .4 update releases don't. By the way, the situation is worse in jammy daily builds because I can not even begin the unattended instalation (I have opened a question about this problem in Ubuntu forums https://ubuntuforums.org/showthread.php?t=2472899).

ens33 is in user-data file just because I copied a working example of autoinstall file.

I can ssh login from the machine to itself.

I have made some screenshots showing the output of commands you asked me for.

Revision history for this message
Barto (bartolome-sintes) wrote :

ip_addr

Revision history for this message
Barto (bartolome-sintes) wrote :

systemctl status (1)

Revision history for this message
Barto (bartolome-sintes) wrote :

systemctl status (2)

Revision history for this message
Barto (bartolome-sintes) wrote :

systemctl status ssh

Revision history for this message
Barto (bartolome-sintes) wrote :

ssh mclibre@127.0.0.1

Revision history for this message
Barto (bartolome-sintes) wrote :

/etc/dhcp/dhclient.conf (1)

Revision history for this message
Barto (bartolome-sintes) wrote :

/etc/dhcp/dhclient.conf (2)

Revision history for this message
Barto (bartolome-sintes) wrote :

/etc/netplan/00-installer-config.yaml

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for openssh (Ubuntu) because there has been no activity for 60 days.]

Changed in openssh (Ubuntu):
status: Incomplete → Expired
tags: added: server-triage-discuss
tags: removed: server-triage-discuss
Changed in openssh (Ubuntu):
status: Expired → Invalid
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Hi Barto,

Sorry for the delay on getting beck to this one.

Is dhcp running? It seems there is a network configuration issue here. Therefore, I am marking this bug as invalid.

If you still believe this is a bug and not a configuration issue, please, add the steps needed to get the issue reproduced and include the ssh debugging logs here.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.