Can't run shell commands on new Marshmellow install

3,766 views
Skip to first unread message

T Magritte

unread,
Oct 9, 2015, 11:18:58 AM10/9/15
to Tasker
I just did a complete wipe and installed the factory image of Android 6.0 Marshmallow on my Nexus 5. I used Chainfire's modified boot image and SuperSU 2.50 beta to root it, then installed tasker and restored my configuration through titanium backup.

Most of the tasks I've tried, after granting it whatever permissions it asked for, seem to work. However, whenever I run a task where it tried to run a shell command it fails.

As an example, I have a task that will kill the Google Store app. When I run this from the task list I get a red circle showing up next to the task after I try to run it. Here is the copied results from the run:
06.46.49/E Run Shell:  ->
06.46.49/E Run Shell: %Shellerror -> %Shellerror
06.46.49/E Run Shell:  ->
06.46.49/WakeLockManager setClearAlarm: not setting, last set 14 ago
06.46.49/Shell runBackground am force-stop com.android.vending root: true timeout: -1
06.46.49/Shell start process-thread ID 136
06.46.49/E add wait type Shell2 time 2147483647
06.46.49/E add wait type Shell2 done



I modified the task so it would save the exit code to a variable, %Shellerror. Here's the variable's cotents:
Error type 2
android.util.AndroidException: Can't connect to activity manager; is the system running?
at com.android.commands.am.Am.onRun(Am.java:353)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:100)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)


I do get a SuperSU notification saying tasker was granted root access to an interactive shell, so that doesn't seem to be the problem.

Prior to this latest OS update, including on M preview 3, tasker was working fine for shell commands.

Don't know if it's related, but titanium backup also fails to restore apps. Regardless of app processing method, it just hangs indefinitely when trying to restore an app. If I install the app from the play store I can restore the data with titanium backup without any problem. 

Does anyone know what's wrong? Is this a Marshmallow issue or maybe something wrong with my permissions somewhere?

Thanks!

Patrick Chung

unread,
Oct 10, 2015, 4:15:11 PM10/10/15
to Tasker
Same problem. Trying to run Shell command input keyevent 26 for power button and no luck. Heard it works in lollipop

Pent

unread,
Oct 14, 2015, 5:10:47 AM10/14/15
to Tasker
If I do

Run Shell, echo hello, %out
Flash, %out

I get hello flashed, so Run Shell is basically working.

I can't comment about changes in the input program.

Pent

Chris

unread,
Oct 15, 2015, 12:38:42 PM10/15/15
to Tasker
Same problem. Just updated to ota nexus 5 marshmallow. I'm not able to "am force-stop package.name" anymore. I used to call this shell command from tasker which used to work on lollipop 5.1.

if I call "am force-stop ..." in terminal it says
Error type 2
android.util.AndroidExeption: Can't connect to activity manager; is the system running?

Chris

unread,
Oct 15, 2015, 2:24:52 PM10/15/15
to Tasker
GOT IT!

also recently did not work after upgrading to marshmallow which lead me to the point: permissive mode

use SELinuxModeChanger to change from standard enforcing to permissive
after setting and rebooting that, shellcommands work again

John Doe

unread,
Oct 15, 2015, 2:32:02 PM10/15/15
to Tasker
Using permissive mode means disabling selinux, do you really want to remove a security feature to use a shell command?

Hippo Man

unread,
Oct 17, 2015, 4:24:46 PM10/17/15
to Tasker
On Thursday, October 15, 2015 at 2:32:02 PM UTC-4, John Doe wrote:
Using permissive mode means disabling selinux, do you really want to remove a security feature to use a shell command?

Absolutely! Standard security features are good for lots of people, but some of us want to manage security in our own ways and to run the software we desire.

It's good that Permissive Mode can be enabled by those of us who wish to utilize it.
.

Message has been deleted
Message has been deleted

Green Raccoon

unread,
Oct 17, 2015, 9:05:58 PM10/17/15
to Tasker
On my device, the problem extends outside of Tasker too. Running shell through adb:
    shell@shamu:/ $ su
    root@shamu:/ # settings list global
    Error while accessing settings provider
    java.lang.NullPointerException: Attempt to invoke interface method 'android.app.IActivityManager$ContentProviderHolder android.app.IActivityManager.getContentProviderExternal(java.lang.String, int, android.os.IBinder)' on a null object reference
        at com.android.commands.settings.SettingsCmd.run(SettingsCmd.java:141)
        at com.android.commands.settings.SettingsCmd.main(SettingsCmd.java:63)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)

Maybe SuperSu itself still has some bugs to work out. I'm using 2.51 btw.
Message has been deleted

rayson

unread,
Oct 18, 2015, 5:08:37 AM10/18/15
to Tasker
I don't have Marshmallow yet so I can't test it myself but someone posted on the XDA Secure Settings forum that he managed to enable/disable data via shell command to work on Marshmallow by providing a context when calling su:

http://forum.xda-developers.com/showpost.php?p=63327796&postcount=2499

Can someone verify if this works?

John Doe

unread,
Oct 18, 2015, 7:17:54 AM10/18/15
to Tasker
What is your way to manage security? To remove security checks? Just to be clear: you can do anything you want on your phone, but I don't think it's a good choice to disable security feature IMHO.

T Magritte

unread,
Oct 18, 2015, 3:10:53 PM10/18/15
to Tasker

Thanks! This worked for me. Basically, I just added:
 su -cn u:r:system_app:s0

As the first line followed by a return before the shell command and it ran without error, completing the task as expected. I found in this case it doesn't seem to matter if the use root checkbox is checked or not.

Kay Ho

unread,
Oct 24, 2015, 10:47:40 PM10/24/15
to Tasker
i encountered the same problem. should this line of command be added to tasker before the run shell command? what exact steps do i need to do? sorry a newbie here. Thanks!

Nxt3

unread,
Oct 28, 2015, 11:29:23 AM10/28/15
to Tasker
For the command in the action, do this:

su -cn u:r:system_app:s0
{your command here}
put your command inside where the brackets are (but don't actually use the brackets in practice.

Parker Reed

unread,
Jul 11, 2016, 10:17:46 AM7/11/16
to Tasker
http://imgur.com/a/6wakB

Tried with root checked and unchecked but it errors out every time. any idea why this might be? Nexus 5X 6.0.1

SportyRydr

unread,
Jul 12, 2016, 4:53:36 PM7/12/16
to Tasker
I'm using Tasker to run a shell command at boot that disables enforcing mode...how is that able to work?! ;) My ROM (OctOs Oct-M) doesn't include a way to set mode to permissive, as my previous ROM did (as well as enforce it).

setenforce 0

Thanks for reminding me about SELinuxModeChanger, though!
Message has been deleted

Kenneth Boyles

unread,
Jul 13, 2016, 9:07:08 PM7/13/16
to Tasker
Thank you for this, been pounding my brain for a week trying to get my shell commands to work. On the rom I'm currently running, the torch and camera flash is extremely dim, so I was trying to run a command to turn on torch a max brightness. Command would run in adb shell, but not tasker.

Ronnie Shepard

unread,
Feb 14, 2017, 8:32:07 PM2/14/17
to Tasker
I run exodus 6.0 and it works just fine
Maybe try flashing a better rom

Logan Fury

unread,
Mar 8, 2017, 1:05:46 AM3/8/17
to Tasker
Ive just done my first root on a Marshmallow OS.

SuperSU by chainfire is installed, 2 different root checkers confirm proper root access, yet Secure Settings cannot enable System+ because it says root isnt detected. 

Tasker shell commands and root only functions didnt work all night long and I kept opening SuperSU trying to find an option to pic apps to grant SU access to. I didnt see anything.

Finally after test firing root adds on and off all day, Tasker finally appeared in SuperSU list with a red clock image. I was able to click the clock, and select permissions and now shell commands are working fine.

I keep trying to make Secure Setting do something to make SuperSU aware of it and either assign it a permission or prompt me to do so (notifications for SU are enabled)

Im sure im missing something, im going to reread all the info about SuperSU in the playstore. Maybe uninstalling and reinstalling Secure Settings would give me a SU prompt?
Message has been deleted

i8890321

unread,
Mar 31, 2017, 1:14:00 AM3/31/17
to Tasker
Tried following the command


su -cn u:r:system_app:s0
input swipe 500 500 500 20

Doesn't help at all.

Still nothing happened


Mashmellow… rooted supersu

Logan Fury

unread,
Mar 31, 2017, 1:20:12 AM3/31/17
to tas...@googlegroups.com
Ive resolved this on my end. 

Evidently the rooting process for my phone was downgrading to a 5.11 with modified bootloader, then kingrooting, then updating to 6.0.1 which deleted kingroot, and installing superSU.

This left me with half the SU of my other phones as they show superSU and kingroot installed. 

So I ran kingroot, gained a second root, and immediately got a SU allow prompt for Secure Settings and Tasker, was able to enable System+ module on Secure Setting, get control of Fingerprint enable/disable established, and resume running Shell commands and root functions on Tasker on the Marshmallow platform.


--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/_XBxvx5nww8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

i8890321

unread,
Apr 3, 2017, 8:17:29 AM4/3/17
to Tasker
I solved it

I suspect I solve it with the following 2 steps

1 wipe cache and davik cache
2 flash another stable version of su(from the official site)

Good luck

Ma N

unread,
Apr 25, 2017, 12:06:51 PM4/25/17
to Tasker
We can probably say that there's already not big reason to run SELinux with modified and rooted system... If someone will want to get into your phone, he will do it anyway (maybe even with stock system, but that's another story...).
Reply all
Reply to author
Forward
0 new messages