VeraCrypt is a tool for creating and accessing VeraCrypt-encrypted volumes and containers on Windows, Linux, and other Unix-like systems. This project provides VeraCrypt cross-compiled for Android ARM64 and packaged for Termux.
The package provides the VeraCrypt command-line utilities and uses the existing Termux FUSE 3 userspace tools provided by the libfuse3 package.
It was created because VeraCrypt is not currently available as a package in the official Termux repositories. Although Termux provides cryptsetup with VeraCrypt (TrueCrypt) support, cryptsetup relies on the Linux AF_ALG kernel crypto API, which is generally disabled or heavily restricted on Android kernels (even though dm-crypt itself is present). This custom-compiled VeraCrypt bypasses that limitation by handling the cryptography entirely in userspace, allowing you to access VeraCrypt volumes on rooted Android devices.
This project provides a convenient way to install and update VeraCrypt through a dedicated APT repository for Termux.
Note
This is an unofficial build of VeraCrypt for Termux/Android. VeraCrypt is a trademark of IDRIX. This project is not affiliated with or endorsed by IDRIX.
- Android device with an ARM64 (
aarch64) CPU - Termux
- Root access
- A VeraCrypt-encrypted volume
- The appropriate VeraCrypt password, PIM, and/or keyfiles
Install Termux from F-Droid or another official Termux distribution source.
Important
Do not mix Termux packages or add-ons from different distribution sources. Termux and its add-ons should come from the same source.
Open Termux and update the package repositories:
pkg update
pkg upgradeThe repository is signed using an OpenPGP key published through the Ubuntu keyserver.
Install gnupg (if not installed):
pkg install gnupgRetrieve the public key using its full fingerprint:
gpg --keyserver keyserver.ubuntu.com \
--recv-keys 77E6A5281DF5538DB12A98F2B31498758A8AF8A5Verify that the imported key has the expected fingerprint:
gpg --fingerprint 77E6A5281DF5538DB12A98F2B31498758A8AF8A5The fingerprint should be:
77E6 A528 1DF5 538D B12A 98F2 B314 9875 8A8A F8A5
Important
Verify the fingerprint before trusting the key. It should match the fingerprint published by the repository maintainer.
Export the verified key as an APT keyring:
mkdir -p "$PREFIX/etc/apt/keyrings"
gpg --export 77E6A5281DF5538DB12A98F2B31498758A8AF8A5 \
> "$PREFIX/etc/apt/keyrings/veracrypt-android.gpg"Add the repository to your Termux APT sources:
echo "deb [signed-by=$PREFIX/etc/apt/keyrings/veracrypt-android.gpg] https://Infiniti151.github.io/veracrypt-android stable main" \
> "$PREFIX/etc/apt/sources.list.d/veracrypt-android.list"Update the package lists:
pkg updateInstall with:
pkg install veracryptVerify the installation:
veracrypt --versionYou should see the installed VeraCrypt version.
On Android, mount namespaces determine which processes can see filesystems and FUSE mounts.
Choose the workflow based on where you intend to access the decrypted volume:
-
Termux-only: Use
tsuto enter a root shell configured for the Termux environment. Run the entire VeraCrypt workflow from that shell. The resulting mounts remain isolated from Android applications and file managers. -
Global / Android access: Use
gsuto enter a root shell in the global mount namespace, then run the entire VeraCrypt workflow from that shell. This allows resulting mounts to be accessed by Android processes that share that namespace, including compatible root-capable file managers.
tsu and gsu serve different purposes:
tsuβ enters a Termux-configured root shell.gsuβ enters a Termux-configured root shell in the global mount namespace.
Install tsu with:
pkg install tsugsu is a small helper function provided by this documentation:
gsu() {
/system/bin/su -M -c \
'export PATH=/data/data/com.termux/files/usr/bin:$PATH
export LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib:$LD_LIBRARY_PATH
exec /data/data/com.termux/files/usr/bin/bash'
}Add this function to your shell configuration (for example, ~/.bashrc or ~/.config/fish/config.fish, depending on your shell) to make it available in future sessions.
Important
gsu is a convenience function provided by this documentation; it is not a standard Android or Termux command.
Note
The -M (--mount-master) option is provided by KernelSU and some other Android root solutions. It runs the shell in the global mount namespace, allowing mounts created from that shell to be visible to other processes that share that namespace.
Warning
Choose either tsu or gsu for the entire VeraCrypt workflow. Do not switch between them, as they use different mount namespaces. Use gsu when the decrypted volume needs to be accessible outside Termux, including from compatible Android file managers.
First identify the block device containing the BitLocker volume with lsblk (requires blk-utils package).
For example:
gsu
lsblkDepending on your Android device, storage may appear under paths such as:
/dev/block/sd[a-z][1-9]...
Do not assume a device path. Verify the correct block device before proceeding.
Important
Do not mount directly via VeraCrypt. You should always map the volume without mounting it by using the --filesystem=none flag, and then mount the resulting decrypted block device manually. Letting VeraCrypt handle the filesystem mount natively will likely fail on Android for two reasons:
- NTFS: VeraCrypt only looks for in-kernel NTFS drivers. It is unaware of the
ntfs-3gpackage available in Termux, causing the mount operation to fail outright. - POSIX Filesystems (EXT4, F2FS): VeraCrypt does not mount Linux filesystems with Android's specific media permissions (UID/GID 1023). If VeraCrypt handles the mount, files created on a PC will be inaccessible or unreadable due to strict permission mismatching in the Android environment.
Use standard input to pass the password for automated unlocking without interactive prompts.
Basic Unlocking (Password only):
printf 'your_password' | veracrypt --text --non-interactive --stdin --filesystem=none /dev/block/sdXAdvanced Unlocking (Password, PIM, and Keyfile):
printf 'your_password' | veracrypt --text --non-interactive --stdin --filesystem=none --pim=123 --keyfiles=/path/to/key.file /dev/block/sdX--text: Forces command-line mode (required).--non-interactive: Prevents VeraCrypt from pausing to prompt for missing information.--stdin: Reads the volume password from standard input (safely piped viaprintfto avoid shell history logging).--filesystem=none: Unlocks and maps the volume viadmsetupbut skips mounting the internal filesystem.--pim=<value> / --keyfiles=<path>: Specifies PIM and keyfiles.
Once unlocked, the decrypted block device will be available at /dev/mapper/veracrypt1 (or whichever slot was assigned). You must mount it manually using Android's media_rw user/group ID (1023).
For POSIX Filesystems (EXT4 / F2FS / EXT3):
To ensure correct permissions for PC-transferred files, you must mount the raw partition to a staging directory first, and then overlay it with bindfs to virtualize the ownership to Android's media user:
# 1. Mount raw partition to a staging directory
mkdir -p /mnt/raw_otg/veracrypt1 /mnt/media_rw/veracrypt1
mount -t ext4 /dev/mapper/veracrypt1 /mnt/raw_otg/veracrypt1
# 2. Virtualize permissions with bindfs to your final mount point
bindfs -u 1023 -g 1023 --perms=a+rwX \
--create-for-user=1023 --create-for-group=1023 \
/mnt/raw_otg/veracrypt1 /mnt/media_rw/veracrypt1For NTFS Filesystems:
Use either the newer kernel ntfs3 driver or Termux's ntfs-3g userspace driver:
# Using ntfs3 (if supported by kernel)
mount -t ntfs3 -o uid=1023,gid=1023,fmask=000,dmask=000 /dev/mapper/veracrypt1 /mnt/media_rw/veracrypt1
# OR using Termux ntfs-3g
ntfs-3g /dev/mapper/veracrypt1 /mnt/media_rw/veracrypt1 -o uid=1023,gid=1023,fmask=000,dmask=000For FAT32 / exFAT:
mount -t exfat -o uid=1023,gid=1023,fmask=000,dmask=000 /dev/mapper/veracrypt1 /mnt/media_rw/veracrypt1If the filesystem was mounted with gsu, the mount is placed in the global mount namespace and can be accessed by Android processes that share that namespace.
This allows the mounted folder to be accessed using compatible root-capable file managers such as Solid Explorer and File Manager+.
If you mounted the filesystem using tsu, it is intended for Termux-only access.
Note
Unmount the filesystem from the same mount namespace in which it was mounted. Use gsu for filesystems mounted with gsu, and tsu for filesystems mounted with tsu.
To safely close the volume, you must reverse the mounting process in the exact opposite order. You must unmount the filesystems first before instructing VeraCrypt to lock the mapped volume.
Unmount the final mount point:
Release the primary mount point where the files are accessible:
umount /mnt/media_rw/veracrypt1Unmount the raw staging directory (POSIX / bindfs only):
If you used bindfs for a POSIX filesystem (EXT4/F2FS), you must also unmount the underlying raw partition:
umount /mnt/raw_otg/veracrypt1Lock and unmap the volume:
Instruct VeraCrypt to lock the encrypted volume and remove the /dev/mapper/veracrypt1 device map:
veracrypt --text --dismountClean up directories (Optional):
Remove the empty mount points to keep your system directories clean:
rmdir /mnt/media_rw/veracrypt1
rmdir /mnt/raw_otg/veracrypt1VeraCrypt requires root access to read Android block devices. Use tsu for a Termux-only workflow or gsu when the decrypted volume needs to be accessible outside Termux.
Android's normal storage permissions are separate from Linux root permissions.
For access to shared storage, Termux may need storage permission:
termux-setup-storageThis creates:
$HOME/storage/
with links to accessible Android shared-storage locations.
For block devices, however, root permissions are normally required.
Update all Termux packages:
pkg update
pkg upgradeor:
Upgrade veracrypt:
pkg upgrade veracryptUninstall veracrypt:
pkg uninstall veracryptRemove the repository:
rm "$PREFIX/etc/apt/sources.list.d/veracrypt-android.list"Remove the repository signing key:
rm "$PREFIX/etc/apt/keyrings/veracrypt-android.gpg"Update:
pkg updateThis repository builds VeraCrypt for Android ARM64 using the Android NDK.
The build script:
- Downloads and sets up the Android NDK.
- Builds wxWidgets for Android ARM64 using the Android NDK.
- Builds VeraCrypt for Android ARM64 using the Android NDK, linking against the locally built wxWidgets and Termux's
libfuse3andlibpcsclite. - Packages the resulting binaries and libraries into a Termux-compatible
.deb. - Generates an APT repository.
- Generates
PackagesandPackages.gz. - Generates and signs the
Releasemetadata. - Generates a signed
InRelease.
GitHub Actions runs the build script and publishes the generated APT repository using GitHub Pages.
The resulting repository is structured as:
apt-repo/
βββ dists/
β βββ stable/
β βββ InRelease
β βββ Release
β βββ Release.gpg
β βββ main/
β βββ binary-aarch64/
β βββ Packages
β βββ Packages.gz
βββ pool/
βββ main/
βββ v/
βββ veracrypt/
βββ veracrypt_*.deb
Local builds use the same containerized build environment as CI, but disable APT repository generation and signing.
Requirements:
- Podman β runs the containerized build environment.
- Task β provides the commands defined in
Taskfile.yml.
For the first build, rebuild the container image and VeraCrypt:
task rebuildAvailable tasks:
| Task | Description |
|---|---|
task build |
Build VeraCrypt using the existing builder image |
task image |
Build the local builder image |
task rebuild |
Rebuild the builder image and VeraCrypt |
task clean |
Remove local build output, sources, and cache |
Run task --list to see all available tasks.
This project packages VeraCrypt for Android ARM64.
Original VeraCrypt project:
https://github.com/veracrypt/VeraCrypt
See the original VeraCrypt project for its licensing information.
The Android build and packaging files in this repository are provided separately from the upstream VeraCrypt source.
This build applies small Termux-specific patches to the upstream VeraCrypt source:
- Adds
<unistd.h>toSCardLoader.cppforaccess()andF_OK. - Overrides PCSCLite library path in
SCardLoader.cppfor Termux. - Hardcodes the Termux
dmsetuppath inCoreLinux.cpp.
These changes are minimal and only intended to make VeraCrypt functional on Android/Termux. All other source code remains unchanged.