termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
2.2k stars 318 forks source link

[Bug]: Unable to open the Termux: X11 with self signed apk #712

Closed fish4terrisa-MSDSM closed 3 months ago

fish4terrisa-MSDSM commented 3 months ago

Problem description

Currently I'm using a self signed termux and termux:x11 apk, and when I tried to run termux-x11 :0, It failed with this log:

Signature verification of target application com.termux.x11.shell_loader failed.                                                Please, reinstall both termux-x11 package and Termux:X11 application from the same source

(There are many files stored in my signed edition of termux, so It's impossible to move to the official signed termux) Can I disable the Signature verification(or make it match)? ( I owns a rooted device)

What steps will reproduce the bug?

Install a self signed edition of both termux and termux:x11. (I used the apksigner to resign the apk downloaded from the newest action), and try termux-x11 :0

What is the expected behavior?

Start X11 properly:-)

twaik commented 3 months ago

Why exactly do you need to resign termux-x11 apk? It is not required.

fish4terrisa-MSDSM commented 3 months ago

Add an imformation: I'm using Anddoid 14, and when I'm trying to sign and install the loader.apk(I know that it won't work, but its a single try XD), I got these errors:

java.lang.IllegalStateException: Install Failure 7 [INSTALL_FAILED_DEPRECATED_SDK_VERSION: App package must target at least SDK version 23, but found 21]
    at g6.m.a(SourceFile:116)
    at g6.m.d(Unknown Source:195)
    at g6.h.k(SourceFile:17)
    at a8.a.E(Unknown Source:8)
    at q8.c0.run(Unknown Source:107)
    at l.h.run(SourceFile:661)
    at w8.i.run(Unknown Source:2)
    at w8.a.run(SourceFile:94)

It seems to be a sdk incompatibility?

twaik commented 3 months ago

You do not need to sign loader. It is not signed at build time and is not installable by design. Why exactly you think you need to sign termux-x11 with your signature? It works fine with any version of termux, no matter what key it is signed with.

fish4terrisa-MSDSM commented 3 months ago

Why exactly do you need to resign termux-x11 apk? It is not required.

I didn't signed the loader in /data/data/com.termux/files/usr/libexec/termux-x11/loader.apk, I just resigned the termux:x11 apk from actions I'm using zerotermux, a termux modified by others(only in changed some style, you can view it on github), and the developer signed the apk with his sign. It didn't changed the core parts or termux, only changed the UI design and added some shortcuts, so I think it's not zerotermux's modifications made termux:x11 refuse to be started.

fish4terrisa-MSDSM commented 3 months ago

You do not need to sign loader. It is not signed at build time and is not installable by design. Why exactly you think you need to sign termux-x11 with your signature? It works fine with any version of termux, no matter what key it is signed with.

Thats just a try, I copied the /data/data/com.termux/files/usr/libexec/termux-x11/loader.apk to another place and signed it, the original apk isn't affected.

twaik commented 3 months ago

And I am asking you again. Why exactly you need to sign termux-x11 apk with your key...

fish4terrisa-MSDSM commented 3 months ago

And, it seems that the loader.apk in the package termux-x11-nightly is not signed, as the log below:

apksigner verify --verbose /data/data/com.termux/files/usr/libexec/termux-x11/loader.apk                                     DOES NOT VERIFY                                                 ERROR: Missing META-INF/MANIFEST.MF

Is it expected?

twaik commented 3 months ago

Is it expected?

You do not need to sign loader. It is not signed at build time and is not installable by design.

fish4terrisa-MSDSM commented 3 months ago

And I am asking you again. Why exactly you need to sign termux-x11 apk with your key...

My main termux is signed with my key, is a modified version(In fact, built by the developer, and he uses his key instead of the official one) The com.termux.x11 and com.termux shares the same profile, and If i didn't sign the termux:x11 apk, android will refuse to install it

twaik commented 3 months ago

Android will not refuse to install it. Termux:X11 does not use sharedUserId feature so, as I said before, it does not matter what key termux application is signed with.

fish4terrisa-MSDSM commented 3 months ago

Android will not refuse to install it. Termux:X11 does not use sharedUserId feature so, as I said before, it does not matter what key termux application is signed with.

Ah.... I see... I'll make a try

fish4terrisa-MSDSM commented 3 months ago

It really worked! Thank you for your help:-)