unable to set system property

6,351 views
Skip to first unread message

guru

unread,
Aug 18, 2010, 9:56:35 AM8/18/10
to android-porting
Hi all


I am trying to set system property so some value. like

# setprop net.eth0.dns1 9
# getprop net.eth0.dns1

#

if i follow above steps it is not setting system property. what may be
the reason for this?

How to make this to set the value?

Thanks
Gururaja

Robert Greenwalt

unread,
Aug 18, 2010, 11:02:21 AM8/18/10
to guru....@gmail.com, android-porting

Deva R

unread,
Aug 18, 2010, 1:55:04 PM8/18/10
to rgree...@google.com, guru....@gmail.com, android-porting
>try 'su' first
Isnt this android console terminal,  by default have root access?

>How to make this to set the value?
Not sure whats wrong, btw tried on my froyo setup, it worked like below just after boot.,

# getprop net.eth0.dns1

#  setprop net.eth0.dns1 9
# getprop net.eth0.dns1
9
#
#

Robert Greenwalt

unread,
Aug 18, 2010, 2:22:35 PM8/18/10
to Deva R, guru....@gmail.com, android-porting
Perhaps - the '#' suggests root, but I know my adb shell doesn't start as root and I've been burned before with this same issue because of that.  Trying it doesn't hurt.  If that's not it I don't know why setprop isn't working.

R

guru

unread,
Aug 19, 2010, 12:35:00 AM8/19/10
to android-porting
Why I asked this question is when i enable wifi, dhcpcd is not setting
system properties like

A)
dhcp.etho.ipaddress
dhcp.eth0.mask
dhcp.eth0.gateway
dhcp.eth0.leasetime
dhcp.eth0.server

but setting onlly

B)
dhcp.eth0.dns1
dhcp.eth0.dns2
dhcp.eth0.dns3


I tried to set above (A) using setprop but it is not setting the
properties.

is there any permission problem with this?

Thanks
Gururaja B O


On Aug 18, 11:22 pm, Robert Greenwalt <rgreenw...@google.com> wrote:
> Perhaps - the '#' suggests root, but I know my adb shell doesn't start as
> root and I've been burned before with this same issue because of that.
>  Trying it doesn't hurt.  If that's not it I don't know why setprop isn't
> working.
>
> R
>
> On Wed, Aug 18, 2010 at 10:55 AM, Deva R <r.deva...@gmail.com> wrote:
> > >try 'su' first
> > Isnt this android console terminal,  by default have root access?
>
> > >How to make this to set the value?
> > Not sure whats wrong, btw tried on my froyo setup, it worked like below
> > just after boot.,
>
> > # getprop net.eth0.dns1
>
> > #  setprop net.eth0.dns1 9
> > # getprop net.eth0.dns1
> > 9
> > #
> > #
>
> > On Wed, Aug 18, 2010 at 8:32 PM, Robert Greenwalt <rgreenw...@google.com>wrote:
>
> >> try 'su' first
>
> >> R
>
> >> On Wed, Aug 18, 2010 at 6:56 AM, guru <guru.nav...@gmail.com> wrote:
>
> >>> Hi all
>
> >>> I am trying to set system property so some value. like
>
> >>> # setprop net.eth0.dns1 9
> >>> # getprop net.eth0.dns1
>
> >>> #
>
> >>> if i follow above steps it is not setting system property. what may be
> >>> the reason for this?
>
> >>> How to make this to set the value?
>
> >>> Thanks
> >>> Gururaja
>
> >>> --
> >>> unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsu...@googlegroups.com>
> >>> website:http://groups.google.com/group/android-porting
>
> >>  --
> >> unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsu...@googlegroups.com>
> >> website:http://groups.google.com/group/android-porting

guru

unread,
Aug 25, 2010, 6:36:24 AM8/25/10
to android-porting
Hi Rober/Deva R

If I comment some of the existing properties in system.prop I am able
to set the value, otherwise not. Why this behavior and how to deal
with this?

Thanks
Gururaja B O

Robert Greenwalt

unread,
Aug 25, 2010, 12:45:54 PM8/25/10
to guru....@gmail.com, android-porting
Do you mean you can change the value of an existing property but cannot create a new one?

That seems odd.

What device/build?

R

Deva R

unread,
Aug 25, 2010, 4:37:35 PM8/25/10
to rgree...@google.com, guru....@gmail.com, android-porting
(repost from other thread).,

probably the size limit on properities field is blocking.. see
http://git.omapzoom.org/?p=platform/system/core.git;a=blob;f=libcutils/properties.c;hb=refs/heads/p-froyo#l59

The size limits are 
#define PROP_NAME_MAX   32
#define PROP_VALUE_MAX  92

and You can increase the size limit in bionic

Gururaj BO

unread,
Aug 26, 2010, 12:18:14 AM8/26/10
to Deva R, rgree...@google.com, android-porting
Hi Deva R/ rgeenwalt

I doubled the values of below macros

#define PA_COUNT_MAX  247*2
#define PA_INFO_START 1024*2
#define PA_SIZE       32768*2

static workspace pa_workspace;
static prop_info *pa_info_array;

extern prop_area *__system_property_area__;

static int init_property_area(void)

file vi system/core/init/property_service.c

to increase memory allocated to system property. Then it is working fine. What Information I got is currently max 247 system properties we can store. If we try to store more than this we can not set the value.

In my phone it is already reached this value, so  not able to set the vlaues.

So if we can increase this shared memory allocated to system property then we can store more system properties.

Thanks
Gururaja B O

Robert Greenwalt

unread,
Aug 26, 2010, 11:43:36 AM8/26/10
to Gururaj BO, Deva R, android-porting
I don't think we want a huge number of system properties - there are lots of other ways to pass info around and I think many of our use cases are abuses of the system properties mechanism.  If you really need more system properties, you can certainly do this on your builds.

R

Deva R

unread,
Aug 26, 2010, 4:04:55 PM8/26/10
to Robert Greenwalt, Gururaj BO, android-porting

>If we try to store more than this we can not set the value.
> In my phone it is already reached this value, so  not able to set the vlaues.

Hm, not sure what's holding still..
you can debug bionic with gdb/lauterbach(its native library only)/or trace prints,
Reply all
Reply to author
Forward
0 new messages