starting zygote from command line (x86)

1,269 views
Skip to first unread message

Zia

unread,
Feb 4, 2009, 8:40:57 PM2/4/09
to android-porting
I got myself in a console now after compiling installer img with
zygote service commented out in the init.rc file. Instead I placed /
system/bin/sh service in the init.rc .

After reboot, I got the prompt. On the command line when I attempt to
start zygote (to enter Android UI),
app_process -Xzygote /system/bin --zygote

first I got ANDROID_SOCKET_zygote environment variable error. I fixed
that, and now I am getting error when binding to socket 666. Seems
like i'm missing /dev/socket/zygote. The problem is, I dont know how
to create socket on this command shell now. Another thing could be the
missing socket binder service.

Any ideas or suggestions to recover from this?

Ultimately, I'm planning to enter a console, start zygote to enter
Android UI. On the console I plan to run dropbear or telnetd to
remotely connect to the box.

Thanks,

Zia

dingerjun

unread,
Feb 4, 2009, 9:31:40 PM2/4/09
to android...@googlegroups.com

There is another method to start the zygote from command line.

You could add the lines after the service zygote.
like:
on property:zygote.enable=1
start zygote
on property:zygote.enable=0
stop zygote

and add a line "setprop zygote.enable 0" in front of file /init.rc

dingerjun

unread,
Feb 4, 2009, 9:33:41 PM2/4/09
to android...@googlegroups.com
When you want to start the zygote, you could input setprop zygote.enable 1 in command line

Weihua Wu

unread,
Feb 4, 2009, 10:07:19 PM2/4/09
to android...@googlegroups.com
The init.rc is not a shell script in normal linux. You have to register the service in init.rc during Android init. 
The following line in init.rc is to create the socket. The socket is created when the init.rc is parsed by android init. 
    socket zygote stream 666
Android use that way to create socket for security concern probably. 

You could learn more about init.rc from system/core/init/readme.txt

Hope it's helpful. 
Weihua(Jackie) Wu

Zia

unread,
Feb 6, 2009, 3:32:31 PM2/6/09
to android-porting
Thanks for your replies. However, so far not much luck here. I got the
zygote socket created in /dev/socket and the environment variable
ANDROID_SOCKET_zygote set to 666.

Now i'm getting

java.lang.RuntimeException: Error binding to local socket '666'
at com.android.internal.os.ZygoteInit.registerZygoteSocket
(ZygoteInit.java:164)

the command line i'm using is
#app_process -Xzygote /system/bin --zygote

and the init.rc is like this

setprop zygote.enable 0

service zygote /system/bin/app_process -Xzygote /system/bin --zygote --
start-system-server
socket zygote stream 666
on property:zygote.enable=1
start zygote
on property:zygote.enable=0
start zygote

----
typing setprop zygote.enable 1 on the command line doesn't do anything
either. What am I missing here now?

Thanks,

-Z

On Feb 4, 7:07 pm, Weihua Wu <wwh.andr...@gmail.com> wrote:
> The init.rc is not a shell script in normal linux. You have to register the
> service in init.rc during Android init. The following line in init.rc is to
> create the socket. The socket is created when the init.rc is parsed by
> android init.
>     socket zygote stream 666
> Android use that way to create socket for security concern probably.
>
> You could learn more about init.rc from system/core/init/readme.txt
>
> Hope it's helpful.
> Weihua(Jackie) Wu
>

Weihua Wu

unread,
Feb 8, 2009, 10:37:46 PM2/8/09
to android...@googlegroups.com
What dingerjun wrote is :
on property:zygote.enable=1
   start zygote
on property:zygote.enable=0
   stop zygote
 
But yours are
          on property:zygote.enable=1
             start zygote
          on property:zygote.enable=0
             start zygote
 
So I think in your case, the zygote has been started when you run command. You can check with ps first.
If the zygote is started through command line, other lines after that in init.rc should be also changed since some depend on the zygote, which is the most important to start Android.
 
Why do you need to start that on command line? Did you start zygote successfully with normal way instead of command line?
 
Thanks
Jackie Wu

Zia

unread,
Feb 9, 2009, 8:07:38 PM2/9/09
to android-porting
oh dang it. thanks for spotting that. I will try the fix tonight and
post the results.

