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. #11405

Closed
Romainj1 opened this issue Nov 20, 2021 · 2 comments

Comments

@Romainj1
Copy link

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
@Romainj1 Romainj1 added the bug label Nov 20, 2021
@Romainj1 Romainj1 changed the title Builder vagrant with libvirt: Remote connection disconnect. to a box made from the packer-built image. Builder vagrant with libvirt: "Remote connection disconnect" error to connect to a box made from the packer-built image. Nov 20, 2021
@github-actions
Copy link

This issue has been migrated to hashicorp/packer-plugin-vagrant#41 due to the Packer Plugin split.

Please follow the new issue for updates.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants