Nested VirtualBox in KVM and kernel crashing

From lxadm | Linux administration tips, tutorials, HOWTOs and articles
Jump to: navigation, search

If you're running nested VirtualBox in KVM, you may be experiencing kVm kernel crashing when starting a VirtualBox kernel, for example:

Sep 30 14:15:47 vagrantvm kernel: [  121.284492] SUPR0GipMap: fGetGipCpu=0x3
Sep 30 14:15:48 vagrantvm kernel: [  121.916871] general protection fault: 0000 [#1] SMP 
Sep 30 14:15:48 vagrantvm kernel: [  121.916876] Modules linked in: pci_stub vboxpci(OE) vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables snd_hda_codec_generic kvm_intel kvm irqbypass snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep crct10dif_pclmul crc32_pclmul snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq aesni_intel snd_seq_device snd_timer aes_x86_64 joydev lrw snd gf128mul glue_helper input_leds ablk_helper cryptd serio_raw soundcore i2c_piix4 8250_fintek mac_hid parport_pc ppdev lp parport autofs4 qxl ttm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops psmouse drm pata_acpi floppy
Sep 30 14:15:48 vagrantvm kernel: [  121.916925] CPU: 1 PID: 4677 Comm: EMT Tainted: G           OE   4.4.0-38-generic #57-Ubuntu
Sep 30 14:15:48 vagrantvm kernel: [  121.916927] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
Sep 30 14:15:48 vagrantvm kernel: [  121.916929] task: ffff8801b6908000 ti: ffff8800b8e2c000 task.ti: ffff8800b8e2c000
Sep 30 14:15:48 vagrantvm kernel: [  121.916931] RIP: 0010:[<ffffffffc0597566>]  [<ffffffffc0597566>] 0xffffffffc0597566
Sep 30 14:15:48 vagrantvm kernel: [  121.916934] RSP: 0018:ffff8800b8e2fd70  EFLAGS: 00010206
Sep 30 14:15:48 vagrantvm kernel: [  121.916936] RAX: 00000000000406e0 RBX: 00000000ffffffdb RCX: 000000000000009b
Sep 30 14:15:48 vagrantvm kernel: [  121.916937] RDX: 0000000000000000 RSI: ffff8800b8e2fd00 RDI: ffff8800b8e2fcc8
Sep 30 14:15:48 vagrantvm kernel: [  121.916938] RBP: ffff8800b8e2fd90 R08: 0000000000000000 R09: 00000000000406e0
Sep 30 14:15:48 vagrantvm kernel: [  121.916939] R10: 0000000000000004 R11: ffff8801bfc97c88 R12: 0000000000000020
Sep 30 14:15:48 vagrantvm kernel: [  121.916940] R13: 0000000000000000 R14: ffffc9000123607c R15: ffffffffc041c2a0
Sep 30 14:15:48 vagrantvm kernel: [  121.916942] FS:  00007f0628a9d700(0000) GS:ffff8801bfc80000(0000) knlGS:0000000000000000
Sep 30 14:15:48 vagrantvm kernel: [  121.916943] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Sep 30 14:15:48 vagrantvm kernel: [  121.916945] CR2: 00007f0628842000 CR3: 00000000b9b44000 CR4: 00000000000406e0
Sep 30 14:15:48 vagrantvm kernel: [  121.916948] Stack:
Sep 30 14:15:48 vagrantvm kernel: [  121.916949]  0000000000000000 ffffffff00000000 0000000000000000 0000000000000000
Sep 30 14:15:48 vagrantvm kernel: [  121.916952]  ffff8800b8e2fdb0 ffffffffc05aced3 ffffc90001236010 ffff8801b5060310
Sep 30 14:15:48 vagrantvm kernel: [  121.916954]  ffff8800b8e2fe30 ffffffffc03e13a7 ffff8800b8e2fe10 0000000000000282
Sep 30 14:15:48 vagrantvm kernel: [  121.916957] Call Trace:
Sep 30 14:15:48 vagrantvm kernel: [  121.916978]  [<ffffffffc03e13a7>] ? supdrvIOCtl+0x2de7/0x3250 [vboxdrv]
Sep 30 14:15:48 vagrantvm kernel: [  121.916986]  [<ffffffffc03da5b0>] ? VBoxDrvLinuxIOCtl_5_0_24+0x150/0x250 [vboxdrv]
Sep 30 14:15:48 vagrantvm kernel: [  121.916997]  [<ffffffff812211ff>] ? do_vfs_ioctl+0x29f/0x490
Sep 30 14:15:48 vagrantvm kernel: [  121.917000]  [<ffffffff8106b544>] ? __do_page_fault+0x1b4/0x400
Sep 30 14:15:48 vagrantvm kernel: [  121.917002]  [<ffffffff81221469>] ? SyS_ioctl+0x79/0x90
Sep 30 14:15:48 vagrantvm kernel: [  121.917015]  [<ffffffff818306f2>] ? entry_SYSCALL_64_fastpath+0x16/0x71
Sep 30 14:15:48 vagrantvm kernel: [  121.917016] Code: 88 e4 fc ff ff b9 3a 00 00 00 0f 32 48 c1 e2 20 89 c0 48 09 d0 48 89 05 99 db 0e 00 0f 20 e0 b9 9b 00 00 00 48 89 05 72 db 0e 00 <0f> 32 48 c1 e2 20 89 c0 b9 80 00 00 c0 48 09 d0 48 89 05 6b db 
Sep 30 14:15:48 vagrantvm kernel: [  121.917042] RIP  [<ffffffffc0597566>] 0xffffffffc0597566
Sep 30 14:15:48 vagrantvm kernel: [  121.917044]  RSP <ffff8800b8e2fd70>
Sep 30 14:15:48 vagrantvm kernel: [  121.917047] ---[ end trace 6276bb0aabe72bdc ]---


This is because of some changes in VirtualBox 5.0.12 and later. Version 5.0.10 is unaffected. As of VirtualBox 5.1.6, this issue is still present (and relates to some other issue in KVM) and will happen in Ubuntu 12.xx, 14.xx, 16.xx.

If you're running Ubuntu 16.04, to be able to run a nested VirtualBox in KVM, you'll have to:

  • remove your current VirtualBox
wget http://download.virtualbox.org/virtualbox/5.0.10/virtualbox-5.0_5.0.10-104061~Ubuntu~wily_amd64.deb
  • download a dependency package (no longer present in Ubuntu 16.04) from an older Ubuntu distribution:
wget http://security.ubuntu.com/ubuntu/pool/main/libv/libvpx/libvpx2_1.4.0-4_amd64.deb
  • install them together:
dpkg -i virtualbox-5.0_5.0.10-104061~Ubuntu~wily_amd64.deb libvpx2_1.4.0-4_amd64.deb


Reference:

https://www.virtualbox.org/ticket/14965