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. i.e. adding this to the Vagrantfile drops the boot time from
Added this to Vagrantfile drops the startup time from about 3 minutes to about 1 minute:
config.vm.provider :virtualbox do |vb|
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:
ggbaker@lefty:~/tmp/cdimage-bug$ vagrant init ubuntu/xenial64 --box-version 20160921.0.0
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.
ggbaker@lefty:~/tmp/cdimage-bug$ time vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/xenial64'...
==> 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-bug_default_1474921158442_93989
==> 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/ggbaker/tmp/cdimage-bug
real 3m12.105s
user 0m7.732s
sys 0m3.944s
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end
ggbaker@lefty:~/tmp/cdimage-bug$ vagrant destroy -f
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
ggbaker@lefty:~/tmp/cdimage-bug$ time vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/xenial64'...
==> 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-bug_default_1474921400525_21103
==> 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/ggbaker/tmp/cdimage-bug
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. i.e. adding this to the Vagrantfile drops the boot time from
Added this to Vagrantfile drops the startup time from about 3 minutes to about 1 minute: vm.provider :virtualbox do |vb|
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:
ggbaker@ lefty:~ /tmp/cdimage- bug$ vagrant init ubuntu/xenial64 --box-version 20160921.0.0
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.
ggbaker@ lefty:~ /tmp/cdimage- bug$ time vagrant up xenial64' ... bug_default_ 1474921158442_ 93989 tmp/cdimage- bug
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/ggbaker/
real 3m12.105s
user 0m7.732s
sys 0m3.944s
config. vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end
ggbaker@ lefty:~ /tmp/cdimage- bug$ vagrant destroy -f
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
ggbaker@ lefty:~ /tmp/cdimage- bug$ time vagrant up xenial64' ... bug_default_ 1474921400525_ 21103 tmp/cdimage- bug
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/ggbaker/
real 1m0.079s
user 0m3.484s
sys 0m1.240s