記一次 Homestead 啟動故障修復

doderic發表於2018-09-12

在一次重啟電腦之後,習慣性的啟動 homestead 準備寫程式碼,開啟瀏覽器卻發現之前的所有專案均無法開啟,回到終端中檢視 homestead 的啟動資訊,發現出現瞭如下錯誤資訊:

==> homestead-7: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/sbin/ifdown 'eth1' || true
/sbin/ip addr flush dev 'eth1'
# Remove any previous network modifications from the interfaces file
sed -e '/^#VAGRANT-BEGIN/,$ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces.pre
sed -ne '/^#VAGRANT-END/,$ p' /etc/network/interfaces | tac | sed -e '/^#VAGRANT-END/,$ d' | tac > /tmp/vagrant-network-interfaces.post
cat \
  /tmp/vagrant-network-interfaces.pre \
  /tmp/vagrant-network-entry \
  /tmp/vagrant-network-interfaces.post \
  > /etc/network/interfaces
rm -f /tmp/vagrant-network-interfaces.pre
rm -f /tmp/vagrant-network-entry
rm -f /tmp/vagrant-network-interfaces.post

/sbin/ifup 'eth1'

Stdout from the command:

Stderr from the command:

bash: line 5: /sbin/ifdown: No such file or directory
bash: line 19: /sbin/ifup: No such file or directory

看起來是網路配置出了問題,嘗試登入 homestead ,還好,可以登入,那就有了修復的希望。


求助於搜尋引擎,得到了解決方案,在 homestead 中安裝 ifupdown 軟體包:

vagrant@homestead:~$ sudo apt-get install ifupdown

重啟 homestead 後,所有東西都回來了,故障得以修復。
如果有朋友遇到了相同的問題,可以嘗試用該方法解決。

本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章