The reason I would like to enter commandline mode before UI:
1) to understand how everything stacks up
2) run any sort of SSH/Telnet server and access the box remotely.

-Zia.

On Feb 8, 7:37 pm, Weihua Wu <wwh.andr...@gmail.com> wrote:
> What dingerjun wrote is :
> on property:zygote.enable=1
>    start zygote
> on property:zygote.enable=0
>    stop zygote
>
> But yours are
>           on property:zygote.enable=1
>              start zygote
>           on property:zygote.enable=0
>              start zygote
>
> So I think in your case, the zygote has been started when you run command.
> You can check with ps first.
> If the zygote is started through command line, other lines after that in
> init.rc should be also changed since some depend on the zygote, which is the
> most important to start Android.
>
> Why do you need to start that on command line? Did you start zygote
> successfully with normal way instead of command line?
>
> Thanks
> Jackie Wu
>

jerryfan2000

unread,
Apr 10, 2009, 2:00:53 AM4/10/09
to android-porting
If set service option to disabled, how do I manually start the service
by command line?

On 2月10日, 上午9時07分, Zia <zia.cha...@gmail.com> wrote:
> oh dang it. thanks for spotting that. I will try the fix tonight and
> post the results.
>
> The reason I would like to enter commandline mode before UI:
> 1) to understand how everything stacks up
> 2) run any sort of SSH/Telnet server and access the box remotely.
>
> -Zia.
>
> On Feb 8, 7:37 pm, Weihua Wu <wwh.andr...@gmail.com> wrote:
>
> > What dingerjun wrote is :
> > on property:zygote.enable=1
> > start zygote
> > on property:zygote.enable=0
> > stop zygote
>
> > But yours are
> > on property:zygote.enable=1
> > start zygote
> > on property:zygote.enable=0
> > start zygote
>
> > So I think in your case, the zygote has been started when you run command.
> > You can check with ps first.
> > If the zygote is started through command line, other lines after that in
> >init.rcshould be also changed since some depend on the zygote, which is the
> > most important to start Android.
>
> > Why do you need to start that on command line? Did you start zygote
> > successfully with normal way instead of command line?
>
> > Thanks
> > Jackie Wu
>
> > On Sat, Feb 7, 2009 at 4:32 AM, Zia <zia.cha...@gmail.com> wrote:
>
> > > Thanks for your replies. However, so far not much luck here. I got the
> > > zygote socket created in /dev/socket and the environment variable
> > > ANDROID_SOCKET_zygote set to 666.
>
> > > Now i'm getting
>
> > > java.lang.RuntimeException: Error binding to local socket '666'
> > > at com.android.internal.os.ZygoteInit.registerZygoteSocket
> > > (ZygoteInit.java:164)
>
> > > the command line i'm using is
> > > #app_process -Xzygote /system/bin --zygote
>
> > > and theinit.rcis like this
>
> > > setprop zygote.enable 0
>
> > > service zygote /system/bin/app_process -Xzygote /system/bin --zygote --
> > > start-system-server
> > > socket zygote stream 666
> > > on property:zygote.enable=1
> > > start zygote
> > > on property:zygote.enable=0
> > > start zygote
>
> > > ----
> > > typing setprop zygote.enable 1 on the command line doesn't do anything
> > > either. What am I missing here now?
>
> > > Thanks,
>
> > > -Z
>
> > > On Feb 4, 7:07 pm, Weihua Wu <wwh.andr...@gmail.com> wrote:
> > > > Theinit.rcis not a shell script in normal linux. You have to register
> > > the
> > > > service ininit.rcduring Android init. The following line ininit.rcis
> > > to
> > > > create the socket. The socket is created when theinit.rcis parsed by
> > > > android init.
> > > > socket zygote stream 666
> > > > Android use that way to create socket for security concern probably.
>
> > > > You could learn more aboutinit.rcfrom system/core/init/readme.txt
>
> > > > Hope it's helpful.
> > > > Weihua(Jackie) Wu
>
> > > > On Thu, Feb 5, 2009 at 9:40 AM, Zia <zia.cha...@gmail.com> wrote:
>
> > > > > I got myself in a console now after compiling installer img with
> > > > > zygote service commented out in theinit.rcfile. Instead I placed /
Reply all
Reply to author
Forward
0 new messages