Skip to content

Instantly share code, notes, and snippets.

@billy-idle
Last active August 3, 2024 20:06
Show Gist options
  • Save billy-idle/ec0c66dd746cc5e9808ebc0c88871f82 to your computer and use it in GitHub Desktop.
Save billy-idle/ec0c66dd746cc5e9808ebc0c88871f82 to your computer and use it in GitHub Desktop.

Calibre-web on FreeNAS

Creating the Jail

  • Step 1 - Name Jail and Choose FreeBSD Release

    • Name: calibre-jail
    • Jail Type: Default(Clone Jail)
    • Release: 11.3-RELEASE
  • Step 2 - Configure Networking

    • DHCP Autoconfigure IPv4 (check)
    • VNET (check)
  • Step 3 - Confirm Options

Running the Jail and setting up calibre-web

  1. Start the jail and go to the shell.
  2. Make sure you have installed the package manager:
pkg update
  1. Install git, pip, python and sqlite3:
pkg install git && pkg install py37-pip && pkg install python && pkg install sqlite3 && pkg install py37-sqlite3
  1. Clone the calibre-web repository
cd /
git clone https://github.com/janeczku/calibre-web.git
  1. Follow the "Quick start":
cd calibre-web/
pip install --target vendor -r requirements.txt
  1. Execute:
python cps.py

Open your web browser and go to http://[jail-ip-address]:8083, if everything goes fine you will see:

  1. Stop de Jail and add the mountpoint of your library (do not forget to check the Auto-start box in the edit section)

  2. Start the Jail, go to the jail's shell and create an startup script:

touch /calibre-web/cw-startup.sh

echo '#\!/bin/sh' >> /calibre-web/cw-startup.sh
echo 'nohup python /calibre-web/cps.py &' >> /calibre-web/cw-startup.sh

chmod +x /calibre-web/cw-startup.sh
  1. Add the script to the crontab
echo '@reboot root /calibre-web/cw-startup.sh' >> /etc/crontab
  1. Restart the jail and go to http://[jail-ip-address]:8083
@billy-idle
Copy link
Author

billy-idle commented Nov 3, 2020

@achmetinternet under #8 you're right it's the jail's shell.

@daddydaycare
Copy link

Thanks, installed fine following instructions. After mounting and restarting, at the basic configuration screen, I get DB Location is not Valid, Please Enter Correct Path. It is not accepting anything as a path, and the folder icon for what i assume is explorer doesn't open. Something wrong with my mapping? Permissions?

@Hu51
Copy link

Hu51 commented Dec 6, 2020

Thanks, installed fine following instructions. After mounting and restarting, at the basic configuration screen, I get DB Location is not Valid, Please Enter Correct Path. It is not accepting anything as a path, and the folder icon for what i assume is explorer doesn't open. Something wrong with my mapping? Permissions?

I have the same issue.

@billy-idle
Copy link
Author

billy-idle commented Dec 13, 2020

@daddydaycare @Hu51, sorry both for the late response I've been busy, I really don't know about your issue either how to fix it. If you get to solve it please share it.

@kaushikvira
Copy link

kaushikvira commented Dec 15, 2020

I had the same error.. it expects that whatever folder we provide has caliber DB. so I installed the caliber mac app that created DB for me that I copied to NAS and mounted it by using that path it worked.

root@calibre:/mnt/books # ls
John Schember	metadata.db

I yet to see that can I add books using the web version OR not OR it's just a read-only view of the provided DB. Yet to see. but I passed this error state.

@kaushikvira
Copy link

Yup. I can update too.. but for that have to enable "Enable Uploads" from admin Configuration.

@daddydaycare
Copy link

I had the same error.. it expects that whatever folder we provide has caliber DB. so I installed the caliber mac app that created DB for me that I copied to NAS and mounted it by using that path it worked.

root@calibre:/mnt/books # ls
John Schember	metadata.db

I yet to see that can I add books using the web version OR not OR it's just a read-only view of the provided DB. Yet to see. but I passed this error state.

Thank you! This worked for me.

@duSchmoll
Copy link

same issue than @daddydaycare, and the 'browse' icon does not work.
From the caliber-web shell, I cannot cd in the source (/mnt/LaCie/calibre_library) even if well defined in mount point, with 'open' permissions
any idea ?

