はじめに
kernelがバージョンアップ(4.4.0-143)したことによりVirtualBoxが起動しなくなったので、メモを残しておきます。
問題箇所は以下です。
linux.c:1112:18: error: too many arguments to function ‘get_user_pages’
rc = get_user_pages(pTask, /* Task for fault accounting. */
環境情報
- VirutlaBox: 5.2.26-128414
- Kernel: 4.4.0-143-generic
- OS: Ubuntu 16.04.6 LTS (xenial)
事象
VirtualBoxが起動しない。ビルドに失敗する。
エラーログ
vboxconfig実行時のログ
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (4.4.0-143-generic) or it failed to
load. Please recompile the kernel module and install it by
sudo /sbin/vboxconfig
You will not be able to start VMs until this problem is fixed.
vbox-setup.log
Building the main VirtualBox module.
Error building the module:
make V=1 CONFIG_MODULE_SIG= -C /lib/modules/4.4.0-143-generic/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j4 modules
make[1]: warning: -jN forced in submake: disabling jobserver mode.
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/tmp/vbox.0
(省略)
if [ "-pg" = "-pg" ]; then if [ /tmp/vbox.0/r0drv/linux/assert-r0drv-linux.o != "scripts/mod/empty.o" ]; then ./scripts/recordmcount "/tmp/vbox.0/r0drv/linux/assert-r0drv-linux.o"; fi; fi;
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjNativeLockUser’:
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:1123:33: warning: passing argument 6 of ‘get_user_pages’ makes pointer from integer without a cast [-Wint-conversion]
fWrite, /* force write access. */
^
In file included from /tmp/vbox.0/r0drv/linux/the-linux-kernel.h:101:0,
from /tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:31:
include/linux/mm.h:1222:6: note: expected ‘struct page **’ but argument is of type ‘int’
long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
^
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:1125:33: warning: passing argument 7 of ‘get_user_pages’ from incompatible pointer type [-Wincompatible-pointer-types]
&pMemLnx->apPages[0], /* Page array. */
^
In file included from /tmp/vbox.0/r0drv/linux/the-linux-kernel.h:101:0,
from /tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:31:
include/linux/mm.h:1222:6: note: expected ‘struct vm_area_struct **’ but argument is of type ‘struct page **’
long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
^
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:1113:18: error: too many arguments to function ‘get_user_pages’
rc = get_user_pages(pTask, /* Task for fault accounting. */
^
In file included from /tmp/vbox.0/r0drv/linux/the-linux-kernel.h:101:0,
from /tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:31:
include/linux/mm.h:1222:6: note: declared here
long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
^
(省略)
scripts/Makefile.build:285: recipe for target '/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.o' failed
make[2]: *** [/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.o] Error 1
make[2]: *** Waiting for unfinished jobs....
(省略)
Makefile:1454: recipe for target '_module_/tmp/vbox.0' failed
make[1]: *** [_module_/tmp/vbox.0] Error 2
/tmp/vbox.0/Makefile.include.footer:106: recipe for target 'vboxdrv' failed
make: *** [vboxdrv] Error 2
対応方法
2019年3月末時点では、VitualBoxの修正バージョンはリリースされていないので、以下の2択から選択して下さい。
- 1.カーネルを切り戻す
- 2.VirtualBoxのテストビルドを利用する
1. カーネルを切り戻す
問題のカーネルバージョンは4.4.0-143
で4.4.0-142
では問題は出ていません。
私はこの方法は試していませんが、これにより事象が解消されたことが報告されています。
2. VirtualBoxのテストビルドを利用する
私はこちらを行いましたので、手順を記載しておきます。
既存のアンインストール
$apt-get remove virtualbox-5.2
(設定ファイルごと消していい人は以下)
$apt-get purge virtualbox-5.2
テストビルドのインストール
TestBuildはこちらからダウンロードできます。
ダウンロードしましたら、以下のようにinstallします(2019年3月27日時点でのLinux-64bit)。
$bash ./VirtualBox-5.2.27-129578-Linux_amd64.run
(参考までに、以下で削除できます)
$bash ./VirtualBox-5.2.27-129578-Linux_amd64.run uninstall
経緯
久々にVagrantを起動しようとしたら、VirtualBoxが文句言っているというログが出ました。
VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage --version` or open the VirtualBox GUI to see the error
message which should contain instructions on how to fix this error.
調べていくと、2月のカーネルのアップデート(4.4.0-143-generic)で、仕様が変わったのか、この部分でビルドに失敗している模様。
linux.c:1112:18: error: too many arguments to function ‘get_user_pages’
rc = get_user_pages(pTask, /* Task for fault accounting. */
以下で色々議論されていました。
- virtualbox dkms modules fail to build with linux 4.4.0-143.169 [error: too many arguments to function ‘get_user_pages’]
- Ubuntu Xenial -abrupt error after kernel upgraded to 4.4.0-143-generic
なお、VirtualBox6.0.4をダウンロードしても同様の問題は発生しました。この場合もテストビルドを利用すれば、事象は解消されました。
VirtualBoxの変更ログによると、最終リリースが1月ですので、早く修正版がリリースされるのを期待しています。
以上ご参考になれば。