aerokube / images

Browser images for Selenoid and Moon 1.x
https://aerokube.com/images/latest/
Apache License 2.0
173 stars 128 forks source link

I got Android emulator crashed("core dumped") issue while launch "selenoid/android:8.0" on linux CentOS7 #142

Open julialiuliu opened 5 years ago

julialiuliu commented 5 years ago
  1. My Linux server OS : Linux Server: CentOS Linux 7 (core) Kernel: Linux 3.10.0-957.12.2.el7.x86_64

  2. browser.json is Under "/selenoid" folder and the full content is { "android": { "default": "8.1", "versions": { "8.1": { "image": "selenoid/android:8.1", "port": "4444", "path": "/wd/hub", "tmpfs": { "/tmp": "size=128m" } } } } }

  3. I run "docker run -d --name android -e ENABLE_VNC=true -e SKIN=WXGA800 --privileged -p 5900:5900 -p 8888:4444 selenoid/android:8.1" under "/selenoid" folder. And I got core dumped while starting "Starting QEMU main loop". It seems the emulator is crashed in the docker container.

The full log is like below: [root@104028cg53505qp selenoid]# docker run -d --name android -e ENABLE_VNC=true -e SKIN=WXGA800 --privileged -p 5900:5900 -p 8888:4444 selenoid/android:8.1 45e9b87419e0c027fc0bd437e5befb5cf5cdd71d9ce26a4e862430d7d5cba453 [root@104028cg53505qp selenoid]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 45e9b87419e0 selenoid/android:8.1 "/entrypoint.sh" 9 seconds ago Up 7 seconds 0.0.0.0:5900->5900/tcp, 0.0.0.0:8888->4444/tcp android [root@104028cg53505qp selenoid]# docker logs android

emulator: VERBOSE: AdbInterface.cpp:232: Found: 3 adb executables emulator: VERBOSE: AdbInterface.cpp:234: Adb: /opt/android-sdk-linux/platform-tools/adb emulator: VERBOSE: AdbInterface.cpp:234: Adb: /opt/android-sdk-linux/platform-tools/adb emulator: VERBOSE: AdbInterface.cpp:234: Adb: /opt/android-sdk-linux/platform-tools/adb emulator: VERBOSE: AdbInterface.cpp:253: Path:/opt/android-sdk-linux/platform-tools/adb protocol version: 41 emulator: VERBOSE: AdbInterface.cpp:253: Path:/opt/android-sdk-linux/platform-tools/adb protocol version: 41 emulator: VERBOSE: AdbInterface.cpp:253: Path:/opt/android-sdk-linux/platform-tools/adb protocol version: 41 emulator: GPU emulation enabled using 'swiftshader_indirect' mode emulator: Initializing hardware OpenGLES emulation support emulator: Found 4 DNS servers: 10.201.4.31 10.65.27.211 10.202.4.31 10.65.27.212 Content of hardware configuration file: hw.cpu.arch = x86 hw.cpu.model = qemu32 hw.cpu.ncore = 2 hw.ramSize = 1536 hw.screen = multi-touch hw.mainKeys = false hw.trackBall = false hw.keyboard = false hw.keyboard.lid = false hw.keyboard.charmap = qwerty2 hw.dPad = false hw.rotaryInput = false hw.gsmModem = true hw.gps = true hw.battery = true hw.accelerometer = true hw.gyroscope = true hw.audioInput = true hw.audioOutput = true hw.sdCard = true hw.sdCard.path = /sdcard.img disk.cachePartition = true disk.cachePartition.path = /root/.android/avd/android8.1-1.avd/cache.img disk.cachePartition.size = 66m test.quitAfterBootTimeOut = -1 test.delayAdbTillBootComplete = 0 hw.lcd.width = 1280 hw.lcd.height = 800 hw.lcd.depth = 16 hw.lcd.density = 320 hw.lcd.backlight = true hw.displayRegion.0.1.xOffset = -1 hw.displayRegion.0.1.yOffset = -1 hw.displayRegion.0.1.width = 0 hw.displayRegion.0.1.height = 0 hw.fold.adjust = false hw.gpu.enabled = true hw.gpu.mode = swiftshader_indirect hw.initialOrientation = portrait hw.camera.back = emulated hw.camera.front = none vm.heapSize = 384 hw.sensors.light = true hw.sensors.pressure = true hw.sensors.humidity = true hw.sensors.proximity = true hw.sensors.magnetic_field = true hw.sensors.magnetic_field_uncalibrated = true hw.sensors.gyroscope_uncalibrated = true hw.sensors.orientation = true hw.sensors.temperature = true hw.useext4 = true hw.arc = false hw.arc.autologin = false kernel.path = /opt/android-sdk-linux/system-images/android-27/google_apis/x86//kernel-ranchu-64 kernel.newDeviceNaming = yes kernel.supportsYaffs2 = no disk.ramdisk.path = /opt/android-sdk-linux/system-images/android-27/google_apis/x86//ramdisk.img disk.systemPartition.initPath = /opt/android-sdk-linux/system-images/android-27/google_apis/x86//system.img disk.systemPartition.size = 2562m disk.vendorPartition.initPath = /opt/android-sdk-linux/system-images/android-27/google_apis/x86//vendor.img disk.vendorPartition.size = 800m disk.dataPartition.path = /root/.android/avd/android8.1-1.avd/userdata-qemu.img disk.dataPartition.size = 800m disk.encryptionKeyPartition.path = /root/.android/avd/android8.1-1.avd/encryptionkey.img PlayStore.enabled = false avd.name = android8.1-1 fastboot.forceColdBoot = false . QEMU options list: emulator: argv[00] = "/opt/android-sdk-linux/emulator/qemu/linux-x86_64/qemu-system-x86_64" emulator: argv[01] = "-dns-server" emulator: argv[02] = "10.201.4.31,10.65.27.211,10.202.4.31,10.65.27.212" emulator: argv[03] = "-no-audio" emulator: argv[04] = "-mem-path" emulator: argv[05] = "/root/.android/avd/android8.1-1.avd/snapshots/default_boot/ram.img" emulator: argv[06] = "-mem-file-shared" emulator: argv[07] = "-serial" emulator: argv[08] = "null" emulator: argv[09] = "-device" emulator: argv[10] = "goldfish_pstore,addr=0xff018000,size=0x10000,file=/root/.android/avd/android8.1-1.avd/data/misc/pstore/pstore.bin" emulator: argv[11] = "-cpu" emulator: argv[12] = "android64" emulator: argv[13] = "-enable-kvm" emulator: argv[14] = "-smp" emulator: argv[15] = "cores=2" emulator: argv[16] = "-m" emulator: argv[17] = "1536" emulator: argv[18] = "-lcd-density" emulator: argv[19] = "320" emulator: argv[20] = "-object" emulator: argv[21] = "iothread,id=disk-iothread" emulator: argv[22] = "-nodefaults" emulator: argv[23] = "-kernel" emulator: argv[24] = "/opt/android-sdk-linux/system-images/android-27/google_apis/x86//kernel-ranchu-64" emulator: argv[25] = "-initrd" emulator: argv[26] = "/opt/android-sdk-linux/system-images/android-27/google_apis/x86//ramdisk.img" emulator: argv[27] = "-drive" emulator: argv[28] = "if=none,index=0,id=system,file=/root/.android/avd/android8.1-1.avd/system.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576" emulator: argv[29] = "-device" emulator: argv[30] = "virtio-blk-pci,drive=system,iothread=disk-iothread,modern-pio-notify" emulator: argv[31] = "-drive" emulator: argv[32] = "if=none,index=1,id=cache,file=/root/.android/avd/android8.1-1.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576" emulator: argv[33] = "-device" emulator: argv[34] = "virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify" emulator: argv[35] = "-drive" emulator: argv[36] = "if=none,index=2,id=userdata,file=/root/.android/avd/android8.1-1.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576" emulator: argv[37] = "-device" emulator: argv[38] = "virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify" emulator: argv[39] = "-drive" emulator: argv[40] = "if=none,index=3,id=encrypt,file=/root/.android/avd/android8.1-1.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576" emulator: argv[41] = "-device" emulator: argv[42] = "virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify" emulator: argv[43] = "-drive" emulator: argv[44] = "if=none,index=4,id=vendor,file=/root/.android/avd/android8.1-1.avd/vendor.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576" emulator: argv[45] = "-device" emulator: argv[46] = "virtio-blk-pci,drive=vendor,iothread=disk-iothread,modern-pio-notify" emulator: argv[47] = "-drive" emulator: argv[48] = "if=none,index=5,id=sdcard,file=/sdcard.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576" emulator: argv[49] = "-device" emulator: argv[50] = "virtio-blk-pci,drive=sdcard,iothread=disk-iothread,modern-pio-notify" emulator: argv[51] = "-netdev" emulator: argv[52] = "user,id=mynet" emulator: argv[53] = "-device" emulator: argv[54] = "virtio-net-pci,netdev=mynet" emulator: argv[55] = "-device" emulator: argv[56] = "virtio-rng-pci" emulator: argv[57] = "-show-cursor" emulator: argv[58] = "-L" emulator: argv[59] = "/opt/android-sdk-linux/emulator/lib/pc-bios" emulator: argv[60] = "-soundhw" emulator: argv[61] = "hda" emulator: argv[62] = "-vga" emulator: argv[63] = "none" emulator: argv[64] = "-enable-kvm" emulator: argv[65] = "-append" emulator: argv[66] = "qemu=1 no_timer_check androidboot.hardware=ranchu androidboot.serialno=EMULATOR29X0X9X0 clocksource=pit no-kvmclock android.qemud=1 console=0 android.bootanim=0 qemu.gles=1 qemu.settings.system.screen_off_timeout=2147483647 qemu.encrypt=1 qemu.opengles.version=131072 cma=272M@0-4G ndns=4 qemu.wifi=1 mac80211_hwsim.channels=2 androidboot.android_dt_dir=/sys/bus/platform/devices/ANDR0001:00/properties/android/ loop.max_part=7 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=384m" emulator: argv[67] = "-android-hw" emulator: argv[68] = "/root/.android/avd/android8.1-1.avd/hardware-qemu.ini" Concatenated QEMU options: /opt/android-sdk-linux/emulator/qemu/linux-x86_64/qemu-system-x86_64 -dns-server 10.201.4.31,10.65.27.211,10.202.4.31,10.65.27.212 -no-audio -mem-path /root/.android/avd/android8.1-1.avd/snapshots/default_boot/ram.img -mem-file-shared -serial null -device goldfish_pstore,addr=0xff018000,size=0x10000,file=/root/.android/avd/android8.1-1.avd/data/misc/pstore/pstore.bin -cpu android64 -enable-kvm -smp cores=2 -m 1536 -lcd-density 320 -object iothread,id=disk-iothread -nodefaults -kernel /opt/android-sdk-linux/system-images/android-27/google_apis/x86//kernel-ranchu-64 -initrd /opt/android-sdk-linux/system-images/android-27/google_apis/x86//ramdisk.img -drive if=none,index=0,id=system,file=/root/.android/avd/android8.1-1.avd/system.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=system,iothread=disk-iothread,modern-pio-notify -drive if=none,index=1,id=cache,file=/root/.android/avd/android8.1-1.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify -drive if=none,index=2,id=userdata,file=/root/.android/avd/android8.1-1.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify -drive if=none,index=3,id=encrypt,file=/root/.android/avd/android8.1-1.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify -drive if=none,index=4,id=vendor,file=/root/.android/avd/android8.1-1.avd/vendor.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=vendor,iothread=disk-iothread,modern-pio-notify -drive if=none,index=5,id=sdcard,file=/sdcard.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=sdcard,iothread=disk-iothread,modern-pio-notify -netdev user,id=mynet -device virtio-net-pci,netdev=mynet -device virtio-rng-pci -show-cursor -L /opt/android-sdk-linux/emulator/lib/pc-bios -soundhw hda -vga none -enable-kvm -append 'qemu=1 no_timer_check androidboot.hardware=ranchu androidboot.serialno=EMULATOR29X0X9X0 clocksource=pit no-kvmclock android.qemud=1 console=0 android.bootanim=0 qemu.gles=1 qemu.settings.system.screen_off_timeout=2147483647 qemu.encrypt=1 qemu.opengles.version=131072 cma=272M@0-4G ndns=4 qemu.wifi=1 mac80211_hwsim.channels=2 androidboot.android_dt_dir=/sys/bus/platform/devices/ANDR0001:00/properties/android/ loop.max_part=7 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=384m' -android-hw /root/.android/avd/android8.1-1.avd/hardware-qemu.ini emulator: Android qemu version 29.0.9.0 (build_id 5537588) (CL:N/A)

emulator: Starting QEMU main loop emulator: registered 'boot-properties' qemud service emulator: Adding boot property: 'ro.opengles.version' = '131072' emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back' emulator: Adding boot property: 'dalvik.vm.heapsize' = '384m' emulator: Adding boot property: 'qemu.hw.mainkeys' = '0'

emulator: emulator_window_fb_rotate

emulator: No acpi ini file provided, using default

error: device offline Segmentation fault (core dumped) error: no devices/emulators found error: no devices/emulators found

julialiuliu commented 5 years ago

If I use "cm" to launch "android:8.1" and selenoid-ui, then I would not see "android" on "http://localhost:8080/#/".

./cm selenoid start --browsers "android:8.1" or ./cm selenoid start configure --browsers "firefox;android" --last-versions 2 --tmpfs 128 --vnc --force ./cm selenoid-ui start

image

julialiuliu commented 5 years ago

I doubt it is because the linux kernel is too old, because I saw the emulator log printed: emulator: Auto-detect: Kernel does not support YAFFS2 partitions.

@vania-pooh , do you have any idea? Also I have question regarding how to debug if I use cm to launch the selenoid:andriod?

vania-pooh commented 5 years ago

@julialiuliu

Sorry for the delay.

1) Correct CM command is:

$ ./cm selenoid start --browsers "firefox;android:8.1" --force # --force will overwrite config file

Using this command you should see Android. On your screenshot you have a red SSE indicator (both SSE and Selenoid should be green) and this seems to be a connection issue between Selenoid and Selenoid UI.

2) Regarding to emulator - you should have a core dump file in working directory (a file named /coreXXXXX). Having this file we could try to print a backtrace of the segfault with gdb or similar tool. However this seems to be rather complicated. Could you try one of the following:

We are usually testing our images under Ubuntu 16.04 or 18.04. I think this is something related to CentOS security.

julialiuliu commented 5 years ago

Thank you @vania-pooh for the reply.

  1. I updated the kernel to 5.1.8 on my CentOS7.
  2. I checked the SELinux is ON, on the CentOS7.

I build android docker image on OS: CentOS 7, Kernel version: 5.1.8-1.el7.elrepo.x86_64 Launch the container and log into it, to run Android emulator manually via command "/opt/android-sdk-linux/emulator/emulator -no-boot-anim -no-audio -no-jni -avd android8.1-1 -sdcard /sdcard.img -skin WXGA800 -skindir /opt/android-sdk-linux/platforms/android-27/skins/ -verbose -gpu swiftshader_indirect -qemu -enable-kvm" , get error like this: "QtLogger.cpp:66: Fatal: This application failed to start because no Qt platform plugin could be initialized."

Below is the full error stack. `root@b6ca6afd8c0e:/opt/android-sdk-linux/tools/bin# /opt/android-sdk-linux/emulator/emulator -no-boot-anim -no-audio -no-jni -avd android8.1-1 -sdcard /sdcard.img -skin WXGA800 -skindir /opt/android-sdk-linux/platforms/android-27/skins/ -verbose -gpu swiftshader_indirect -qemu -enable-kvm

emulator: Android emulator version 29.0.11.0 (build_id 5598178) (CL:N/A)

emulator: Found AVD name 'android8.1-1'

emulator: Found AVD target architecture: x86

emulator: argv[0]: '/opt/android-sdk-linux/emulator/emulator'; program directory: '/opt/android-sdk-linux/emulator'

emulator: Found directory: /opt/android-sdk-linux/system-images/android-27/google_apis/x86/

emulator: emuDirName: '/opt/android-sdk-linux/emulator'

emulator: Found directory: /opt/android-sdk-linux/system-images/android-27/google_apis/x86/

emulator: Probing for /opt/android-sdk-linux/system-images/android-27/google_apis/x86//kernel-ranchu-64: file exists

emulator: try dir /opt/android-sdk-linux/emulator

emulator: Trying emulator path '/opt/android-sdk-linux/emulator/qemu/linux-x86_64/qemu-system-x86_64'

emulator: Found target-specific 64-bit emulator binary: /opt/android-sdk-linux/emulator/qemu/linux-x86_64/qemu-system-x86_64

emulator: Adding library search path: '/opt/android-sdk-linux/emulator/lib64'

emulator: Adding library search path: '/opt/android-sdk-linux/emulator/lib64/gles_swiftshader'

emulator: Adding library search path: '/opt/android-sdk-linux/emulator/lib64/gles_angle'

emulator: Adding library search path: '/opt/android-sdk-linux/emulator/lib64/gles_angle9'

emulator: Adding library search path: '/opt/android-sdk-linux/emulator/lib64/gles_angle11'

emulator: Adding library search path: '/opt/android-sdk-linux/emulator/lib64/libstdc++'

emulator: Adding library search path for Qt: '/opt/android-sdk-linux/emulator/lib64/qt/lib'

emulator: Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=/opt/android-sdk-linux/emulator/lib64/qt/plugins

emulator: Setting Qt to use software OpenGL: QT_OPENGL=software

emulator: Overriding pre-existing bad Qt high dpi settings...

emulator: Running :/opt/android-sdk-linux/emulator/qemu/linux-x86_64/qemu-system-x86_64

emulator: qemu backend: argv[00] = "/opt/android-sdk-linux/emulator/qemu/linux-x86_64/qemu-system-x86_64"

emulator: qemu backend: argv[01] = "-no-boot-anim"

emulator: qemu backend: argv[02] = "-no-audio"

emulator: qemu backend: argv[03] = "-no-jni"

emulator: qemu backend: argv[04] = "-avd"

emulator: qemu backend: argv[05] = "android8.1-1"

emulator: qemu backend: argv[06] = "-sdcard"

emulator: qemu backend: argv[07] = "/sdcard.img"

emulator: qemu backend: argv[08] = "-skin"

emulator: qemu backend: argv[09] = "WXGA800"

emulator: qemu backend: argv[10] = "-skindir"

emulator: qemu backend: argv[11] = "/opt/android-sdk-linux/platforms/android-27/skins/"

emulator: qemu backend: argv[12] = "-verbose"

emulator: qemu backend: argv[13] = "-gpu"

emulator: qemu backend: argv[14] = "swiftshader_indirect"

emulator: qemu backend: argv[15] = "-qemu"

emulator: qemu backend: argv[16] = "-enable-kvm"

emulator: Concatenated backend parameters:

/opt/android-sdk-linux/emulator/qemu/linux-x86_64/qemu-system-x86_64 -no-boot-anim -no-audio -no-jni -avd android8.1-1 -sdcard /sdcard.img -skin WXGA800 -skindir /opt/android-sdk-linux/platforms/android-27/skins/ -verbose -gpu swiftshader_indirect -qemu -enable-kvm

emulator: autoconfig: -kernel /opt/android-sdk-linux/system-images/android-27/google_apis/x86//kernel-ranchu-64

emulator: Target arch = 'x86'

emulator: Auto-config: -qemu -cpu qemu32

emulator: Auto-detect: Kernel image requires new device naming scheme.

emulator: Auto-detect: Kernel does not support YAFFS2 partitions.

emulator: autoconfig: -ramdisk /opt/android-sdk-linux/system-images/android-27/google_apis/x86//ramdisk.img

emulator: Using initial system image: /opt/android-sdk-linux/system-images/android-27/google_apis/x86//system.img

emulator: Using initial vendor image: /opt/android-sdk-linux/system-images/android-27/google_apis/x86//vendor.img

emulator: autoconfig: -data /root/.android/avd/android8.1-1.avd/userdata-qemu.img

emulator: autoconfig: -initdata (null)

emulator: autoconfig: -cache /root/.android/avd/android8.1-1.avd/cache.img

emulator: Increasing RAM size to 1536MB

emulator: VM heap size 48MB is below hardware specified minimum of 192MB,setting it to that value

emulator: System image is read only

emulator: Found 4 DNS servers: 10.201.4.31 10.65.27.211 10.202.4.31 10.65.27.212

emulator: trying to load skin file '/opt/android-sdk-linux/platforms/android-27/skins//WXGA800/layout'

statvfs('/root/.android/avd/android8.1-1.avd/snapshots/default_boot/ram.img') failed: No such file or directory

emulator: registered 'boot-properties' qemud service

emulator: Adding boot property: 'qemu.cmdline' = 'androidboot.logcat=v:* androidboot.consolepipe=qemu_pipe,pipe:logcat'

emulator: Adding boot property: 'qemu.logcat' = 'start'

emulator: CPU Acceleration: working

emulator: CPU Acceleration status: KVM (version 12) is installed and usable.

Warning: could not connect to display ((null):0, (null))

emulator: INFO: QtLogger.cpp:66: Warning: could not connect to display ((null):0, (null))

emulator: INFO: QtLogger.cpp:66: Info: Could not load the Qt platform plugin "xcb" in "/opt/android-sdk-linux/emulator/lib64/qt/plugins" even though it was found. ((null):0, (null))

Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb. ((null):0, (null))

emulator: INFO: QtLogger.cpp:66: Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb. ((null):0, (null))

Aborted (core dumped)

emilorol commented 5 years ago

To manually debug the emulator and Qt run the following exports:

export QT_DEBUG_PLUGINS=1
export ANDROID_EMULATOR_DEBUG=1

Also I was able to get all the Qt errors solved in CentOS by installing qt5-qtbase-devel

yum install -y qt5-qtbase-devel