2016-07-28 13 views
16

Problem jest o zdolności „change_host_name” nie jest obsługiwany przez gościa, gdy próbuję wykonać następujące polecenie:Vagrant - Nieobsługiwane zdolności „change_host_name”

vagrant up 

To daje mi błąd jak:

Vagrant attempted to execute the capability 'change_host_name' 
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. 

Zauważ, że mój OS to: OS X Yosemite 10.10.5

gości Zwiększenia wersja: 4.2.0 i VirtualBox Wersja: 5.0

Próbowałem już wielu rozwiązań innych osób, które borykają się z tym problemem, ale nie mogłem tego naprawić.

Odpowiedz

26

To jest https://github.com/mitchellh/vagrant/issues/7625. zostanie on rozwiązany w następnej wersji, do tego czasu, jeśli jego blokowania, możesz załatać Vagrant sobie

Jeśli chcesz załatać sobie

method1:

  • wyszukać plik plugins/guests/ubuntu/guest.rb w swojej instalacji vagrant
    • np. /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/guests/ubuntu/guest.rb na mac default/linux zainstalować
    • lub /opt/vagrant/embedded/gems/vagrant-1.8.5/plugins/guests/ubuntu/guest.rb
    • okna: C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.8.5\plugin‌​s\guests\ubuntu\gues‌​t.rb
  • zastąpić https://raw.githubusercontent.com/carlosefr/vagrant/1c631c18d1a654405f6954459a42ac19a1a2f096/plugins/guests/ubuntu/guest.rb (upewnij się z odpowiednimi prawami, jeśli zainstalować jako administrator, użytkownik musi być administratorem użytkownikowi zapisać plik)
  • alternatywnie edytować plik i zastąpić wszystkie treści przez

    module VagrantPlugins 
        module GuestUbuntu 
        class Guest < Vagrant.plugin("2", :guest) 
         def detect?(machine) 
         # This command detects if we are running on Ubuntu. /etc/os-release is 
         # available on modern Ubuntu versions, but does not exist on 14.04 and 
         # previous versions, so we fall back to lsb_release. 
         # 
         # GH-7524 
         # GH-7625 
         # 
         machine.communicate.test <<-EOH.gsub(/^ {10}/, "") 
          if test -r /etc/os-release; then 
          source /etc/os-release && test xubuntu = x$ID 
          elif test -x /usr/bin/lsb_release; then 
          /usr/bin/lsb_release -i 2>/dev/null | grep -q Ubuntu 
          else 
          exit 1 
          fi 
         EOH 
         end 
        end 
        end 
    end 
    

Method2: Alternatywny sposób załatać plik używając patch polecenie:

Zapisz następującym pliku pod vagrant-guest.patch

commit 00fa49191dba2bb7c6322fa8df9327ca505c0b41 
Author: Seth Vargo <[email protected]> 
Date: Sat Jul 23 11:40:36 2016 -0400 

    guests/ubuntu: Revert detection 

    - Semi-reverts GH-7524 
    - Fixes GH-7625 

diff --git a/plugins/guests/ubuntu/guest.rb b/plugins/guests/ubuntu/guest.rb 
index 9aeb7aa..f60108e 100644 
--- a/plugins/guests/ubuntu/guest.rb 
+++ b/plugins/guests/ubuntu/guest.rb 
@@ -2,7 +2,22 @@ module VagrantPlugins 
    module GuestUbuntu 
    class Guest < Vagrant.plugin("2", :guest) 
     def detect?(machine) 
-  machine.communicate.test("test -r /etc/os-release && . /etc/os-release && test xubuntu = x$ID") 
+  # This command detects if we are running on Ubuntu. /etc/os-release is 
+  # available on modern Ubuntu versions, but does not exist on 14.04 and 
+  # previous versions, so we fall back to lsb_release. 
+  # 
+  # GH-7524 
+  # GH-7625 
+  # 
+  machine.communicate.test <<-EOH.gsub(/^ {10}/, "") 
+   if test -r /etc/os-release; then 
+   source /etc/os-release && test xubuntu = x$ID 
+   elif test -x /usr/bin/lsb_release; then 
+   /usr/bin/lsb_release -i 2>/dev/null | grep -q Ubuntu 
+   else 
+   exit 1 
+   fi 
+  EOH 
     end 
    end 
    end 

i uruchom następujące polecenie, aby zastosować poprawkę

sudo patch -p1 --directory /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/ < vagrant-guest.patch 

Wystarczy wymienić /opt/vagrant/embedded/gems/gems/vagrant-1.8.5 (lub /opt/vagrant/embedded/gems/vagrant-1.8.5/plugins/guests/ubuntu/guest.rb) z dowcipem h twoja instalacja folderu vagrant

+0

Wielkie dzięki, Frederic, to działa dla mnie! – dsds

+0

Przyjemna - naprawiono to dla mnie, wielkie nadzieje z powodu –

+0

Przy domyślnej instalacji systemu Windows, C: \ HashiCorp \ Vagrant \ embedded \ gems \ gems \ vagrant-1.8.5 \ plugins \ guests \ ubuntu \ guest.rb. chwilę, aby znaleźć ten plik ... –