iMX8QM Android Automotive OS Root Permission Error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX8QM Android Automotive OS Root Permission Error

451 Views
efecancebel
Contributor IV

Hello,

I compiled Android Automotive OS 10 with userdebug build option for NXP iMX8QM.

I need to give root privileges by running the "su" command from within the APK that I developed with Android Studio.

public static void sudo(String... strings) {
        try {
            Process su = Runtime.getRuntime().exec("su");
            DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());

            for (String s : strings) {
                outputStream.writeBytes(s + "\n");
                outputStream.flush();
            }

            outputStream.writeBytes("exit\n");
            outputStream.flush();
            try {
                su.waitFor();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            outputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

 

I am using the code block below to do this. But I get the error "W/System.err: java.io.IOException: Cannot run program "su": error=13, Permission denied".

What should I do in this situation, could you please help me this issue?

Best regards,

Efecan

 

 

 

0 Kudos
2 Replies

429 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

Looks like the problem is in the host setup for su, the password of the BSP is "root".

Regards

0 Kudos

426 Views
efecancebel
Contributor IV

Hi @Bio_TICFSL,

When I run the "su" command from the console of Android Automotive OS, I become root.

I want to do this with the APK I developed, but I can't.

As I said above, when I send the "su" command from within the APK, I get a "permission denied" error in the Android Studio console.

Best regards,

Efecan

0 Kudos