なにが起きたか
VirtualBox をバージョンアップしたらウィンドウの自動リサイズがきかなくなった。
「ゲストOSの画面を自動リサイズ」を選択しようとしても、クリックできないようになっていて選択できない。
こんな感じでウィンドウを広げても上下左右にグレーの枠が入るだけで大きくならない。
追記(2018/12/18)
本記事の方法でひとまずリサイズは可能になりましたが、今度はクリックが効かなくなるなど謎の現象に悩まされました。。
GNOME の再インストールなど行いましたが解決せず。
最終的に、GNOME をやめて Xfce をインストールしたところ直りました。
→ これはCentOS(カーネル)側の問題のようでした。コメントありがとうございます。
ただし、GNOME を再インストールしたタイミングで mysql、VSCode、phpMyAdmin などがアンインストールされてしまったようで、少しめんどくさいことになりました(mysql のデータベース自体は生き残っていました)。
もし原因がわかる方がいたらぜひご教示ください。
(それでも開発環境を0から作り直すよりはよっぽどましですが。。)
Guest Additions をインストール
Guest Additions をインストールしようとしたところエラーが発生。
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while.
VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what went wrong
VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted
VirtualBox Guest Additions: Starting.
Press Return to close this window...
/var/log/vboxadd-setup.log
を見ろと言われますので確認します。
Building the main Guest Additions module.
Building the shared folder support module.
Building the graphics driver module.
Error building the module. Build output follows.
make V=1 CONFIG_MODULE_SIG= -C /lib/modules/3.10.0-957.1.3.el7.x86_64/build SUBD
IRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j2 modules
make[1]: warning: -jN forced in submake: disabling jobserver mode.
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (
\
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are
missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it.
"; \
echo >&2 ; \
/bin/false)
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
make -f scripts/Makefile.build obj=/tmp/vbox.0
以下略
なるほどわからん。
結論
調べてみると yum update
すれば直るとか必要なプラグインを入れれば直るとか書かれていますが、ダメでした。
最終的に、私の場合は Guest Additions のバージョンがよくなかったようです。
VirtualBox バージョンアップ後のそれぞれのバージョンは下記のとおりでした。
VirtualBox: 5.2.22
Guest Additions: 5.2.22
これを Guest Additions のバージョンだけ変更して
VirtualBox: 5.2.22
Guest Additions: 5.2.23
このようにすると動きました。
Guest Additions のイメージファイルはここからダウンロードしました。
ページ下部にある Guest Additions をクリックすればイメージファイルが落とせます。
落としてきたイメージファイルを CentOS の仮想ドライブへ挿入して実行すれば完了です。
参考