docker-android icon indicating copy to clipboard operation
docker-android copied to clipboard

Android Emulator is not displayed

Open Kurisutian opened this issue 6 years ago • 23 comments

Please make sure that it is an issue / a feature request. If it is a question / help wanted, please visit our group chat. Thank you!

Operating System: Debian 9

Docker Image: butomo1989/docker-android-x86-8.1:1.2, butomo1989/docker-android-x86-7.1.1:1.2

Docker Version:
17.12.0-ce

Docker Command to start docker-android:
Executed by Rancher with default settings

Expected Behavior

When running the container on real HW and entering it with a browser, I'd suspect to have the device being shown.

Actual Behavior

Device chosen is not shown, when running the emulator I get

`ERROR: 32-bit Linux Android emulator binaries are DEPRECATED, to use them you will have to do at least one of the following:

   - Use the '-force-32bit' option when invoking 'emulator'.
   - Set ANDROID_EMULATOR_FORCE_32BIT to 'true' in your environment.

   Either one will allow you to use the 32-bit binaries, but please be
   aware that these will disappear in a future Android SDK release.
   Consider moving to a 64-bit Linux system before that happens.`

Also checking the process list in the container shows a defunct with qemu:

root 159 0.0 0.0 0 0 ? Z 03:12 0:00 [qemu-system-i38] <defunct>

Shouldn't this be qemu-system-i386 instead?

Kurisutian avatar Jul 12 '18 10:07 Kurisutian

