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

config.vm.hostname for Ubuntu 15.04 fails #5673

Closed
jameskyle opened this issue May 4, 2015 · 28 comments · Fixed by #5753
Closed

config.vm.hostname for Ubuntu 15.04 fails #5673

jameskyle opened this issue May 4, 2015 · 28 comments · Fixed by #5753

Comments

@jameskyle
Copy link

Error below. The hostname service is masked in ubuntu 15.04, the recommended way to control the hostname seems to be hostnamectl.

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

service hostname start

Stdout from the command:



Stderr from the command:

sudo: unable to resolve host ubuntu-1504
stdin: is not a tty
Failed to start hostname.service: Unit hostname.service is masked.
@ev0rtex
Copy link

ev0rtex commented May 5, 2015

I'm having the same issue. I just tried with 15.04 today and got this.

@matthiss
Copy link

matthiss commented May 8, 2015

I've tried

sudo systemctl unmask hostname.service

it seems everything ok, no errors, but if i want to start the service, it is still masked.

Any ideas?

@jklare
Copy link

jklare commented May 13, 2015

having the same issue

@devjatkin
Copy link

I got the same error message. On my Ubuntu VM ( based on image from cloud.ubuntu) I saw the next:

sudo systemctl status hostname
● hostname.service
   Loaded: masked (/dev/null)
   Active: inactive (dead)
ls -la /lib/systemd/system/hostname.service 
lrwxrwxrwx 1 root root 9 Apr 18 21:11 /lib/systemd/system/hostname.service -> /dev/null

As temporary workaround it is possible to use /etc/init.d/hostname.sh

@nserban
Copy link

nserban commented Jun 15, 2015

I encounter the same problem reported by @jameskyle but on a Debian Wheezy, after an apt-get update ; apt-get upgrade .

root@local:~# uname -a
Linux local 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64 GNU/Linu

I retested with a upgraded Debian box 7.8, the creation of the VM is working fine, but after a vagrant halt and vagrant up with this line in Vagrantfile

config.vm.hostname = "local.supercool.com"

I encounter the same problem.

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

hostname -f

Stdout from the command:



Stderr from the command:

sudo: unable to resolve host local
stdin: is not a tty
hostname: Name or service not known

Here are the Vagrant Log:

/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
 INFO interface: error: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

hostname -f

Stdout from the command:



Stderr from the command:

sudo: unable to resolve host local
stdin: is not a tty
hostname: Name or service not known

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

hostname -f

Stdout from the command:



Stderr from the command:

sudo: unable to resolve host local
stdin: is not a tty
hostname: Name or service not known

 INFO interface: Machine: error-exit ["Vagrant::Errors::VagrantError", "The following SSH command responded with a non-zero exit status.\nVagrant assumes that this means the command failed!\n\nhostname -f\n\nStdout from the command:\n\n\n\nStderr from the command:\n\nsudo: unable to resolve host local\nstdin: is not a tty\nhostname: Name or service not known\n"]

@eckz
Copy link

eckz commented Jun 29, 2015

It seems like the only work-around for now is

#host.vm.hostname = "skynet"
host.vm.provision :shell, inline: "hostnamectl set-hostname skynet"

@thasmo
Copy link

thasmo commented Jun 29, 2015

Encountering the same on Ubuntu 15.04.

@born4new
Copy link

born4new commented Jul 2, 2015

Same here. Can't wait to see the fix!

mitchellh added a commit that referenced this issue Jul 6, 2015
Fix #5673 - Use hostnamectl to set the hostname on Ubuntu Vivid 15.
@majidaldo
Copy link

yup

@czerasz
Copy link

czerasz commented Jul 28, 2015

After updating to Vagrant 1.7.4 everything works fine. Tested with ubuntu/vivid64

@dylanraithel
Copy link

@czerasz version upgrade to Vagrant 1.7.4 fixed the issue for me as well with ubuntu/vivid64

@jgoldschrafe
Copy link
Contributor

This is breaking again on the Wily betas. Can we have a better fix that doesn't rely on checking the codename of one specific release?

@markwoon
Copy link

Still broken with ubuntu/wily and vagrant 1.7.4...

@luebken
Copy link

luebken commented Nov 2, 2015

Still broken with ubuntu/wily and vagrant 1.7.4...

+1

I saw it fixed for vivid but came up again for wily.

@rogerhu
Copy link

rogerhu commented Nov 2, 2015

PR'd #6470 -> avoids hard-coding Ubuntu distribution names

@rogerhu
Copy link

rogerhu commented Nov 3, 2015

Closed and reopened: #6471

@nubae
Copy link

nubae commented May 13, 2016

Problem is also there in 16.04 (fix #6470 does not work):
root@ns399965:/tmp/ispconfig3/install# hostnamectl set-hostname ns1
root@ns399965:/tmp/ispconfig3/install# sudo systemctl status hostname
● hostname.service
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
root@ns399965:/tmp/ispconfig3/install#

@nubae
Copy link

nubae commented May 13, 2016

workaround:
root@ns399965:/tmp/ispconfig3/install# sh /etc/init.d/hostname.sh
root@ns399965:/tmp/ispconfig3/install# hostname -f
ns1.soulternative.eu

@reedloden
Copy link
Contributor

@nubae can you file a new issue, please?

@reedloden
Copy link
Contributor

@nubae actually, #7288 is this, no?

@nubae
Copy link

nubae commented May 31, 2016

@reedloden yup that seems to be the same issue... still need to re-file a new issue or not?

@ravishtiwari
Copy link

Using Vagrant 1.7.4 with Ubunut 16.04 and still having the issue:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

service hostname start

Stdout from the command:



Stderr from the command:

sudo: unable to resolve host ubuntu-xenial: Connection timed out
mesg: ttyname failed: Inappropriate ioctl for device
Failed to start hostname.service: Unit hostname.service is masked.

Ubuntu Box Version: '20161214.0.0'

@awibmer
Copy link

awibmer commented Dec 28, 2016

@ravishtiwari Upgrading to Vagrant 1.9.1 solved this for me.

@ravishtiwari
Copy link

@awibmer - I've recently upgraded to Vagrant 1.9.1 will confirm if the issue is fixed for me as well.

Thanks

@jeunito
Copy link

jeunito commented Jan 16, 2017

Upgrading to 1.8.5 solved this for me

@ravishtiwari
Copy link

@awibmer - upgrading to 1.9.1 has resolved this for me as well, thanks for your help.

@daBONDi
Copy link

daBONDi commented Nov 18, 2018

Im now on vagrant 2.2.1 and have the same problem now

@ghost
Copy link

ghost commented Mar 28, 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 Mar 28, 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.