When Ubuntu16.04.1 is in the virtualbox with NAT adapter, the network will have errors about "Connection reset by peer"

Bug #1640123 reported by Maxwell
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

By means of vagrant for using the ubuntu/xenial64 box, or under the virtualbox 5.1.6/5.1.8, installing ubuntu-16.04.1-server-amd64.iso (default installation + openssh server), ubuntu-16.04.1-desktop-amd64.iso (default installation), designate the Adapter1 of Guest OS as NAT type.
In this case, some commands are executed with a "Connection reset by peer" error, such as apt-key or docker pull.

==== The current test results ====
If the network is not NAT but NAT Network or Host Only, it will not go wrong.
If the virtual machine is not virtualbox, it will not go wrong.
Keeping other unchanged and just replacing centos with Ubuntu, it will not go wrong.
Under different wifi environment, the test results remain unchanged.
Upgrade all ubuntu to the latest version by using sudo apt upgrade, the test results are unchanged.

Maybe the combination of virtualbox + NAT + ubuntu1604 is the reason and this error is very convert. Other network functions are available, may have errors only in a specific command.

==== Repeating Steps ====
1. Run "vagrant init ubuntu/xenial64" in an empty directory
2. vagrant up
3. vagrant ssh
4. Run "sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:11371 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D" in Guest OS.

The output is as follows :
Executing: /tmp/tmp.LO7eukZqdi/gpg.1.sh --keyserver
hkp://ha.pool.sks-keyservers.net:11371
--recv-keys
58118E89F3A912897C070ADBF76221572C52609D
gpg: requesting key 2C52609D from hkp server ha.pool.sks-keyservers.net
?: [fd 4]: read error: Connection reset by peer
gpgkeys: key 58118E89F3A912897C070ADBF76221572C52609D partially retrieved (probably corrupt)
gpg: no valid OpenPGP data found.
gpg: key 2C52609D: no valid user IDs
gpg: this may be caused by a missing self-signature
gpg: Total number processed: 1
gpg: w/o user IDs: 1

There is an error message during this "? : [fd 4]: read error: Connection reset by peer"

==== Another error scene ====
I created a docker registry (called S) on the virtual machine of IDC, and when I ran "docker pull xxx" from another ubuntu Guest OS (called C) (virtualbox + NAT), you can see something from /var/log/syslog in C as follows:
Nov 3 12:59:00 ubuntu-xenial dockerd[2167]: time="2016-11-03T12:59:00.506141276Z" level=error msg="Error trying v2 registry: read tcp 10.0.2.15:33580->10.99.169.227:5000: read: connection reset by peer"
Nov 3 12:59:00 ubuntu-xenial dockerd[2167]: time="2016-11-03T12:59:00.506732903Z" level=error msg="Attempting next endpoint for pull after error: read tcp 10.0.2.15:33580->10.99.169.227:5000: read: connection reset by peer”
The 10.99.169.227 is the ip of S.
S is also Ubuntu 16.04.1 LTS, but which is not running under the virtualbox. Run the above repeating steps 4 in S will not appear "Connection reset by peer" error.

==== Script which can be executed on other system ====
Attachment is a test script, which is copied from output /tmp/tmp.LO7eukZqdi directory of the above repeating step 4. You can perform a test on any system by following these steps:
1. tar -xf gpgtest.tar
2. cd gpgtest
3. ./gpg.1.sh --keyserver hkp://ha.pool.sks-keyservers.net:11371 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

In the environment of virtualbox + NAT + ubuntu, output will be like this:
gpg: WARNING: unsafe permissions on homedir `.'
gpg: requesting key 2C52609D from hkp server ha.pool.sks-keyservers.net
?: [fd 4]: read error: Connection reset by peer
gpgkeys: key 58118E89F3A912897C070ADBF76221572C52609D partially retrieved (probably corrupt)
gpg: no valid OpenPGP data found.
gpg: key 2C52609D: no valid user IDs
gpg: this may be caused by a missing self-signature
gpg: Total number processed: 1
gpg: w/o user IDs: 1

You can see the output of "?: [Fd 4]: read error: Connection reset by peer".

Under the vagrant + virtualbox + centos/7 box + NAT, the script output is like this:
gpg: 警告:用户目录‘.’权限不安全
gpg: 下载密钥‘2C52609D’,从 hkp 服务器 ha.pool.sks-keyservers.net
gpg: 密钥 2C52609D:“Docker Release Tool (releasedocker) <email address hidden>”未改变
gpg: 合计被处理的数量:1
gpg: 未改变:1

==== My test environment ====
Macbook pro 15, macOS 10.12.1 (16B2555), XPS15 (win10), MiBook13 (win10)
Vagrant 1.8.6
VirtualBox 5.1.6, 5.1.8
vagrant box ubuntu/xenial64 20161102.0.0, 20161104.0.0
vagrant box centos/7 1609.01
ubuntu-16.04.1-server-amd64.iso (default installation + openssh server)
ubuntu-16.04.1-desktop-amd64.iso (default installation)

Revision history for this message
Maxwell (maxwell1987) wrote :
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in network-manager (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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