Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android target: su command required #26

Open
mdigiorgio opened this issue Mar 7, 2016 · 3 comments
Open

Android target: su command required #26

mdigiorgio opened this issue Mar 7, 2016 · 3 comments

Comments

@mdigiorgio
Copy link
Contributor

When the target is an Android device the su command is needed on the target.

In my case, I pushed the su binary from the AOSP repository I have in my work environment. It would be necessary to either tell the user he needs to do something similar or provide that binary with devlib and deploy it on the target right after connecting to it (as it is done with busybox for example).

@setrofim
Copy link
Collaborator

setrofim commented Mar 7, 2016

Please could you describe the issue in more detail? Which part is failing? What device are you running on? For rooted devices and dev boards, su should already be in the file system. For unrooted devices, it should be be asked for (unless you explicitly try to use functionality that requires root).

@mdigiorgio
Copy link
Contributor Author

I'm running experiments on a N5X. The device is rooted and su was not in the filesystem at the beginning, so I got some errors during initialization when trying to execute commands with as_root=True .

Hence, I had to pull the binary in the device to make it work.

Now, since in my case executing commands as root is not necessary because I already get a root shell, I thought we could just ignore the as_root parameter (in such cases). For doing that, we could change the execute() method in the following way:

def execute(self, command, timeout=None, check_exit_code=True, as_root=False):
        if  self.connected_as_root:
            as_root = False
        return self.conn.execute(command, timeout, check_exit_code, as_root)

If you want I can send a PR with this modification. What do you think?

@douglas-raillard-arm
Copy link
Contributor

It might be a good idea to use busybox su but at the same time this means busybox needs to be suid, which in turn would pre-require root on the target to achieve. Since we haven't experienced that issue in recent years, maybe we should close that @marcbonnici ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants