Vagrant: change_host_name fails on bootup

Created on 22 Jul 2016  ·  8Comments  ·  Source: hashicorp/vagrant

Vagrant version: 1.8.5
Host OS: Mac OS X 10.10.5
Guest OS: Ubuntu 12.04.1

Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "precise64"
  config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
  config.vm.host_name = 'aws-nv-c-qstest01'

  # This is the port for a web server
  config.vm.network "forwarded_port", guest: 8080, host: 8080

  # This is the port for the Jacoco server to retrieve code coverage data
  config.vm.network "forwarded_port", guest: 6300, host: 6300

  # #  Puppet config. Super fast Puppet dev!
  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = ENV['PUPPET_ROOT'] + '/manifests'
    puppet.module_path    = ENV['PUPPET_ROOT'] + '/modules'
    puppet.manifest_file  = 'site.pp'
  end
end

Debug Output: https://gist.github.com/kevwil/5f2a347764a689e338556ddde4f656c0

Expected behavior

What should have happened?

Clean bootup of virtual machine, possibly with puppet errors as that's what I'm working on.

Actual behavior

What actually happened?

Bootup is aborted because 'change_host_name' on this linux guest is 'not supported'.

Steps to reproduce

  1. Install latest Virtualbox and Vagrant
  2. Run 'vagrant up' with the above Vagrantfile
  3. Boom!

    References

Are there any other GitHub issues (open or closed) that should be linked here?
For example:

  • GH-6332
bug guesubuntu

Most helpful comment

In case anyone else has this problem and stumbles across this issue (like me). A quick fix would be to add the file /etc/os-release with the following content. At least for Ubuntu 12.04 this worked perfectly.

NAME="Ubuntu"
VERSION="12.04.1 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 12.04.1 LTS"
VERSION_ID="12.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

And thanks to the Vagrant team for addressing the issue this fast 💜

All 8 comments

I tried going back to Vagrant 1.8.4, but it didn't work at all with Virtualbox 5.1.x, so I went back to the latest 1.8.5. I then tried rolling back Virtualbox to 5.0.26, and I still get this error.

I'm pretty sure this is a result of https://github.com/mitchellh/vagrant/pull/7524, which is what I was afraid of.

@kevwil can you run

. /etc/os-release && test xubuntu = x$ID

and report the output? I'm willing to bet that older ubuntu doesnt have that file and detection is failing.

/cc @nishidayuya

@sethvargo

vagrant@precise64:~$ . /etc/os-release && test xubuntu = x$ID
-bash: /etc/os-release: No such file or directory

Okay, thanks what I thought 😦. I'll get this fixed in the next release.

In case anyone else has this problem and stumbles across this issue (like me). A quick fix would be to add the file /etc/os-release with the following content. At least for Ubuntu 12.04 this worked perfectly.

NAME="Ubuntu"
VERSION="12.04.1 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 12.04.1 LTS"
VERSION_ID="12.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

And thanks to the Vagrant team for addressing the issue this fast 💜

Hi guys. Sorry for possible dummy question - I am new to vagrant.. where I should add /etc/os-release file? somewhere on a host machine? or I should somehow change Vagrantfile?
thank you!

updated: never mind guys. I understood - I had to comment that line in the Vagrantfile, boot up the guest machine, add there an /etc/os-release file and that fixed the problem

Guys wanted to post here as well a solution which worked for me (I described it in my other comment but just to make it easier to read I will post it in this thread as well

So, Guys I fixed this problem and one more ( which is described here using a solution with creating an additional file on a guest machine. which file needs to be created is also described in this comment - thank you @railsbros-dirk ! but I would put here all the steps what I did)

Please note I am a very new guy with Vagrant so if I messed something up or did something incorrectly - that was only because I am a real newbie in this world. Also, I am sorry for such a detailed list of steps I did but that is oriented on same category Vagrant users as I am, but at least it helped me so I hope it might be helpful for someone else.

So in a brand new "hashicorp/precise64" vm I could not either set config.vm.host_name nor config.vm.network "private_network"....

Here is what I did to make it work in my case (hopefully it would help out someone else):

1) I initialized a new vm by doing vagrant init hashicorp/precise64
2) I updated a Vagrantfile with this (basically kept an absolute basic there) content

Last login: Wed Sep  7 16:29:16 2016 from 10.0.2.2
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.box_version = "1.1.0"
end

3) Inside of the current box directory I created a file called os-release and placed this content there

NAME="Ubuntu"
VERSION="12.04.1 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 12.04.1 LTS"
VERSION_ID="12.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

4) I did vagrant up and waited until the machine boots up

5) I did vagrant ssh and once I ssh-ed in I saw a default host name and an ip address

vagrant@precise64:~$ ifconfig
.....
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0

6) I copied os-release to /etc folder (by default the directory where you are running your vm from is mounted to /vagrant on your guest machine

sudo cp /vagrant/os-release /etc

7) I exit from guest to host

8) on a host machine I updated the Vagrantfile and add there host name and an ip address

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.box_version = "1.1.0"
 # Next two lines were not here in the basic version of the Vagrantfile
  config.vm.network "private_network", ip: "192.168.40.10"
  config.vm.host_name = 'server-provision-test02'
end

9) I did vagrant provision , vagrant halt and vagrant up

10) when it finished I did vagrant ssh again and I saw a proper hostname and an ip address

vagrant@server-provision-test02:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:88:0c:a6
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
........
eth1      Link encap:Ethernet  HWaddr 08:00:27:91:6e:4f
          inet addr:192.168.40.12  Bcast:192.168.40.255  Mask:255.255.255.0
......         

Good luck!

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RobertSwirsky picture RobertSwirsky  ·  3Comments

janw-me picture janw-me  ·  3Comments

tomhking picture tomhking  ·  3Comments

rrzaripov picture rrzaripov  ·  3Comments

OtezVikentiy picture OtezVikentiy  ·  3Comments