I was trying to play with Android platform on Ubuntu 11.04 but I hit a roadblock trying to run an emulated Android device using a non-root account. Did an strace but nothing stands out, not that I am an expert. Searching the web does not provide me with something really useful.
Here few things interesting. Running an android virtual device as root works as expected. But running an android virtual device as a regular user halt/stops at a blank window for the emulated device.
Running it verbose shows the following:
//---- some of the strings removed ----
.
QEMU options list:
emulator: argv[00] = "./emulator-arm"
emulator: argv[01] = "-android-hw"
emulator: argv[02] = "/home/timus/.android/avd/e.avd/hardware-qemu.ini"
Concatenated QEMU options:
./emulator-arm -android-hw /home/timus/.android/avd/e.avd/hardware-qemu.ini
emulator: registered 'boot-properties' qemud service
emulator: nand_add_dev: system,size=0x4e00000,initfile=/home/timus/android/platforms/android-8/images//system.img
emulator: mapping 'system' NAND image to /tmp/android-timus/emulator-kTuuh9
emulator: rounding devsize up to a full eraseunit, now 4e1e000
emulator: nand_add_dev: userdata,size=0x4200000,file=/home/timus/.android/avd/e.avd/userdata-qemu.img
emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'dalvik.vm.heapsize' = '24m'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '120'
emulator: nand_add_dev: cache,size=0x4200000,file=/home/timus/.android/avd/e.avd/cache.img
emulator: Kernel parameters: qemu=1 console=ttyS0 android.qemud=ttyS1 android.checkjni=1 ndns=1
emulator: Trace file name is not set
emulator: autoconfig: -scale 1
emulator: control console listening on port 5554, ADB on port 5555
emulator: sent '0012host:emulator:5555' to ADB server
emulator: ping program: /home/timus/android/tools/ddms
emulator: ping command: /home/timus/android/tools/ddms ping emulator 13.0
strace shows the following, with the top messages cut off:
//---- a lot of messages before this... left out as I am not sure if it helps ----
open("/home/timus/.android/modem-nv-ram-5554", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0755) = 21
write(21, "modem_technology gsm\noper_name_i"..., 171) = 171
close(21) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 21
connect(21, {sa_family=AF_INET, sin_port=htons(5037), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
send(21, "0012host:emulator:5555", 22, 0) = 22
write(1, "emulator: sent '0012host:emulato"..., 54emulator: sent '0012host:emulator:5555' to ADB server
) = 54
shutdown(21, 2 /* send and receive */) = 0
close(21) = 0
readlink("/proc/self/exe", "/home/timus/android/tools/emulator-arm"..., 1024) = 38
write(1, "emulator: ping program: /home/ti"..., 55emulator: ping program: /home/timus/android/tools/ddms
) = 55
access("/home/timus/android/tools/ddms", F_OK) = 0
rt_sigprocmask(SIG_BLOCK, [ALRM], [ALRM], 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7809948) = 6537
rt_sigprocmask(SIG_SETMASK, [ALRM], NULL, 8) = 0
write(1, "emulator: ping command: /home/ti"..., 74emulator: ping command: /home/timus/android/tools/ddms ping emulator 13.0
) = 74
brk(0xa643000) = 0xa643000
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\22\0\10\0\3\0\340\4'\0\0\0\37\0\0\0\10\0\0\0\6\0\0\0005554:e\7\0"..., 132}, {NULL, 0}, {"", 0}], 3) = 132
poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
read(3, "\34\0~\0\3\0\340\4'\0\0\0\302\20\357\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 160
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
clock_gettime(CLOCK_MONOTONIC, {49221, 836305909}) = 0
select(21, [8 11 19 20], [], [], {0, 0}) = 1 (in [19], left {0, 0})
gettimeofday({1316917045, 343804}, NULL) = 0
accept(19, {sa_family=AF_INET, sin_port=htons(52886), sin_addr=inet_addr("127.0.0.1")}, [16]) = 21
fcntl64(21, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(21, F_SETFL, O_RDWR|O_NONBLOCK) = 0
setsockopt(21, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(21, SOL_SOCKET, SO_OOBINLINE, [1], 4) = 0
setsockopt(21, SOL_TCP, TCP_NODELAY, [1], 4) = 0
clock_gettime(CLOCK_MONOTONIC, {49221, 837887026}) = 0
clock_gettime(CLOCK_MONOTONIC, {49221, 837911639}) = 0
read(3, "\34\0\202\0\3\0\340\4\16\1\0\0\307\20\357\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, "\226\0\202\0\3\0\340\4\3\0\340\4&\0`\4\270\1k\0\307\2\263\1\0\0\0\0\0\0\0\0"..., 4096) = 128
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
select(4, [3], NULL, NULL, {0, 0}) = 0 (Timeout)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
select(4, [3], NULL, NULL, {0, 0}) = 0 (Timeout)
clock_gettime(CLOCK_MONOTONIC, {49221, 894015842}) = 0
gettimeofday({1316917045, 400822}, NULL) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
waitpid(-1, NULL, WNOHANG) = 6537
sigreturn() = ? (mask now [ALRM])
clock_gettime(CLOCK_MONOTONIC, {49223, 124717374}) = 0
clock_gettime(CLOCK_MONOTONIC, {49223, 124752199}) = 0
As a workaround, I have to run the application using sudo (essentially as a root user). Anyway, my command looks like:
I will keep on investigating what it takes to run emulated Android device in Ubuntu 11.04 as non-root.
~ts
Here few things interesting. Running an android virtual device as root works as expected. But running an android virtual device as a regular user halt/stops at a blank window for the emulated device.
Running it verbose shows the following:
//---- some of the strings removed ----
.
QEMU options list:
emulator: argv[00] = "./emulator-arm"
emulator: argv[01] = "-android-hw"
emulator: argv[02] = "/home/timus/.android/avd/e.avd/hardware-qemu.ini"
Concatenated QEMU options:
./emulator-arm -android-hw /home/timus/.android/avd/e.avd/hardware-qemu.ini
emulator: registered 'boot-properties' qemud service
emulator: nand_add_dev: system,size=0x4e00000,initfile=/home/timus/android/platforms/android-8/images//system.img
emulator: mapping 'system' NAND image to /tmp/android-timus/emulator-kTuuh9
emulator: rounding devsize up to a full eraseunit, now 4e1e000
emulator: nand_add_dev: userdata,size=0x4200000,file=/home/timus/.android/avd/e.avd/userdata-qemu.img
emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'dalvik.vm.heapsize' = '24m'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '120'
emulator: nand_add_dev: cache,size=0x4200000,file=/home/timus/.android/avd/e.avd/cache.img
emulator: Kernel parameters: qemu=1 console=ttyS0 android.qemud=ttyS1 android.checkjni=1 ndns=1
emulator: Trace file name is not set
emulator: autoconfig: -scale 1
emulator: control console listening on port 5554, ADB on port 5555
emulator: sent '0012host:emulator:5555' to ADB server
emulator: ping program: /home/timus/android/tools/ddms
emulator: ping command: /home/timus/android/tools/ddms ping emulator 13.0
//---- a lot of messages before this... left out as I am not sure if it helps ----
open("/home/timus/.android/modem-nv-ram-5554", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0755) = 21
write(21, "modem_technology gsm\noper_name_i"..., 171) = 171
close(21) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 21
connect(21, {sa_family=AF_INET, sin_port=htons(5037), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
send(21, "0012host:emulator:5555", 22, 0) = 22
write(1, "emulator: sent '0012host:emulato"..., 54emulator: sent '0012host:emulator:5555' to ADB server
) = 54
shutdown(21, 2 /* send and receive */) = 0
close(21) = 0
readlink("/proc/self/exe", "/home/timus/android/tools/emulator-arm"..., 1024) = 38
write(1, "emulator: ping program: /home/ti"..., 55emulator: ping program: /home/timus/android/tools/ddms
) = 55
access("/home/timus/android/tools/ddms", F_OK) = 0
rt_sigprocmask(SIG_BLOCK, [ALRM], [ALRM], 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7809948) = 6537
rt_sigprocmask(SIG_SETMASK, [ALRM], NULL, 8) = 0
write(1, "emulator: ping command: /home/ti"..., 74emulator: ping command: /home/timus/android/tools/ddms ping emulator 13.0
) = 74
brk(0xa643000) = 0xa643000
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\22\0\10\0\3\0\340\4'\0\0\0\37\0\0\0\10\0\0\0\6\0\0\0005554:e\7\0"..., 132}, {NULL, 0}, {"", 0}], 3) = 132
poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
read(3, "\34\0~\0\3\0\340\4'\0\0\0\302\20\357\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 160
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
clock_gettime(CLOCK_MONOTONIC, {49221, 836305909}) = 0
select(21, [8 11 19 20], [], [], {0, 0}) = 1 (in [19], left {0, 0})
gettimeofday({1316917045, 343804}, NULL) = 0
accept(19, {sa_family=AF_INET, sin_port=htons(52886), sin_addr=inet_addr("127.0.0.1")}, [16]) = 21
fcntl64(21, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(21, F_SETFL, O_RDWR|O_NONBLOCK) = 0
setsockopt(21, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(21, SOL_SOCKET, SO_OOBINLINE, [1], 4) = 0
setsockopt(21, SOL_TCP, TCP_NODELAY, [1], 4) = 0
clock_gettime(CLOCK_MONOTONIC, {49221, 837887026}) = 0
clock_gettime(CLOCK_MONOTONIC, {49221, 837911639}) = 0
read(3, "\34\0\202\0\3\0\340\4\16\1\0\0\307\20\357\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, "\226\0\202\0\3\0\340\4\3\0\340\4&\0`\4\270\1k\0\307\2\263\1\0\0\0\0\0\0\0\0"..., 4096) = 128
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
select(4, [3], NULL, NULL, {0, 0}) = 0 (Timeout)
read(3, 0xa2a84a0, 4096) = -1 EAGAIN (Resource temporarily unavailable)
select(4, [3], NULL, NULL, {0, 0}) = 0 (Timeout)
clock_gettime(CLOCK_MONOTONIC, {49221, 894015842}) = 0
gettimeofday({1316917045, 400822}, NULL) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
waitpid(-1, NULL, WNOHANG) = 6537
sigreturn() = ? (mask now [ALRM])
clock_gettime(CLOCK_MONOTONIC, {49223, 124717374}) = 0
clock_gettime(CLOCK_MONOTONIC, {49223, 124752199}) = 0
./emulator @my_avd -verbose
I will keep on investigating what it takes to run emulated Android device in Ubuntu 11.04 as non-root.
~ts
Comments