klim.log()

フロントエンドエンジニア見習いによる学習記録

HomebrewでVirtualBoxをアップデートしたら躓いた話

タイトルの通り、HomebrewでVirtualBoxをアップデートしようとしたらエラーと遭遇してしまったので、その様子と対応策をメモしておく。

環境

  • macOS Mojave
  • Homebrew 1.8.5
  • virtualbox 5.2.18,124319 (これを5.2.22,126460にアップデートしようとした)

叩いたコマンド

$ brew cask upgrade virtualbox

表示されたエラー

Welcome to the VirtualBox uninstaller script.

Warning! Found the following active VirtualBox processes:
 8802   501 VBoxXPCOMIPCD
 8804   501 VBoxSVC
 8838   501 VBoxHeadless
 8842   501 VBoxNetDHCP


We recommend that you quit all VirtualBox processes before
uninstalling the product.

And the following KEXTs will be unloaded:
    org.virtualbox.kext.VBoxNetFlt
    org.virtualbox.kext.VBoxDrv

And the traces of following packages will be removed:
    org.virtualbox.pkg.vboxkexts
    org.virtualbox.pkg.virtualbox
    org.virtualbox.pkg.virtualboxcli

The uninstallation processes requires administrative privileges
because some of the installed files cannot be removed by a normal
user. You may be prompted for your password now...

unloading org.virtualbox.kext.VBoxNetFlt
(kernel) Kext org.virtualbox.kext.VBoxNetFlt did not stop (return code 0x5).
(kernel) Kext org.virtualbox.kext.VBoxNetFlt can't unload - module stop returned 0xdc008017.
Failed to unload org.virtualbox.kext.VBoxNetFlt - (libkern/kext) kext (kmod) start/stop routine failed.
An error occurred durning 'sudo /sbin/kextunload -m org.virtualbox.kext.VBoxNetFlt', there should be a message above. (rc=3)
unloading org.virtualbox.kext.VBoxDrv
(kernel) Can't remove kext org.virtualbox.kext.VBoxDrv; services failed to terminate - 0xdc008018.
Failed to unload org.virtualbox.kext.VBoxDrv - (libkern/kext) kext is in use or retained (cannot unload).
An error occurred durning 'sudo /sbin/kextunload -m org.virtualbox.kext.VBoxDrv', there should be a message above. (rc=3)
Failed to unload one or more KEXTs, please reboot the machine to complete the uninstall.
Error: Failure while executing; `/usr/bin/sudo -E -- /usr/local/Caskroom/virtualbox/5.2.18,124319/VirtualBox_Uninstall.tool --unattended` exited with 1. Here's the output:

もう少し長くエラーが吐き出されていたけれど中略

原因

  • VirtualBox関連のプロセスで動き続けているものが残っていたため、アップデートできなかった模様

対応

  • VirtualBox関連のプロセス(VBoxXPCOMIPCD・VBoxSVC・VBoxHeadless・VBoxNetDHCP)を殺す
  • その後 $ brew cask reinstall virtualbox を叩く(upgradeでもいいかも)