Hi @Kurisutian the problem looks very familiar (it happens when calling x86 emulator binary) but I cannot reproduce this issue running for example this command: docker run --privileged -d -p 6091:6080 -p 5584:5554 -p 5585:5555 -e DEVICE='Nexus 5X' --name calabash_emulator_11 butomo1989/docker-android-x86-8.1:1.2 :(

JoeSSS avatar Jul 13 '18 14:07 JoeSSS

I have it running over Rancher 1.6 with a docker compose file containing:

SamsungGalaxyS6: image: butomo1989/docker-android-x86-8.1:1.2 environment: - DEVICE=Samsung Galaxy S6 - APPIUM=true - CONNECT_TO_GRID=True - APPIUM_HOST=SamsungGalaxyS6 - APPIUM_PORT=4723 - SELENIUM_HOST=SeleniumMaster - SELENIUM_PORT=4455 - MOBILE_WEB_TEST=True - AUTO_RECORD=False

So nothing out of the ordinary I'd say. Had it running with previous versions just like that, but went for the new version due to the #86 issue which you fixed. But that's when the I experienced this issue on our servers.

Kurisutian avatar Jul 13 '18 14:07 Kurisutian

Does it mean that it works for butomo1989/docker-android-x86-8.1:1.1 ?

JoeSSS avatar Jul 13 '18 15:07 JoeSSS

Could you run lscpu and print out the output here @Kurisutian ?

budtmo avatar Jul 13 '18 15:07 budtmo

Sure, here we go:

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 4 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 94 Model name: Intel Core Processor (Skylake, IBRS) Stepping: 3 CPU MHz: 2095.078 BogoMIPS: 4190.15 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 4096K NUMA node0 CPU(s): 0-3 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single kaiser fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap xsaveopt xsavec xgetbv1 ibpb ibrs arat

Kurisutian avatar Jul 16 '18 10:07 Kurisutian

Uups, sorry, that was the output from a virtual machine, which should not work at all. Here is the one from out bare metal server:

root@6c564ca08cf4:~# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 20 On-line CPU(s) list: 0-19 Thread(s) per core: 2 Core(s) per socket: 10 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 63 Model name: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz Stepping: 2 CPU MHz: 1484.716 CPU max MHz: 3300.0000 CPU min MHz: 1200.0000 BogoMIPS: 5199.43 Virtualization: VT-x Hypervisor vendor: vertical Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 25600K NUMA node0 CPU(s): 0-19 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc ibpb ibrs stibp dtherm ida arat pln pts

Kurisutian avatar Jul 16 '18 10:07 Kurisutian

can you please try to start the container from a line that I dropped above, it would be interesting if the issue persists in both cases

JoeSSS avatar Jul 17 '18 20:07 JoeSSS

Same thing, no device shows...

Kurisutian avatar Jul 18 '18 11:07 Kurisutian

this is very weird.. I'm out of ideas tbh. The problem is definitely in this line: https://github.com/butomo1989/docker-android/blob/master/src/app.py#L211 I was getting the same error message while using wrong version of emulator file. But starting from version 27.2.9 this file is the only good choice.. Can you please connect to your broken container and check if the version match? docker exec -it container_name bash and then: which emulator emulator -version and emulator/emulator -version

If the version is old I will suggest you to prune your docker registry to elimenate the risk that the problem is in something there being messed up docker system prune -a

JoeSSS avatar Jul 19 '18 20:07 JoeSSS

Hi, I encounter the same problem with the thread poster. I tried below

root@3d76b80be909:~# emulator -avd samsung_galaxy_s6_8.1
ERROR: 32-bit Linux Android emulator binaries are DEPRECATED, to use them
       you will have to do at least one of the following:

       - Use the '-force-32bit' option when invoking 'emulator'.
       - Set ANDROID_EMULATOR_FORCE_32BIT to 'true' in your environment.

       Either one will allow you to use the 32-bit binaries, but please be
       aware that these will disappear in a future Android SDK release.
       Consider moving to a 64-bit Linux system before that happens.

root@3d76b80be909:~# emulator -avd samsung_galaxy_s6_8.1 -force-32bit
PANIC: Missing emulator engine program for 'x86' CPU.
root@3d76b80be909:~#```
can help?

nichotined avatar Sep 10 '18 08:09 nichotined

having the same issue. any update on this?

jerdie avatar Feb 07 '19 05:02 jerdie

I also faced the same issue, i had not enabled SVM in my bios, once enabled it was working like charm. Enter following command

grep --color vmx /proc/cpuinfo

and check out put displays vmx Then check if virtualization is enabled in bios.

ssmuthukumaran avatar Apr 03 '19 04:04 ssmuthukumaran

I'm getting weird errors inside the container.. 1 - ERROR: 32-bit Linux Android emulator binaries are DEPRECATED, to use them which is 'fixed' by calling sdkmanager --update, but the emulator will not work. 2 - emulator complain about qt_setup.cpp file, which is 'fixed' by calling it on the emulator folder ...

Aaand looking here, which emulator gives me /root/tools/emulator.. which is wrong (?) calling /root/emulator/emulator -avd nexus_4_8.1 opens up the emulator working :D

Grohden avatar Jul 29 '19 17:07 Grohden

I want to build test automation infrastructure on Centos7 using docker. In order to do that I'm using docker-compose file. I want to run selenium hub, docker-chrome node and docker-android node. Hub and chrome node starting correctly, but emulator is not displaying after connect to server_ip:6080. I can see only appium server logs and emulator terminal. It's seems like emulator start opening but closing after 1/2 second (window with emulator displaying and closing after that). In docker container logs can see that something with atd is wrong. Virtualization is enabled.

docker-compose file:

version: "3.7"

services:
  selenium_hub:
    image: selenium/hub:3.141.59-titanium
    ports:
      - 4444:4444

  samsung_galaxy_s6:
    image: budtmo/docker-android-x86-8.1
    privileged: true
    depends_on:
      - selenium_hub
    ports:
      - 6080:6080
      - 5555:5555
      - 5554:5554
      - 4723:4723
    volumes:
      - /lastore_app/LAStore4:/lastore_app
    environment:
      - DEVICE=Samsung Galaxy S6
      - CONNECT_TO_GRID=true
      - APPIUM=true
      - SELENIUM_HOST=selenium_hub
      - MOBILE_WEB_TEST=true
      - ATD=true
      
  chrome:
    image: selenium/node-chrome:3.141.59-titanium
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium_hub
    environment:
      - HUB_HOST=selenium_hub
      - START_XVFB=false

docker container logs:

2019-08-22 07:03:30,587 CRIT Supervisor running as root (no user in config file)
2019-08-22 07:03:30,605 INFO supervisord started with pid 6
2019-08-22 07:03:31,614 INFO spawned: 'xvfb' with pid 9
2019-08-22 07:03:31,617 INFO spawned: 'port-forward' with pid 10
2019-08-22 07:03:31,623 INFO spawned: 'novnc' with pid 11
2019-08-22 07:03:31,626 INFO spawned: 'openbox' with pid 12
2019-08-22 07:03:31,650 INFO spawned: 'x11vnc' with pid 14
2019-08-22 07:03:31,667 INFO spawned: 'android-screen-mirror' with pid 17
2019-08-22 07:03:31,670 INFO spawned: 'docker-appium' with pid 18
2019-08-22 07:03:31,687 INFO spawned: 'atd' with pid 19
2019-08-22 07:03:31,713 INFO spawned: 'auto-recording' with pid 25
2019-08-22 07:03:31,719 INFO spawned: 'adb-utils' with pid 26
2019-08-22 07:03:31,771 INFO success: android-screen-mirror entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2019-08-22 07:03:31,781 INFO exited: android-screen-mirror (exit status 0; expected)
2019-08-22 07:03:31,805 INFO exited: atd (exit status 0; not expected)
2019-08-22 07:03:32,674 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-22 07:03:32,674 INFO success: port-forward entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-22 07:03:32,674 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-22 07:03:32,674 INFO success: openbox entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-22 07:03:32,674 INFO success: x11vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-22 07:03:32,674 INFO success: docker-appium entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-22 07:03:32,888 INFO spawned: 'atd' with pid 124
2019-08-22 07:03:32,888 INFO success: auto-recording entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-22 07:03:32,888 INFO success: adb-utils entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-22 07:03:32,901 INFO exited: atd (exit status 0; not expected)
2019-08-22 07:03:34,914 INFO spawned: 'atd' with pid 135
2019-08-22 07:03:34,932 INFO exited: atd (exit status 0; not expected)
2019-08-22 07:03:37,859 INFO exited: auto-recording (exit status 0; expected)
2019-08-22 07:03:37,986 INFO spawned: 'atd' with pid 140
2019-08-22 07:03:37,991 INFO exited: atd (exit status 0; not expected)
2019-08-22 07:03:38,085 INFO gave up: atd entered FATAL state, too many start retries too quickly

GerardLarwa avatar Aug 22 '19 15:08 GerardLarwa

I noticed If I go to my container via "docker exec -it android-container /bin/bash" , open emulator directory and after that run emulator manually by "./emulator -avd device_name" emulator is run and display, but works really slow. There is any way to improve it?

GerardLarwa avatar Aug 29 '19 11:08 GerardLarwa

I have also the problem of emulator who don't start. And for me it is the same problem than JoeSSS (bad emulator binary used). I have tested to build an image with this Dockerfile and problem is solved:

cat Dockerfile 
FROM budtmo/docker-android-x86-8.1
RUN ln -s /root/emulator/emulator /usr/bin/

Please could you add the "RUN ln -s /root/emulator/emulator /usr/bin/" is the base image?

PiR43 avatar Sep 03 '19 12:09 PiR43

Dear Sir

i run docker @ Mac OSX 10.15 (macOS Catalina ) with Docker Desktop

use below command

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1

or

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-9.0

or

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Nexus 5" --name android-container butomo1989/docker-android-x86-7.1.1

all get

" Android Emulator is not displayed "

use

docker run --privileged -d -p 6091:6080 -p 5584:5554 -p 5585:5555 -e DEVICE='Nexus 5X' --name calabash_emulator_11 butomo1989/docker-android-x86-8.1:1.2

the docker healthy is un-healthy !!!

when " Android Emulator is not displayed "

i use

which emulator --> /root/tools/emulator

emulator -version -- > sh: 1: file: not found

WARNING: Cannot decide host bitness because $SHELL is not properly defined; 32 bits assumed. ERROR: 32-bit Linux Android emulator binaries are DEPRECATED, to use them you will have to do at least one of the following:

   - Use the '-force-32bit' option when invoking 'emulator'.
   - Set ANDROID_EMULATOR_FORCE_32BIT to 'true' in your environment.

   Either one will allow you to use the 32-bit binaries, but please be
   aware that these will disappear in a future Android SDK release.
   Consider moving to a 64-bit Linux system before that happens.

emulator/emulator -version -- >

Android emulator version 29.2.1.0 (build_id 5889189) (CL:N/A) Copyright (C) 2006-2017 The Android Open Source Project and many others. This program is a derivative of the QEMU CPU emulator (www.qemu.org).

This software is licensed under the terms of the GNU General Public License version 2, as published by the Free Software Foundation, and may be copied, distributed, and modified under those terms.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

THX

CMingTseng avatar Jan 02 '20 08:01 CMingTseng

Note sure if some one has found fix for the issue. Please share if you know the fix or workaround that I can try.

rshidling avatar Jun 23 '20 05:06 rshidling

I have the same problem on my macbook. So far, the only workaround that I found is to run the container in a Debian vm on VMWare... :-(

gdegani avatar Jun 23 '20 09:06 gdegani

I had the same issue on Ubuntu 20.04, then I saw https://github.com/budtmo/docker-android/issues/216, https://github.com/budtmo/docker-android/issues/218 and https://github.com/budtmo/docker-android/issues/247, so I checked KVM on my computer. Virtualisation was disabled in BIOS so I enabled it, installed KVM, rebooted, ran the container and the emulator was up and running all of the sudden. More info about virtualisation and KVM: https://help.ubuntu.com/community/KVM/Installation

Szaki avatar Jul 30 '20 09:07 Szaki

The solution to this problem for me was:

  • Check KVM is installed (was the case for me)
  • Run with docker run command with --device /dev/kvm/ instead of --privileged.

The latter is also done for the google containers scripts: https://github.com/google/android-emulator-container-scripts .

jvanheugten avatar Dec 15 '20 20:12 jvanheugten

Have the same issue. KVM is isntalled and works good. This suggestion didn't help me either https://github.com/budtmo/docker-android/issues/93#issuecomment-745563349

Ostapp avatar Apr 13 '21 19:04 Ostapp

I have also the problem of emulator who don't start. And for me it is the same problem than JoeSSS (bad emulator binary used). I have tested to build an image with this Dockerfile and problem is solved:

cat Dockerfile 
FROM budtmo/docker-android-x86-8.1
RUN ln -s /root/emulator/emulator /usr/bin/

Please could you add the "RUN ln -s /root/emulator/emulator /usr/bin/" is the base image?

Thank you so much! This solved the issue for me. @PiR43

clouedoc avatar Jun 25 '22 19:06 clouedoc

Please check virtualization on host machine. Detail information can be found in readme

budtmo avatar May 09 '23 19:05 budtmo