Skip to content

[Bug]: GPG Error during Termux Update in WSA Environment (Subprocess apt-key exited unexpectedly) #4503

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

Open
Gintoki93 opened this issue Apr 16, 2025 · 1 comment

Comments

@Gintoki93
Copy link

Problem description

I am using Termux inside the Windows Subsystem for Android (WSA) on Windows 11. When I run the command:

pkg update && pkg upgrade -y
I get the following error:

Sub-process apt-key exited unexpectedly
W: GPG error: https://[mirror-url] stable InRelease: Sub-process apt-key exited unexpectedly
E: The repository 'https://[mirror-url] stable InRelease' is not signed.
Despite following these steps:

Running termux-change-repo and selecting trusted mirrors (such as: packages.termux.dev or Grimler's repo).

Editing the $PREFIX/etc/apt/sources.list file to contain:

deb https://packages.termux.dev/apt/termux-main stable main
Installing additional packages like gnupg, curl, and termux-keyring.

Using the --allow-insecure-repositories flag in the update command.

The error persists.

Steps to Reproduce the Issue:

Run Termux in the WSA environment.

Delete the previous sources files:

rm -rf $PREFIX/etc/apt/sources.list*
rm -rf $PREFIX/etc/apt/sources.list.d
Create a new sources.list file with the content:

deb https://packages.termux.dev/apt/termux-main stable main
Run the update:

pkg update --allow-insecure-repositories && pkg upgrade -y --allow-insecure-repositories
The error mentioned above appears.

Additional Information:

System: Windows 11 with Windows Subsystem for Android (WSA).

Termux Version: [Specify your current version]

Environment: WSA (it seems there's an issue with apt-key handling in this environment)

Tried Mirrors: I have tried using several mirrors including packages.termux.dev and grimler.se, but the error persists.

Question: Is there any known solution to bypass the GPG issue in the WSA environment? Or are there specific Termux settings that work in Android environments that need to be adjusted for WSA?

Thank you for your attention, and I hope to receive help in resolving this issue.

Steps to reproduce the behavior.

Steps to Reproduce the Behavior
Launch Termux within the Windows Subsystem for Android (WSA) on Windows 11.

Remove the current sources files by running:

rm -rf $PREFIX/etc/apt/sources.list*
rm -rf $PREFIX/etc/apt/sources.list.d
Create a new sources.list file containing:

cat > $PREFIX/etc/apt/sources.list <<EOF
deb https://packages.termux.dev/apt/termux-main stable main
EOF
Execute the update and upgrade command:

pkg update --allow-insecure-repositories && pkg upgrade -y --allow-insecure-repositories
Observe that you receive the GPG error with the message "Sub-process apt-key exited unexpectedly" and the repository is flagged as not signed.

What is the expected behavior?

The package lists should update without any errors.

No GPG error should be raised, and the repository should be accepted as a valid, signed source.

The system should proceed to upgrade packages normally and install packages/execute commands without issues.

However, even for basic package installation and command execution, nothing works correctly. It appears that Termux is not fully compatible with WSA.

System information

Operating System: Windows 11 with Windows Subsystem for Android (WSA)
Termux Version and Environment Variables:
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=11489
TERMUX_APP__BUILD_DATA_DIR=/data/data/com.termux
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c79,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.2
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS=/data/data/com.termux/files
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c79,c256,c512,c768
TERMUX__USER_ID=0
CPU Architecture: aarch64
Subscribed Repositories:
In /data/data/com.termux/files/usr/etc/apt/sources.list:
deb https://packages-cf.termux.dev/apt/termux-main stable main
Updatable Packages: All packages up to date
Termux Tools Version: 1.45.0
Android Version: 13
Kernel Build Information:
Linux localhost 5.15.104-windows-subsystem-for-android-20230927+ #1 SMP PREEMPT Fri Nov 1 07:07:43 UTC 2024 armv8 Android
Device Manufacturer: Google
Device Model: Pixel 5
Supported ABIs:
SUPPORTED_ABIS: x86_64,arm64-v8a,x86,armeabi-v7a,armeabi
SUPPORTED_32_BIT_ABIS: x86,armeabi-v7a,armeabi
SUPPORTED_64_BIT_ABIS: x86_64,arm64-v8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=
WSA Version: 2407.40000.4.0

@Gintoki93
Copy link
Author

Gintoki93 commented Apr 16, 2025

Temporary Workaround Applied (After Testing All Solutions):

The issue was partially resolved by:

  1. Using Grimler's repository while bypassing GPG signature checks:

    echo 'deb [trusted=yes] https://grimler.se/termux-packages-24 stable main' > $PREFIX/etc/apt/sources.list
    pkg update --allow-unauthenticated && pkg upgrade --allow-unauthenticated -y

Ignoring GPG warnings since they do not affect package functionality.

Root Cause:
The error stems from WSA's incompatibility with Termux's GPG verification tools (specifically apt-key). This is a known limitation of Termux on WSA and not a misconfiguration on the user’s end.

Security Note:
⚠️ Bypassing GPG checks (--allow-unauthenticated) exposes your system to risks if used with untrusted repositories. Only apply this workaround with official mirrors like Grimler.

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

No branches or pull requests

1 participant