Kovid Goyal doesn't want you to know this, but you can run Calibre directly on Android

published: 2024-09-04


Well, maybe not directly directly, but the code itself is running on your device, not on a remote server.

I make the statement in the title based off three observations:

  1. The official Calibre website states that "calibre itself does not run on phones/tablets".
  2. The developer doesn't want you using any versions of Calibre specifically modified to work on your device:
Please do not use your distribution provided calibre package, as those are often buggy/outdated. Instead use the Binary install described below.
  1. Attempting to perform an isolated install in Termux using the official instructions for installing on Linux immediately throws an error:
Using python executable: /data/data/com.termux/files/usr/bin/python3
Your system is not based on GNU libc. The calibre binaries require GNU libc
				

So in my pursuit of minimizing the amount of activities that require me to pull out my aging Thinkpad T510, and because I don't particularly care how software maintainers think I should have my computing environment setup, I went ahead and installed Calibre in a Debian proot inside Termux.

If you've ever gone looking in F-Droid for solutions to run Linux software on Android that hasn't been compiled for Termux yet, you may have come across AnLinux, which provides many "proot"s for popular Linux distros to run inside Termux. But installing it and opening up reveals that it's just a bunch of scripts to copy-paste. Installing AnLinux thus isn't needed, as you can find all the installer scripts on GitHub.

To install Calibre directly on Android:

  1. Download and install Termux, obviously.
  2. Inside Termux, run termux-setup-storage to give it access to the rest of the files on your device.
  3. Run the AnLinux Debian installer script to get a Debian proot working.
  4. Edit start-debian.sh and uncomment the two lines after "uncomment the following line" to give the proot access to the files on your device.
  5. Run bash start-debian.sh to start the proot.
  6. Now inside the proot, run the AnLinux XFCE4 installer script to get a graphical environment installed and working.
  7. Install a VNC client of your choice. I personally use AVNC, also available on F-Droid. Use the VNC app to connect to the VNC server now running inside the proot inside Termux. The address to connect to is usually 127.0.0.1:5901. If you get a "connection refused" error, go back to Termux and, in the proot, run vncserver-start.
  8. In the VNC app, open a terminal and run apt install calibre. Wait as it downloads and installs everything you need.
  9. Now run Calibre!

Caveats:

  1. The built-in book editor will crash if you don't run Calibre in a terminal with the command QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox" calibre. This is because, in the proot, there is only one user and so you are technically running as root, which the Chromium engine doesn't like. Even with that special flag set, the book editor frequently refuses to save as it claims the cache has suddenly gone missing. Sigil, a standalone book editor, also requires --no-sandbox set via an environment variable like shown above, but in my personal experience it seems much more stable for anything longer than fixing a typo.
  2. Unless your device is rooted and you've given Termux superuser permissions, Calibre won't be able to manage libraries stored on external storages, like microSD cards.

CC BY-NC-SA 4.0 © Vane Vander