views:

77

answers:

2

Hi, I want do uninstall some useless apps from /system. I have super access, and the permission DELETE_PACKAGE in the manifest. But when i run Runtime.exec("pm uninstall package") I get ERROR/AndroidRuntime(10981): java.lang.SecurityException: Neither user 10094 nor current process has android.permission.DELETE_PACKAGES.

Anyone know how to solve this?

A: 

It wouldn't matter if you have root access or not. You will not be able to uninstall anything in /system without remounting it as read/write. /system is readonly.

you will have to run something like this:

mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

then do your pm uninstall package, and finally put the mount point back to readonly.

mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system 

chmod doesn't change the fact that everything in /system is readonly. that means NOTHING has permissions to modify or delete files. you have to remount it to remove it. just an FYI, you can edit your original question to add your manifest, but I don't need it, I know that is your issue.

if /system is readonly, you wont even be able to do rm /system/somefile.ext. you will get an error that /system is readonly. The same thing is probably happening when pm uninstall runs, and it just assumes its a permissions issue, which it sort of is.

Ryan Conrad
this is my manifest...<uses-permission android:name="android.permission.DELETE_PACKAGES"/> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".remove" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="7" /></manifest>
Fr4gg0r
http://pastebin.org/397207 here in human readable ;)I try the remount..
Fr4gg0r
I think remount can't solve the security exception..I tried chmod 777 /system/app/the_app which should have the same effect as remounting or?
Fr4gg0r
see my answer, i updated it to respond to your comments
Ryan Conrad
With this Code I still get the Exception:run.exec("su");run.exec("mount -o remount,rw -t refs /dev/block/st19 /system");run.exec("pm uninstall some.package");When i type "mount" in adb shell it says it's mounted as rw.I've tried a not system package and it also does not get uninstalled (same exception).So any new ideas?Sorry for late answer was in holiday.
Fr4gg0r
i am not sure, but it sounds like android.permission.DELETE_PACKAGES is a reserved permission for system applications. meaning only applications signed as a "system" application will have access to that permission. What happens if you run # pm uninstall some.package in adb?
Ryan Conrad
Is this the right output that /system is mounted rw? :/dev/block/st19 /system rfs rw,...In adb shell pm uninstall system.package restults in a failure.So then i will do this with rm the .apk, .odex and the /data/package directory.
Fr4gg0r
A: 

As I just read, /system on the galaxy s is rw at stock. I agree with you that /system must be mounted before, but as I am testing on a galaxy s this can't solve the error posted above. (mount is not even a valid command on the galaxy s).

Fr4gg0r
I can assure you, /system is not rw, on the galaxy, or any device for that matter. a user could do a rm -f -r /system and wipe the entire device out. /system being rw is not going to happen. It might be rw @ initial boot, but the init script changes that. you could do a 'mount' from the terminal and it will output the mount points and if they are ro/rw.
Ryan Conrad