New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devstack fails with vagrant-1.8.5 (current) #3385

Closed
agriffis opened this Issue Sep 18, 2016 · 11 comments

Comments

Projects
None yet
5 participants
@agriffis
Contributor

agriffis commented Sep 18, 2016

Bringing up devstack with vagrant-1.8.5 (the current version) fails:

==> default: Configuring and enabling network interfaces...
Vagrant attempted to execute the capability 'configure_networks'
on the detect guest OS 'linux', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.

The problem is actually a bug in vagrant that was introduced just before 1.8.5 shipped (hashicorp/vagrant@05782f1), and has already been fixed but not yet released (hashicorp/vagrant@00fa491).

It's possible to work around the problem locally using this sequence to add the /etc/os-release file so that vagrant can detect Ubuntu:

# This will fail with the error message shown above
vagrant up

# Add the os-release file so vagrant can detect Ubuntu
vagrant ssh -- -t sudo tee /etc/os-release >/dev/null <<'EOT'
NAME="Ubuntu"
VERSION="12.04 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04 LTS)"
VERSION_ID="12.04"
EOT

# Reload vagrant and proceed with provisioning
vagrant reload --provision

Would it make sense to add this file to the box so vagrant-1.8.5 works directly?

@jibsheet

This comment has been minimized.

Contributor

jibsheet commented Sep 19, 2016

@nedbat This seems interesting for you

@regisb

This comment has been minimized.

regisb commented Sep 22, 2016

I encountered this bug as well; it's easier to solve by patching the Vagrantfile itself, as suggested in this issue comment, than by patching /etc/os-release. Just add type: "dhcp", auto_config: false to your private_network configuration. For example:

config.vm.network :private_network, ip: "192.168.33.10", type: "dhcp", auto_config: false

I can open a PR to patch all Vagrantfile files, if necessary.

@agriffis

This comment has been minimized.

Contributor

agriffis commented Sep 22, 2016

Hi @regisb! Thanks for your talk at the Open edX conf 2016. I watched the video and it was very helpful!

Could you explain the effect of that combination of parameters? It's not clear how ip: 192.168.33.10 interacts with type: "dhcp" since those seem like mutually-exclusive configurations. And how is the guest interface is configured since auto_config: false? Is it preconfigured in the base box?

Unfortunately even if it works for Virtualbox, it won't help my situation. I'm running devstack on a multi-tenant libvirt/KVM host. For the most part, this works the same as Virtualbox except that vagrant-libvirt requires DHCP for its management address, which then depends on /etc/os-release existing.

In fact, I just use the management address to access the guest rather than the static IP which isn't routable because it assumes the default Virtualbox subnet. It made me wonder why the static IP is configured at all, especially since it's trivial to find the dynamic IP from the host:

$ vagrant ssh-config | awk '$1=="HostName"{print $2}'
192.168.121.217

The only purpose I've found of the static IP is so it can added to /etc/hosts for preview, but that could also be done using the snippet above. I'm pretty new to Open edX though, so maybe the static IP is used in other ways I haven't discovered yet.

In any case, I know this is a bit of a detour, so thanks for bearing with me. :-)

It seems like there are three things, any or all of which could be done:

  1. Update the Vagrantfile as you suggested, which helps Virtualbox users, undoubtedly the large majority.
  2. Put /etc/os-release in the base image which helps anybody who is either not using Virtualbox or is on a multi-tenant host.
  3. Patch vagrant locally to stop depending on /etc/os-release until vagrant 1.8.6 is released.

Now that I've thought of it (duh) I'll probably do (3) locally. But if I can find time, or if someone else wants to do it, then a PR for (2) might be nice too

@agriffis

This comment has been minimized.

Contributor

agriffis commented Sep 22, 2016

Here's what I did for (3):

curl https://github.com/mitchellh/vagrant/commit/00fa49191dba2bb7c6322fa8df9327ca505c0b41.patch | \
sudo patch /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/guests/ubuntu/guest.rb

and it's working great now:

$ vagrant up --provider=libvirt
Bringing machine 'default' up with 'libvirt' provider...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default:  -- Name:              devstack_default
==> default:  -- Domain type:       kvm
==> default:  -- Cpus:              2
==> default:  -- Memory:            4096M
==> default:  -- Management MAC:    
==> default:  -- Loader:            
==> default:  -- Base box:          eucalyptus-devstack-2016-09-01
==> default:  -- Storage pool:      default
==> default:  -- Image:             /var/lib/libvirt/images/devstack_default.img (80G)
==> default:  -- Volume Cache:      default
==> default:  -- Kernel:            
==> default:  -- Initrd:            
==> default:  -- Graphics Type:     vnc
==> default:  -- Graphics Port:     5900
==> default:  -- Graphics IP:       127.0.0.1
==> default:  -- Graphics Password: Not defined
==> default:  -- Video Type:        cirrus
==> default:  -- Video VRAM:        9216
==> default:  -- Keymap:            en-us
==> default:  -- TPM Path:          
==> default:  -- INPUT:             type=mouse, bus=ps2
==> default:  -- Command line : 
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
    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: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
etc

so... it seems like if the Vagrantfile tweak you suggested works for Virtualbox users, then this quick fix does the trick for me and there's probably no need to put /etc/os-release in the base image.

@agriffis

This comment has been minimized.

Contributor

agriffis commented Sep 22, 2016

I did some quick tests and I can answer my own question from earlier. Given this line:

config.vm.network :private_network, ip: "192.168.33.10", type: "dhcp", auto_config: false

both type: "dhcp" and auto_config: false are required to avoid the vagrant bug, and despite type: "dhcp" it still assigns the static IP address, that just helps to avoid the code path that would require /etc/os-release

however if you ever reboot your laptop and need to vagrant up then the static IP disappears, because at that point vagrant depends on the existing guest configuration. That config isn't present because of auto_config: false, ugh

therefore I don't think the Vagrantfile hack is really sufficient even for Virtualbox users. It just helps for the first boot and then breaks later. I think this means we're back to patching vagrant and/or adding /etc/os-release to the base image.

@nedbat

This comment has been minimized.

Member

nedbat commented Sep 22, 2016

@agriffis thanks so much for the extra legwork! I can add the os-release file to the next box file.

@regisb

This comment has been minimized.

regisb commented Sep 23, 2016

@agriffis thanks, glad you liked my talk :)
I must admit I got lazy and just copy-pasted the proposed "solution" without trying to understand it. Shame on me! And thank you for investigating this issue so thoroughly.

@nedbat

This comment has been minimized.

Member

nedbat commented Sep 25, 2016

For comparison, here is the 16.04.1 os-release file:

NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial

(from http://paste.ubuntu.com/23229163/)

@vmendoza

This comment has been minimized.

vmendoza commented Sep 28, 2016

For ubuntu 12, only the patch works, os-release and network settings don't work. Vagrant needs to fix this issue.

@nedbat

This comment has been minimized.

Member

nedbat commented Sep 28, 2016

@vmendoza can you show what you tried? The os-release file seemed really promising, and it is specifically for Ubuntu 12.04.

@agriffis

This comment has been minimized.

Contributor

agriffis commented Sep 28, 2016

@nedbat nedbat closed this Nov 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment