Skip to content
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

change_host_name fails on bootup #7625

Closed
kevwil opened this issue Jul 22, 2016 · 8 comments · Fixed by #7632
Closed

change_host_name fails on bootup #7625

kevwil opened this issue Jul 22, 2016 · 8 comments · Fixed by #7632
Assignees
Milestone

Comments

@kevwil
Copy link

kevwil commented Jul 22, 2016

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:

@kevwil
Copy link
Author

kevwil commented Jul 22, 2016

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.

@sethvargo
Copy link
Contributor

I'm pretty sure this is a result of #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

@kevwil
Copy link
Author

kevwil commented Jul 22, 2016

@sethvargo

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

@sethvargo
Copy link
Contributor

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

@sethvargo sethvargo added this to the 1.8.6 milestone Jul 23, 2016
@sethvargo sethvargo self-assigned this Jul 23, 2016
sethvargo added a commit that referenced this issue Jul 23, 2016
sethvargo added a commit that referenced this issue Jul 23, 2016
carlosefr pushed a commit to carlosefr/vagrant that referenced this issue Jul 25, 2016
EvanK added a commit to evolution/genesis-wordpress that referenced this issue Jul 28, 2016
@code-later
Copy link

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 💜

@okovalov
Copy link

okovalov commented Sep 7, 2016

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

@okovalov
Copy link

okovalov commented Sep 7, 2016

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
  1. 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/"
  1. I did vagrant up and waited until the machine boots up

  2. 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
  1. 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

  1. I exit from guest to host

  2. 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
  1. I did vagrant provision , vagrant halt and vagrant up

  2. 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!

chrisroberts pushed a commit to chrisroberts/vagrant that referenced this issue Oct 11, 2016
/etc/issue is far from being a reliable source for OS detection as it
can be changed by a user without affecting any OS functionality. As
newer Debian systems run systemd by default, check for /etc/os-release
and fallback to lsb_release for older Debian versions. Check hashicorp#7625 for
a similar issue. Even lsb_release is not manatory, therefore keep the
current code of parsing /etc/issue to avoid regressions.
@ghost
Copy link

ghost commented Apr 3, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants