2013年10月25日 星期五

升級Mavericks 後遇到的問題 (1) Virtualbox 發生錯誤


前天提起勇氣把OSX 升級到Mavericks ,果然免費的最貴....陸陸續續開始有災情出現。

今天要解決的問題是使用Virtualbox (4.2.18)出現的問題(包含使用Vagrant),主要是在啟動VM得時候會出現類似的錯誤如下:

Command: ["hostonlyif", "create"]

Failed to create the host-only network interface.
VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory

上網查了一下,看到這兩篇文章 Vagrant on MavericksFirst Thoughts Developing on Mavericks都是使用臨時性解法,就是利用指令重新啟動VirtualBox,不過重開機以後仍然會有問題...

$ sudo /Library/StartupItems/VirtualBox/VirtualBox restart


最後再Virtaulbox 的討論區 Network Error... was working yesterday 這篇文章確認這是升級新版的後所產生的問題:,

OS X 10.9 Mavericks has deprecated the StartupItems mechanism for starting services on boot.Until this is fixed it looks like VirtualBox's host-only networking is broken as per ticket: #8940.This also means if you use Vagrant it will complain that it can't start boxes.The temporary workaround is to create a Launch Daemon yourself. This Launch Daemon will call the old StartupItems script. 

目前建議的work around方式如下:

1.  建立 'virtualbox.plist' 這個檔案在這個目錄 '/Library/LaunchDaemons'  (Note: 必須使用 sudo 才能建立).
2. 檔案內容如下:
     
    <plist version="1.0">
        <dict>
            <key>Label</key>
            <string>virtualbox</string>
            <key>ProgramArguments</key>
            <array>
                <string>sh</string>
                <string>/Library/StartupItems/VirtualBox/VirtualBox</string>
                <string>restart</string>
            </array>
            <key>KeepAlive</key>
            <false>
            <key>RunAtLoad</key>
            <true>
        </true></false></dict>
    </plist>  

3. 執行以下兩個指令,讓機器重開後會自動執行

$ sudo chown root /Library/LaunchDaemons/virtualbox.plist
$ sudo launchctl load -w /Library/LaunchDaemons/virtualbox.plist

4. 最後重開機測試看看


Ps. 根據#8940的最新訊息,這個問題在Virtualbox 4.3版仍會有問題
Pss. 就算這個問題解決,另外會有關機後,virtualbox 的icon仍然會在dock 上面砍不掉

Update [2013.10.28]
已經升級到VirtualBox 4.3 開啟win7 的vm 會出現這個問題:Kernel fail on Mavericks OS





沒有留言 :