chmod 777 <file> not working with init.rc

379 views
Skip to first unread message

Pratik Prajapati

unread,
Sep 20, 2011, 11:48:18 AM9/20/11
to android-d...@googlegroups.com, android-...@googlegroups.com, android...@googlegroups.com, android-porting
Hi There,

I'm setting permission to 777 (R+W+E for all) to a script file. But after kernel built and flashed to the system, permission does not get changed as expected. I understand I can give permission in make file while creating filesystem to be flashed on system. But same thing is happening for some sysfs entries. These sysfs entries are created by drivers at boot up time. I have also tried

on device-added-<device node path>
    chmod 777 <sys fs file name>

But I can not set the mode by this method also. However on console (adb shell) i can change the permission. I'm running on 2.1

Any idea, what could be wrong?

Regards,
Pratik


Pratik Prajapati

unread,
Sep 20, 2011, 12:06:09 PM9/20/11
to android...@googlegroups.com, android-d...@googlegroups.com, android-...@googlegroups.com, android-porting
Hi,

I'm doing below things in init.rc only.

(1)

on device-added-<device node path>
    chmod 777 <sys fs file name>

(2) on boot

    chmod 777 <sys fs file name>

But it does not work.

--
Regards,
Pratik Prajapati


On Tue, Sep 20, 2011 at 8:58 AM, jagan <402j...@gmail.com> wrote:
You can't give the permissions directly on android source.
We need to give the permissions on init.rc.
Better to read the file from   system/core/init/readme.txt

Regards,
Jagan





Ashwin Bihari

unread,
Sep 20, 2011, 7:22:26 PM9/20/11
to android-...@googlegroups.com, android...@googlegroups.com, android-d...@googlegroups.com, android-porting
Try repeating the command multiple times in init.rc, i.e.,

chmod 777 <sys file name>
chmod 777 <sys file name>

I've found that doing it at least twice usually makes it work..

-- Ashwin

On Tue, Sep 20, 2011 at 12:06 PM, Pratik Prajapati

> --
> You received this message because you are subscribed to the Google Groups
> "android-platform" group.
> To post to this group, send email to android-...@googlegroups.com.
> To unsubscribe from this group, send email to
> android-platfo...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/android-platform?hl=en.
>

Jean-Baptiste Queru

unread,
Sep 20, 2011, 7:42:06 PM9/20/11
to android-...@googlegroups.com
Please don't cross-post, especially not to so many groups, and
especially not when your post is not even potentially on-topic in all
of the groups you cross-posted to.

Thanks,
JBQ

> --
> You received this message because you are subscribed to the Google Groups
> "android-platform" group.
> To post to this group, send email to android-...@googlegroups.com.
> To unsubscribe from this group, send email to
> android-platfo...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/android-platform?hl=en.
>

--
Jean-Baptiste M. "JBQ" Queru
Software Engineer, Android Open-Source Project, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

ekwang

unread,
Sep 28, 2011, 12:46:14 PM9/28/11
to android...@googlegroups.com, android-d...@googlegroups.com, android-...@googlegroups.com, android-porting, pratik.p...@gmail.com
How about giving permission before to do that?

chown system sysetm <sys fs file name>
chmod 777 <sys fs file name>

Lee.

Pratik Prajapati

unread,
Nov 4, 2011, 6:22:08 PM11/4/11
to android...@googlegroups.com, android-d...@googlegroups.com, android-...@googlegroups.com, android-porting
Ok. Thanks. In fact I modified the driver which was exporting this sysfs entry. Not driver creates the the entry with 777 perm only.

--
Regards,
Pratik Prajapati


On Wed, Nov 2, 2011 at 12:38 PM, Sylvain Huard <sylvai...@admetric.ca> wrote:
I had a very similar problem with a "chmod 0777 filename" not working in my init.rc. It took me hours to figure it out. Just in case you face the same thing, here is what was my problem. The directory where "filename" was had less rights than what I wanted for "filename". So, even though filename was supposed to be 0777, the effective rights were the one of "parent directory". To fix it I did:
chmod 0777 "parentdirectory"
chmod 0777 "parentdirectory/filename"






Reply all
Reply to author
Forward
0 new messages