Vagrant reload fails in ubuntu console

Environment

  • CentOS 7.2 x86-64
  • Vagrant 1.8.1
  • VirtualBox 5.0.16
  • RancherOS 0.4.3

Issue

vagrant reload fails with random errors like below while using Ubuntu console, Debian however works fine.

stdin: is not a tty
sed: cannot rename /etc/sedDrVifQ: Device or resource busy

How to reproduce

# git clone https://github.com/rancher/os-vagrant.git
# cd os-vagrant
# vagrant up
# vagrant ssh
[rancher@rancher ~]$ sudo ros service enable ubuntu-console
[rancher@rancher ~]$ sudo reboot
# 
# vagrant reload
==> rancher-01: Attempting graceful shutdown of VM...
==> rancher-01: Checking if box 'rancherio/rancheros' is up to date...
==> rancher-01: Clearing any previously set forwarded ports...
==> rancher-01: Clearing any previously set network interfaces...
==> rancher-01: Preparing network interfaces based on configuration...
    rancher-01: Adapter 1: nat
    rancher-01: Adapter 2: hostonly
==> rancher-01: Forwarding ports...
    rancher-01: 22 (guest) => 2222 (host) (adapter 1)
==> rancher-01: Running 'pre-boot' VM customizations...
==> rancher-01: Booting VM...
==> rancher-01: Waiting for machine to boot. This may take a few minutes...
    rancher-01: SSH address: 127.0.0.1:2222
    rancher-01: SSH username: rancher
    rancher-01: SSH auth method: private key
==> rancher-01: Machine booted and ready!
==> rancher-01: Setting hostname...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

sed -ri 's@^(([0-9]{1,3}\.){3}[0-9]{1,3})\s+rancher(\s.*)?$@\1 rancher-01 rancher-01@g' /etc/hosts

Stdout from the command:

Stderr from the command:

stdin: is not a tty
sed: cannot rename /etc/sedDrVifQ: Device or resource busy
#

I tried to comment node.vm.hostname = hostname and reloaded the VM again which threw the below error.

# vagrant reload
==> rancher-01: Attempting graceful shutdown of VM...
==> rancher-01: Checking if box 'rancherio/rancheros' is up to date...
==> rancher-01: Clearing any previously set forwarded ports...
==> rancher-01: Clearing any previously set network interfaces...
==> rancher-01: Preparing network interfaces based on configuration...
    rancher-01: Adapter 1: nat
    rancher-01: Adapter 2: hostonly
==> rancher-01: Forwarding ports...
    rancher-01: 22 (guest) => 2222 (host) (adapter 1)
==> rancher-01: Running 'pre-boot' VM customizations...
==> rancher-01: Booting VM...
==> rancher-01: Waiting for machine to boot. This may take a few minutes...
    rancher-01: SSH address: 127.0.0.1:2222
    rancher-01: SSH username: rancher
    rancher-01: SSH auth method: private key
    rancher-01: Warning: Remote connection disconnect. Retrying...
==> rancher-01: Machine booted and ready!
==> rancher-01: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/sbin/ifdown eth1 2> /dev/null

Stdout from the command:

Stderr from the command:

stdin: is not a tty
#

Cross reference

This is also filed in Github:

https://github.com/rancher/os/issues/853