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

pm/cmd is broken in Android 10 #354

Closed
joshcangit opened this issue Jun 29, 2020 · 13 comments
Closed

pm/cmd is broken in Android 10 #354

joshcangit opened this issue Jun 29, 2020 · 13 comments
Labels

Comments

@joshcangit
Copy link

Problem description

The pm command doesn't work.

Steps to reproduce

$ pm
cmd: Failure calling service package: Failed transaction (2147483646)

Additional information

  • Packages CPU architecture:
    aarch64
  • Android version:
    10
  • Kernel build information:
    Linux localhost 4.14.113-18242812 #​1 SMP PREEMPT Fri Mar 20 18:30:04 KST 2020 aarch64 Android
  • Device manufacturer:
    samsung
  • Device model:
    SM-G973F
@5c0tt1
Copy link

5c0tt1 commented Jun 30, 2020

@joshcangit
The pm command has been deprecated in newer versions of Android in favour of cmd.
Example: pm install is now cmd package install.
Please close this issue.

@joshcangit
Copy link
Author

joshcangit commented Jul 1, 2020

@joshcangit
The pm command has been deprecated in newer versions of Android in favour of cmd.
Example: pm install is now cmd package install.
Please close this issue.

I'm not sure if this is fixed because I can still invoke pm, and only output the error. Also the cmd command you talked about is not there yet.

$ cmd
No command cmd found, did you mean:
 Command cmp in package diffutils
 Command mmd in package mtools
 Command icmd in package renameutils

Grimler91 added a commit to termux/termux-packages that referenced this issue Jul 1, 2020
@Grimler91
Copy link
Member

Grimler91 commented Jul 1, 2020

@joshcangit run /system/bin/cmd instead of just cmd until we've added a wrapper, or just use pm package install, seems pm is already a symlink to cmd on your device

@joshcangit
Copy link
Author

@joshcangit run /system/bin/cmd instead of just cmd until we've added a wrapper, or just use pm package install, seems pm is already a symlink to cmd on your device

Still getting the same error after testing it.

$ /system/bin/cmd package path com.android.chrome
cmd: Failure calling service package: Failed transaction (2147483646)

@joshcangit joshcangit changed the title pm command is broken in Android 10 pm/cmd command is broken in Android 10 Jul 1, 2020
@joshcangit joshcangit changed the title pm/cmd command is broken in Android 10 pm/cmd is broken in Android 10 Jul 1, 2020
@ghost
Copy link

ghost commented Jul 1, 2020

@joshcangit
Copy link
Author

joshcangit commented Jul 1, 2020

As I wrote, you should create a request for similar functionality not filing a bug report for /system/bin/pm or /system/bin/cmd.

These utilities are not managed by Termux, instead they are part of Android OS and we simply can't fix them. These utilities are intended to be used only with ADB for debugging purposes and their usage may get disabled for non-privileged shells.

What we can do is only to create an API for getting info about installed applications, nothing more.

Upgrade: termux-tools:aarch64 (0.82, 0.83-1)

After a full-upgrade, I just tried both pm and cmd package. Also still seeing the same error message again.

$ pm path com.android.chrome
cmd: Failure calling service package: Failed transaction (2147483646)
$ cmd package path com.android.chrome
cmd: Failure calling service package: Failed transaction (2147483646)

@ghost
Copy link

ghost commented Jul 2, 2020

Also still seeing the same error message again.

You seeing it because it was not fixed. Everything what was done is just a new script was added to termux-tools.

~ $ cat $PREFIX/bin/cmd
#!/data/data/com.termux/files/usr/bin/sh
unset LD_LIBRARY_PATH LD_PRELOAD
PATH=$PATH:/system/bin exec /system/bin/cmd "$@"

@ghost
Copy link

ghost commented Jul 25, 2020

Upcoming Android 11 introduced a package visibility which restricts the access to the list of installed applications.

That means no workarounds will be possible for non-root users if Android OS version >=11. For Android <=9.0 this is not needed and pm list should work. Implementing API for Android 10 only is kinda pointless.

@ghost ghost closed this as completed Jul 25, 2020
@ghost ghost added the wontfix label Jul 25, 2020
@amsitlab
Copy link

amsitlab commented Sep 8, 2020

Screenshot_20200908-161337
@xeffyr still error

@twaik
Copy link
Member

twaik commented May 9, 2022

What if we just add QUERY_ALL_PACKAGES to AndroidManifest.xml of termux-app? Anyway Termux is not being updated in Google Play.

@agnostic-apollo
Copy link
Member

What if we just add QUERY_ALL_PACKAGES to AndroidManifest.xml of termux-app?

That is planned to be added but issue is not related to it. The error is from some binder selinux denial since like Android 8 or something. I haven't been able to figure out which exactly since its not logged, may need to compile android to figure it out since android source is not being helpful to me.

agnostic-apollo pushed a commit to termux/termux-tools that referenced this issue Aug 1, 2022
agnostic-apollo pushed a commit to termux/termux-tools that referenced this issue Aug 1, 2022
@Rudxain
Copy link

Rudxain commented May 8, 2023

Is it possible to define a wrapper function ("decorator") that runs pm in a subshell?

I've tried this

function pm() {
    printf '%s' "$(pm "$@" 2>&1 < /dev/null)"
}

But it doesn't work

@sylirre
Copy link
Member

sylirre commented May 8, 2023

Is it possible to define a wrapper function ("decorator") that runs pm in a subshell?

If stuck in loop, then:

function pm() {
    printf '%s' "$(command pm "$@" 2>&1 < /dev/null)"
}

Rudxain added a commit to Rudxain/dotfiles that referenced this issue May 8, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants