How to run Android in Virtualbox on Linux? For days I try to get Android 5 or higher running inside Virtualbox on Linux (here: Mint 18.1), without success. At best, I get past the boot menu (Grub), the system switches to graphics mode, and I see the pulsating "Android": After a few seconds, disk access ceases, and the VM hangs with 100% CPU load.

I've searched the web up and down, and tried all the tricks I could find: increasing RAM to 2G, video memory to 128M, CPU count to 2. Switching the VM from "Linux (other)" to "BSD", trying 64bit and 32bit images (the 64bit images even get stuck at a black screen before the pulsating "Android" letters), the latter in 64bit and 32bit VMs, from the Android-x86 project via RemixOS to Phoenix, Android 5.1 to 7 – nothing gives.

Where's the trick?

Please don't point me to those numerous guides based on Virtualbox running on Windows. I've followed a bunch of them without luck. Nor do I want to use QEMU for that (draws in too many dependencies I don't want to install), or Genymotion etc (where I'd have to register). I'm interested in help from those who've got it running fine in Virtualbox on Linux.

I've also seen similar questions here and followed the advice from their answers:


Android x86 Marshmallow not booting on Virtualbox and VMware Workstation
adding vga=834 nomodeset xforcevesa to the kernel options just caused the hang happen even earlier. The other advices I already had followed. The .vdi taken from OSBoxes had the same issues.
other questions are either not for Virtualbox, or concerning pre-Lolliop. As the linked question above shows, the problem seems also to be present with VMWare.


How did you get it to run?



Note in between: I might soon be able to self-answer, but first need to verify and, if possible, improve: I meanwhile managed to fully boot an ISO with RemixOS, using "FreeBSD 64bit" for that 32bit image. The boot just took AGES to complete (about 15min before the pulsing "RemixOS" text got replaced by the welcome screen). It might be that's the first boot only, and after installing it to "disk" and having that running once, the next boot is faster. As soon as I find time, I'll dig deeper – and then will remove this paragraph and post an answer instead.
I was able to install Android-x86 on my Debian 9 box with no real problem.   Following are my system details, the articles I followed, commands I used and lastly the settings info of the VM itself. 

System:


Chassis: desktop
Desktop Environment: Gnome 3.22.2
Operating System: Debian GNU/Linux 9.1 (stretch)
Kernel: Linux 4.9.0-3-amd64
Architecture: x86-64
Processor: Intel Core i5-4570S CPU @ 2.90GHz × 4
Processor supports HW virtualization: yes   
Processor supports PAE: yes   
Processor supports long mode: yes
Processor supports nested paging: yes
Memory: 15.4 GiB   Graphics: Intel® Haswell Desktop
Disk: 1.1 TB


First I installed VirtualBox 5.1:


$ cd /etc/apt/sources.list.d
$ sudo touch virtualbox.list
$ sudo nano virtualbox.list


In nano I typed:
 deb http://download.virtualbox.org/virtualbox/debian stretch contrib

Then to save and exit nano editor:

ctrl+o
ctrl+x

Then to get keys, update repos and install VB.

$ cd ~/Keys
$ curl -O https://www.virtualbox.org/download/oracle_vbox_2016.asc
$ sudo apt-key add oracle_vbox_2016.asc
$ sudo apt-get update
$ sudo apt-get install virtualbox-5.1


Then I set about installing Android-x86:

First I downloaded Android-x86 6.0-r3 (the third stable release of marshmallow-x86) from here. Then I followed this article: "How to Install Android in VirtualBox"
by Cameron Summerson, dated June 29th, 2017.  The only snag I ran into was for mouse support.

The suggestion here didn't work for me but it might work for someone else.

So then I tried the discussion here which instructed to turn off VM which in my case is  "Android" and try the command:

$ VBoxManage modifyvm Android --mouse ps2

After turning Android VM back on, I had mouse support.

These are the VM's settings info as retrieved by CLI command:


$ VBoxManage showvminfo Android --details


Name:            Android
Groups:          /
Guest OS:        Linux 2.6 / 3.x / 4.x (64-bit)
UUID:            a8a28a18-2d9a-4aff-872c-890d72ec9e8f
Config file:     /home/shine/VirtualBox VMs/Android/Android.vbox
Snapshot folder: /home/shine/VirtualBox VMs/Android/Snapshots
Log folder:      /home/shine/VirtualBox VMs/Android/Logs
Hardware UUID:   a8a28a18-2d9a-4aff-872c-890d72ec9e8f
Memory size:     6020MB
Page Fusion:     off
VRAM size:       48MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  4
PAE:             off
Long Mode:       on
Triple Fault Reset: off
APIC:            on
X2APIC:          on
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): Floppy
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
BIOS APIC mode:  APIC
Time offset:     0ms
RTC:             UTC
Hardw. virt.ext: on
Nested Paging:   on
Large Pages:     off
VT-x VPID:       on
VT-x unr. exec.: on
Paravirt. Provider: Default
Effective Paravirt. Provider: KVM
State:           running (since 2017-08-04T02:01:58.782000000)
Monitor count:   1
3D Acceleration: on
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address: 
Teleporter Password: 
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration: 
Autostart Enabled: off
Autostart Delay: 0
Default Frontend: 
Storage Controller Name (0):            IDE
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
Storage Controller Name (1):            SATA
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      1
Storage Controller Bootable (1):        on
IDE (1, 0): Empty
SATA (0, 0): /home/shine/VirtualBox VMs/Android/Android.vdi (UUID: a111cb34-b24f-4b38-ac32-bc33428f8b55)
NIC 1:           MAC: 080027D5FAC2, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
UART 3:          disabled
UART 4:          disabled
LPT 1:           disabled
LPT 2:           disabled
Audio:           enabled (Driver: PulseAudio, Controller: AC97, Codec: AD1980)
Clipboard Mode:  disabled
Drag and drop Mode: disabled
Session name:    GUI/Qt
Video mode:      1024x768x32 at 0,0 enabled
VRDE:            disabled
USB:             enabled
EHCI:            disabled
XHCI:            disabled
USB Device Filters:

Available remote USB devices:

Currently Attached USB Devices:

Bandwidth groups:  
Shared folders:  
Name: 'shine', Host path: '/home/shine' (machine mapping), writable
VRDE Connection:    not active
Clients so far:     0
Video capturing:    not active
Capture screens:    0
Capture file:       /home/shine/VirtualBox VMs/Android/Android.webm
Capture dimensions: 1024x768
Capture rate:       512 kbps
Capture FPS:        25
Guest:
Configured memory balloon size:      0 MB
OS type:                             Linux26_64
Additions run level:                 0
Guest Facilities:
No active facilities.