serial console makes boot very slow on Vagrant
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-images |
New
|
Undecided
|
Unassigned |
Bug Description
I have been seeing very slow boot times on Ubuntu xenial CD images. After some hunting, theproblem seems to be the console logging to the serial port. Disconnecting the serial port seems to solve the problem.
Adding this to Vagrantfile drops the startup time from about 3 minutes to about 1 minute:
config.
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end
This only happens for xenial64. If I swap in box ubuntu/trusty64 or larryli/vivid64, then those lines have no effect on the startup time.
Complete transcript to replicate:
user@host:
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
user@host:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: Setting the name of the VM: cdimage-
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2200
default: SSH username: ubuntu
default: SSH auth method: password
default: Warning: Remote connection disconnect. Retrying...
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => /home/user/
real 3m12.105s
user 0m7.732s
sys 0m3.944s
Added this lines to Vagrantfile:
config.
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end
user@host:
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
user@host:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: Setting the name of the VM: cdimage-
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: ubuntu
default: SSH auth method: password
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => /home/user/
real 1m0.079s
user 0m3.484s
sys 0m1.240s
description: | updated |
description: | updated |
tags: | added: id-5cf13913704f6332da576e60 |
The serial port also causes a problem when using a base image. The log file that the serial port plugs into is hardcoded so if you move the box to another machine, vagrant up will fail.