@Legion495
Copy link

Legion495 commented Dec 17, 2020

Uhm I got that far but what the frick is the login on Calibre?
Before anyone questions me... my first TrueNAS

FOUND IT.
admin
PW:admin123

Setup your thing.

@duSchmoll
Copy link

I had the same error.. it expects that whatever folder we provide has caliber DB. so I installed the caliber mac app that created DB for me that I copied to NAS and mounted it by using that path it worked.

Hi @daddydaycare : what do u mean by "mounted it by using that path"... on my side, I created also a caliber DB and copy it to the NAS, but I cannot enter any path !

@fahadshery
Copy link

I followed your guide to setup the calibre-web.
I have an open share that hosts my books. I had to copy metadata.db from my Mac to the jail.

The Problem:

  1. Can't update the Metadata i.e. No Book Covers are shown. see below pic.

Screenshot 2020-12-28 at 10 00 18

  1. When I wish to read book in Browser, It gives the following error (even for the PDF formats):

Screenshot 2020-12-28 at 09 59 01

@fahadshery
Copy link

I wonder if you need to install Calibre pkg separately in the jail?

@fahadshery
Copy link

I resolved it completely by not only moving the metadata.db file but also the whole Calibre Library Folder to TrueNAS Core jail. Then add that Calibre Library folder as a Mount point to the jail and boom...Bobs your uncle!

@fahadshery
Copy link

if you wish to convert books as well and use the community plugin. check out here: https://www.truenas.com/community/threads/how-to-install-calibre-web-in-truenas-core-12-0.89868/

@flashbarts
Copy link

ran python cps.py but nothing seemed to happen..everything was ok til that point
Am pretty new to all this, so any pointers welcome
cheers

@schembeck
Copy link

I resolved it completely by not only moving the metadata.db file but also the whole Calibre Library Folder to TrueNAS Core jail. Then add that Calibre Library folder as a Mount point to the jail and boom...Bobs your uncle!

I got the same msg "database no valid" after finishing setup (step #10) and came up with a similar solution. What I did was to set a SMB Share in TrueNAS for my Windows machine, download the Calibre exe file from the website, and when prompted during install which folder should be used I refered to the SMB share I created earlier (in my case the share is my calibre folder 'from' mountpoint, e.g. mainpool/calibre -> /mnt/library). Note that the folder should be empty at install (you can copy stuff later) and it creates the database in the folder. With that out of the way I just loged into the [calibreip:8083] and threw in /mnt/library. Cheers for the very nice script and tutorial!

@daddydaycare
Copy link

My solution: Use truenass for storage. Build proxmox box. put OMV vm in. Sort portainer and away you go. No more jails, old packages, and broken stuff. Just works and is current. Best move I ever did. Keeping my Truenas box for now. But at some point,,,, the hardware might be better utilized with linux

@Zamana
Copy link

Zamana commented Jun 20, 2022

Hi!

June, 2022: after also installing py38-Flask and py38-Flask-Login, I have this error after python cps.py:

Traceback (most recent call last):
  File "cps.py", line 28, in <module>
    from cps.main import main
  File "/usr/local/calibre-web/cps/__init__.py", line 29, in <module>
    from .MyLoginManager import MyLoginManager
  File "/usr/local/calibre-web/cps/MyLoginManager.py", line 24, in <module>
    from flask_login import LoginManager
  File "/usr/local/lib/python3.8/site-packages/flask_login/__init__.py", line 16, in <module>
    from .login_manager import LoginManager
  File "/usr/local/lib/python3.8/site-packages/flask_login/login_manager.py", line 24, in <module>
    from .utils import (login_url as make_login_url, _create_identifier,
  File "/usr/local/lib/python3.8/site-packages/flask_login/utils.py", line 13, in <module>
    from werkzeug.security import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/usr/local/lib/python3.8/site-packages/werkzeug/security.py)```

@tylergotatie
Copy link

I'm stuck on step #3
I'm using py39 and I can't get pip to install successfully.
The error is "no packages available to install matching 'py39-pip' have been found in the repositories" it seems that all other packages are found and installed but not pip.
How do I resolve this?

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