hashicorp / hashicorp/packer-plugin-virtualbox

VirtualBox 6.x using Hyper-v (for WSL2) backend breaks SSH/SCP comms

Open
#5 2 comments 0 reactions 0 assignees View on GitHub
bug builder/virtualbox
Dominant language
Go
Stars
29
Forks
45
PR merge metrics
No merged PRs in 30d

Description

_This issue was originally opened by @ciarancourtney as hashicorp/packer#9411. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._


#### Overview of the Issue

Not saying this is a packer issue, just a placeholder in case anyone else encounters it and is flummoxed like I was.

Getting error `Error uploading guest additions: ssh: disconnect, reason 2: Packet corrupt`.

Trying to SCP same file (or any file of significant size) on command line fails with same error.

Guest OS is CentOS 6.10

Tread [here](https://forums.virtualbox.org/viewtopic.php?f=6&t=90853&sid=8d70c50e0db83d8db3798449fcd13b4b&start=270) mentions similar issues incl segfaults and issues computing SHA256 sums.

Turning off Hyper-V resolves issue:

bcdedit /set hypervisorlaunchtype off
** reboot **

#### Reproduction Steps

Do a virtualbox-iso build incl guest upload on Windows 10 with the new WSL2 hyper-v features enabled.

### Packer version

1.5.6 & 1.6.0 tested

### Simplified Packer Buildfile

```json
"type": "virtualbox-iso",
"guest_os_type": "RedHat_64",
"guest_additions_mode": "upload",
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
"virtualbox_version_file": ".vbox_version",
```

### Operating system and Environment details

- Windows 10 2004 (20H1)
- VirtualBox v6.1.8 (hyper-v not mentioned in v6.1.10 changelog)
- WSL2 installed, so vbox is using the hyper-v backend (green turtle in status bar)

### Log Fragments and crash.log files

```
2020/06/11 17:13:27 packer.exe plugin: [INFO] Attempting SSH connection to 127.0.0.1:3041...
2020/06/11 17:13:27 packer.exe plugin: [DEBUG] reconnecting to TCP connection for SSH
2020/06/11 17:13:27 packer.exe plugin: [DEBUG] handshaking with SSH
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] handshake complete!
2020/06/11 17:13:28 packer.exe plugin: [ERROR] could not connect to local agent socket: C:/Users/ciara/AppData/Local/Temp/ssh-nOvGQ9u9tR2s/agent.744
==> virtualbox-iso: Connected to SSH!
2020/06/11 17:13:28 packer.exe plugin: VBoxManage --version output: 6.1.8r137981
2020/06/11 17:13:28 packer.exe plugin: VirtualBox version: 6.1.8
==> virtualbox-iso: Uploading VirtualBox version info (6.1.8)
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] Opening new ssh session
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] Starting remote scp process: scp -vt .
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] Started SCP session, beginning transfers...
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] Copying input data into temporary file so we can read the length
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] scp: Uploading .vbox_version: perms=C0644 size=5
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] SCP session complete, closing stdin pipe.
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] Waiting for SSH session to complete.
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] scp stderr (length 28): Sink: C0644 5 .vbox_version
2020/06/11 17:13:28 packer.exe plugin: VBoxManage --version output: 6.1.8r137981
2020/06/11 17:13:28 packer.exe plugin: VirtualBox version: 6.1.8
==> virtualbox-iso: Uploading VirtualBox guest additions ISO...
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] Opening new ssh session
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] Starting remote scp process: scp -vt .
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] Started SCP session, beginning transfers...
2020/06/11 17:13:28 packer.exe plugin: [DEBUG] Copying input data into temporary file so we can read the length
2020/06/11 17:13:29 packer.exe plugin: [DEBUG] scp: Uploading VBoxGuestAdditions_6.1.8.iso: perms=C0644 size=59832320
==> virtualbox-iso: Error uploading guest additions: write tcp 127.0.0.1:19925->127.0.0.1:3041: wsasend: An existing connection was forcibly closed by the remote host.
==> virtualbox-iso: Step "StepUploadGuestAdditions" failed
==> virtualbox-iso: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)?
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.