Files
hassio-addons/calibre_web
Alexandre 8142df0596 fix(calibre-web): make kepubify executable so Kobo sync can be enabled (#3041)
* fix(calibre-web): make kepubify executable so Kobo sync can be enabled

The LinuxServer base image installs kepubify with `curl -o /usr/bin/kepubify`
and never marks it executable, so the file ships as mode 0644. Calibre-web's
resolve_binary_path() only accepts a binary that passes os.access(X_OK), so
enabling Kobo sync failed with "Kepubify binary not found" even when the path
was set to /usr/bin by hand. Verified against the published layer of
lscr.io/linuxserver/calibre-web:arm64v8-latest, whose tar header for
usr/bin/kepubify reads `-rw-r--r-- 0/0 3670016`.

Set mode 0755 on it at build time, unguarded: if a future base image stops
shipping the binary, the build should fail rather than ship a broken add-on.

Calibre-web separately only autodetects kepubify under /opt/kepubify, never
/usr/bin, so the setting was stored empty on the first start and never
retried. Fill it in with /usr/bin from the cont-init script that already
applies conditional settings to app.db, and only while it is still empty, so
a path the user set by hand is never overwritten.

Fixes https://github.com/alexbelgium/hassio-addons/issues/3040

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(calibre-web): publish kepubify under a name calibre-web accepts

The first attempt was incomplete. It read binary_helper.py at calibre-web
master, which accepts a bare "kepubify"; the shipped 0.6.27 tag does not:

    SUPPORTED_KEPUBIFY_BINARIES = ("kepubify-linux-64bit", "kepubify-linux-32bit")

So there are two independent defects, and the chmod only fixed one. The base
image installs the converter with `curl -o /usr/bin/kepubify`, which leaves it
mode 0644 *and* names it something calibre-web will not look for.

A symlink alone does not fix it either: os.access() follows the symlink and
tests the target, and the target has no execute bit for anyone, root included.
Verified against the exact 0.6.27 resolution logic, on a scratch tree:

    symlink only          -> ''             (still broken)
    chmod only            -> ''             (still broken)
    chmod 0755 + symlink  -> '/opt/kepubify'

Put the symlink in /opt/kepubify, which is where calibre-web's own
autodetect_kepubify_binary() already looks, rather than in /usr/bin where only
our own database write would find it. init_config() re-runs that detection on
every start while the column is NULL, so calibre-web now configures the path
itself and a fresh install needs no second restart.

That in turn shrinks the cont-init statement: instead of hardcoding a path it
resets an empty value to NULL, which un-sticks calibre-web's own detection for
installs that already persisted "". A path set by hand is not empty and is
left alone.

Mode measured on the published add-on image, all 28 layers scanned:
ghcr.io/alexbelgium/calibre_web-aarch64:0.6.27.3 carries usr/bin/kepubify at
mode 0o644 in the base layer and nowhere else.

Reported by @andMaximus in https://github.com/alexbelgium/hassio-addons/issues/3040

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(calibre-web): keep /usr/bin resolving for the manual workaround

CodeRabbit spotted that an install already storing "/usr/bin" stays broken:
that value is not empty, so the cont-init statement leaves it alone, and with
the symlink only in /opt/kepubify it no longer resolves under 0.6.27.

The case is real and narrow. A failed save never persists the value --
_configuration_result() calls config.load() on the error path, discarding it --
so the only way to hold "/usr/bin" is a save that succeeded, which requires
having first applied the workaround published in the issue thread:

    ln -sf /usr/bin/kepubify /usr/bin/kepubify-linux-64bit

Anyone who did that, and anyone copying that comment, would have been broken
again by this PR.

Fixed with one more symlink rather than CodeRabbit's suggested migration of
"/usr/bin" back to NULL, because that would overwrite a path the user set by
hand. Making their setting keep working is better than resetting it. Verified
against the 0.6.27 resolution logic:

    symlink in /opt only   stored '/usr/bin' -> ''
    plus /usr/bin symlink  stored '/usr/bin' -> '/usr/bin/kepubify-linux-64bit'
                           autodetect        -> '/opt/kepubify'

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 13:26:53 +02:00
..
2025-08-31 23:06:36 +00:00
2025-08-31 23:06:36 +00:00

Home assistant add-on: Calibre-web

I maintain this and other Home Assistant add-ons in my free time: keeping up with upstream changes, HA changes, and testing on real hardware takes a lot of time (and some money). I use around 5-10 of my >110 addons so regularly I install test machines (and purchase some test services such as vpn) that I don't use myself to troubleshoot and improve the addons

If this add-on saves you time or makes your setup easier, I would be very grateful for your support!

Buy me a coffee Donate via PayPal

Addon informations

Version Ingress Arch

Codacy Badge GitHub Super-Linter Builder

Thanks to everyone having starred my repo! To star it click on the image below, then it will be on top right. Thanks!

Stargazers repo roster for @alexbelgium/hassio-addons

downloads evolution

About


Calibre-web is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database. It is also possible to integrate google drive and edit metadata and your calibre library through the app itself.

This addon is based on the docker image https://github.com/linuxserver/docker-calibre-web

Installation


The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.

  1. Add my add-ons repository to your home assistant instance (in supervisor addons store at top right, or click button below if you have configured my HA) Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.
  2. Install this add-on.
  3. Click the Save button to store your configuration.
  4. Set the add-on options to your preferences
  5. Start the add-on.
  6. Check the logs of the add-on to see if everything went well.
  7. Open the webUI and adapt the software options

Configuration

Webui can be found at http://homeassistant:PORT or through the sidebar using Ingress. The default username/password is described in the startup log. Configurations can be done through the app webUI, except for the following options.

Default name: admin Default password: admin123

Options

Option Type Default Description
PGID int 0 Group ID for file permissions
PUID int 0 User ID for file permissions
TZ str Timezone (e.g., Europe/London)
DOCKER_MODS str Docker modifications to apply
OAUTHLIB_RELAX_TOKEN_SCOPE str OAuth token scope relaxation
ingress_user str Username for ingress authentication
localdisks str Local drives to mount (e.g., sda1,sdb1,MYNAS)
networkdisks str SMB shares to mount (e.g., //SERVER/SHARE)
cifsusername str SMB username for network shares
cifspassword str SMB password for network shares
cifsdomain str SMB domain for network shares

Example Configuration

PGID: 0
PUID: 0
TZ: "Europe/London"
DOCKER_MODS: "linuxserver/mods:universal-calibre"
ingress_user: "admin"
localdisks: "sda1,sdb1"
networkdisks: "//192.168.1.100/books"
cifsusername: "bookuser"
cifspassword: "password123"
cifsdomain: "workgroup"

Mounting Drives

This addon supports mounting both local drives and remote SMB shares:

Optional Calibre-Web features

Calibre-Web documents optional extras that a manual installation adds with pip install calibreweb[metadata] and similar. You do not need to install anything here: the LinuxServer base image this add-on builds on installs Calibre-Web's requirements.txt and its full optional-requirements.txt into the application's virtualenv, so the gdrive, gmail, goodreads, ldap, oauth, metadata, comics and kobo dependencies are all present already. Running pip install calibreweb[...] inside the container is not a supported way to enable them: it installs the PyPI distribution of Calibre-Web over an installation that already has those dependencies, and it can disturb the versions the base image pinned. It is also thrown away, because the Supervisor recreates the add-on container on restart.

Optional features are switched on in the Calibre-Web web interface, not in the add-on options, under Admin -> Basic Configuration -> Feature Configuration (for example Enable Uploads, Enable Kobo sync, Use Goodreads).

Book covers. The Fetch Cover from URL and Upload Cover from Local Disk fields only appear on a book's Edit Metadata page when Enable Uploads is ticked in Feature Configuration and the logged-in user has the Upload permission (Admin -> the user -> Upload). A missing Python package is not what hides them.

Conversion, metadata embedding and the other Calibre integrations use command-line binaries such as ebook-convert, ebook-meta and calibredb. Those are installed at start by the linuxserver/mods:universal-calibre docker mod, which is the shipped default of the DOCKER_MODS option. If you set DOCKER_MODS yourself, keep linuxserver/mods:universal-calibre in the list (mods are separated by |) or those binaries disappear.

Other compatible Python packages can be installed from the add-on's custom script (see the section below); pip there points at Calibre-Web's own virtualenv. Such a script runs on every start, and it has to, since the container's writable layer does not persist.

Custom Scripts and Environment Variables

This addon supports custom scripts and environment variables:

Support

Create an issue on github

Illustration


illustration