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

Builder vagrant with libvirt: "Remote connection disconnect" error to connect to a box made from the packer-built image. #41

Open
hc-github-team-packer opened this issue Nov 22, 2021 · 0 comments

Comments

@hc-github-team-packer
Copy link

This issue was originally opened by @Romainj1 in hashicorp/packer#11405 and has been migrated to this repository. The original issue description is below.


Overview of the Issue

I am trying to use the vagrant builder. I achieve creating a new image out of an existing one in my example. But the image created seems unusable: When creating a new box out of the new image, with vagrant up, vagrant cannot ssh: Remote connection disconnect ...
I tried generic/debian10 and generic/debian9 as base images.

Reproduction Steps

Run:

cat > box.json <<EOF
{
  "builders": [
    {
      "communicator": "ssh",
      "source_path": "generic/debian10",
      "provider": "libvirt",
      "type": "vagrant"
    }
  ]
}
EOF

packer validate box.json
packer build box.json

Then as the doc mentions:

vagrant box add -f new-box ./output-vagrant/package.box
vagrant init new-box

Everything works as expected, until:

vagrant up

Where i am getting:

Bringing machine 'default' up with 'libvirt' provider...                                                                                                                                                           
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...    
==> default:  -- Name:              devops-scripts_default
==> default:  -- Description:       Source: /home/rjacquier/dev/devops-scripts/Vagrantfile
==> default:  -- Domain type:       kvm            
==> default:  -- Cpus:              1                                                                    
==> default:  -- Feature:           acpi           
==> default:  -- Feature:           apic                                                                 
==> default:  -- Feature:           pae            
==> default:  -- Clock offset:      utc                                                                  
==> default:  -- Memory:            512M           
==> default:  -- Management MAC:                                                                         
==> default:  -- Loader:                           
==> default:  -- Nvram:                                                                                  
==> default:  -- Base box:          box 
==> default:  -- Storage pool:      default                                                              
==> default:  -- Image():     /home/.libvirt_images/devops-scripts_default.img, 128G
==> default:  -- Disk driver opts:  cache='default' 
==> default:  -- Kernel:                                                                                                                                                                                           
==> default:  -- Initrd:            
==> default:  -- Graphics Type:     vnc
==> default:  -- Graphics Port:     -1
==> default:  -- Graphics IP:       127.0.0.1
==> default:  -- Graphics Password: Not defined
==> default:  -- Video Type:        cirrus
==> default:  -- Video VRAM:        9216
==> default:  -- Sound Type:
==> default:  -- Keymap:            en-us
==> default:  -- TPM Backend:       passthrough
==> default:  -- TPM Path:          
==> default:  -- INPUT:             type=mouse, bus=ps2
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 192.168.121.13:22
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
...

until it timeouts

Packer version

$ packer version
Packer v1.7.8

Simplified Packer Template

Json template:

{
  "builders": [
    {
      "communicator": "ssh",
      "source_path": "generic/debian10",
      "provider": "libvirt",
      "type": "vagrant"
    }
  ]
}

Operating system and Environment details

$ uname -a
Linux rjr-port 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

$ vagrant --version
Vagrant 2.2.19

$ virsh --version
7.0.0
$ libvirtd --version
libvirtd (libvirt) 7.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant