I am having problems with the Android Emulator Plugin in Jenkins. I am trying to start an emulator, but most of the times, it will just wait until the device is online, resulting in a timeout.
The errorcode can be seen here:
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe connect localhost:6086
connected to localhost:6086
[android] Waiting for emulator to finish booting...
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe -s localhost:6086 shell getprop init.svc.bootanim
error: device offline
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe connect localhost:6086
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe -s localhost:6086 shell getprop init.svc.bootanim
error: device offline
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe connect localhost:6086
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe -s localhost:6086 shell getprop init.svc.bootanim
error: device offline
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe disconnect localhost:6086
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe connect localhost:6086
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe -s localhost:6086 shell getprop init.svc.bootanim
error: device offline
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe connect localhost:6086
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe -s localhost:6086 shell getprop init.svc.bootanim
error: device offline
... A LOT of repeating ...
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe connect localhost:6086
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe -s localhost:6086 shell getprop init.svc.bootanim
error: device offline
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe connect localhost:6086
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe -s localhost:6086 shell getprop init.svc.bootanim
error: device offline
$ C:\Users\Administrator\Documents\Jenkins\AndroidSDK/platform-tools/adb.exe connect localhost:6086
[android] Timed-out after waiting 720 seconds for emulator
Does anyone know how to fix this?
Related
Sharing a solution to this issue in case it's helpful to somebody, as the exact issue / fix doesn't seem to be covered by other threads with similar titles.
The symptom was that on attempting to create a new vm with docker-machine create --driver hyperv testvm, the process hung at:
Running pre-create checks...
Creating machine...
(testvm) Copying F:\Virtual\Docker\cache\boot2docker.iso to
F:\Virtual\Docker\machines\testvm\boot2docker.iso...
(testvm) Creating SSH key...
(testvm) Creating VM...
(testvm) Using switch "Docker External Switch"
(testvm) Creating VHD
(testvm) Starting VM...
(testvm) Waiting for host to start...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
This was with Windows 10 Pro, Hyper-V, and a fresh install of Docker Desktop Community 2.0.0.3 (although I suspect that Hyper-V is irrelevant to this issue).
When I ctrl-c'd out of the create command I could docker-machine ls and see that the VM was up, but was showing an error:
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
testvm - hyperv Running tcp://192.168.5.61:2376 Unknown Unable to query docker version: Get https://192.168.5.60:2376/v1.15/version: x509: certificate signed by unknown authority
All attempts to docker-machine ssh to it failed similarly:
PS C:\> docker-machine ssh testvm
exit status 255
I tried using git bash as suggested in various threads elsewhere, but was seeing, eg:
$ docker-machine ssh testvm
Error: Cannot run SSH command: Host "testvm" is not running
(Likely some kind of configuration issue with my git bash install, but was unable to figure out what it was!)
The problem turned out to be some kind of compatibility issue with my installation of OpenSSH here:
PS C:\> get-command ssh
CommandType Name Version Source
----------- ---- ------- ------
Application ssh.exe 7.7.2.1 C:\Windows\System32\OpenSSH\ssh.exe
This was producing debug output (when docker-machine was run with the -debug switch) along these lines:
(testvm) Calling .GetSSHPort
(testvm) Calling .GetSSHKeyPath
(testvm) Calling .GetSSHKeyPath
(testvm) Calling .GetSSHUsername
Using SSH client type: external
&{[-F /dev/null -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none -o LogLevel=quiet -o PasswordAuthentication=no -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null docker#192.168.5.61 -o IdentitiesOnly=yes -i F:\Virtual\Docker\machines\testvm\id_rsa -p 22] C:\Windows\System32\OpenSSH\ssh.exe <nil>}
About to run SSH command:
exit 0
SSH cmd err, output: exit status 255:
Error getting ssh command 'exit 0' : ssh command error:
command : exit 0
err : exit status 255
output :
Everything started to work when I used the --native-ssh switch which is documented here. I was then able to:
docker-machine --native-ssh regenerate-certs testvm
..to resolve the certificate issue, and:
PS C:\> docker-machine --native-ssh ssh testvm ps
PID TTY TIME CMD
3301 pts/0 00:00:00 ps
..etc.
Probably better though to:
docker-machine rm -y testvm
docker-machine --native-ssh create --driver hyperv testvm
Everything was working for me without the switch at one point - my guess is that I didn't have OpenSSH installed at that time, and docker-machine was using its native version by default.
I have a raspberry pi running an older version of Android things that is capable of connecting to my wifi. I copied and inserted the wpa_supplicant file from that pi to another pi with an updated version of android things but the new pi is unable to connect to the wifi. Am I missing something here?
There is a guide on how to do this.
In the adb shell you can execute this command:
am startservice \
-n com.google.wifisetup/.WifiSetupService \
-a WifiSetupService.Connect \
-e ssid my-ssid \
-e passphrase my-passphrase
I want to deploy Hortonworks Sandbox on Docker.
My installation is stuck on :
Waiting for ambari agent to connect
....... "state" : "INSTALLED",
I looked into the start_sandbox_hdp.sh and found that installation is stuck on:
docker exec -t sandbox-hdp /bin/sh -c ' until curl --silent -u admin:password123 -H "X-Requested-By:ambari" -i -X GET http://localhost:8080/api/v1/clusters/Sandbox/hosts/sandbox-hdp.hortonworks.com/host_components/ZOOKEEPER_SERVER | grep state | grep -v desired | grep INSTALLED; do sleep 5; echo -n .; done;'
It is a problem of docker's version. Uninstall the current version 17.12 and install the version 17.09. It should works now.
I wanted to run a docker container at work following these instructions:
https://docs.docker.com/machine/drivers/hyper-v/#environment-variables-and-default-values
when I run docker-machine -D create -d hyperv --hyperv-virtual-switch "minikube" --hyperv-cpu-count "1" --hyperv-memory "1024" --hyperv-disk-size "20000" worker4
docker is stuck and repeats this step further and further:
Waiting for SSH to be available...
Getting to WaitForSSH function...
(worker4) Calling .GetSSHHostname
(worker4) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM worker4 ).state
(worker4) DBG | [stdout =====>] : Running
(worker4) DBG |
(worker4) DBG | [stderr =====>] :
(worker4) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM worker4 ).networkadapters[0]).ipaddresses[0]
(worker4) DBG | [stdout =====>] : fe80::215:5dff:fe0a:2b3d
(worker4) DBG |
(worker4) DBG | [stderr =====>] :
(worker4) Calling .GetSSHPort
(worker4) Calling .GetSSHKeyPath
(worker4) Calling .GetSSHKeyPath
(worker4) Calling .GetSSHUsername
Using SSH client type: external
&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker#fe80::215:5dff:fe0a:2b3d -o IdentitiesOnly=yes -i C:\Use
rs\account\.docker\machine\machines\worker4\id_rsa -p 22] C:\Program Files\Git\usr\bin\ssh.exe <nil>}
I tried the same steps at home (both systems with Windows 10) and it succeed. After comparing the logs I found out, that I got a local ipv4 adress at home. We are using only ipv4 at work so I am confused why I got an ipv6 address. Could this be the error why it got stuck?
Update:
After I removed git bash and run the command again, I got this error:
Error dialing TCP: dial tcp [fe80::215:5dff:fe0a:2b47]:22: connectex: Ein Socketvorgang bezog sich auf ein nicht verfügbares Netzwerk.
According to Microsoft the Network is unreachable. Can it be that my network card is miss configured or maybe that the router has some problems?
The problem was that the ip adresses from our network are static ones.
Create minikube in an dynamic network
minikube stop
Connect your pc to your static network and give the minikube vm a mac address that can has a connected ip address
minikube start
I have installed Jenkins and configured a build job with emulator running during build. But when I execute the job, I get error message that jenkins user doesn't have permission to run kvm. How can I fix it.
$ android list target
[android] Using Android SDK: /opt/android/sdk
$ adb start-server
* daemon not running. starting it now on port 5973 *
* daemon started successfully *
$ adb start-server
[android] Starting Android emulator
[android] Erasing existing emulator data...
$ emulator -ports 5971,5972 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_1024x768_android-15_x86 -no-snapshot-load -no-snapshot-save -wipe-data
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: This user doesn't have permissions to use KVM (/dev/kvm).
[android] Emulator did not appear to start; giving up
$ adb disconnect localhost:5972
[android] Stopping Android emulator
$ adb kill-server
Permissions
$ ls -l /dev/kvm
crw-rw----+ 1 root root 10, 232 May 6 13:46 /dev/kvm
$ groups jenkins
jenkins : jenkins
I have managed to fix the problem.
Install Qemu-KVM and cpu-checker:
sudo apt install qemu-kvm cpu-checker
Check if KVM is available (as jenkins user):
$ kvm-okINFO: /dev/kvm existsKVM acceleration can be used
Create group kvm and add jenkins to this group:
addgroup kvmusermod -a -G kvm jenkins
Change group ownership for /dev/kvm:
chgrp kvm /dev/kvm
Create udev rule:
$ sudo nano /etc/udev/rules.d/60-qemu-kvm.rules
KERNEL=="kvm", GROUP="kvm", MODE="0660"
Reboot
On my CI (gitlab) this was missing on Ubuntu
usermod -a -G kvm gitlab-runner
or with Jenkins
usermod -a -G kvm jenkins