janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
12.67k stars 1.33k forks source link

Calibre-web no longer download ebooks or sends epub to eReader #3052

Closed rsauve closed 4 months ago

rsauve commented 4 months ago

Short Notice from the maintainer

Yes, I can't images just how much work one has to put into a large project like Calibre-web. My issue may be best resolved by purging Calibre-web and re-installing...

Describe the bug/problem

I recently received an email message from Let's Encrypt indicating that my certificate was going to expire later this month. Odd as my server is running and there is a crontab schedule setup for auto renew.

Anyhow, when I went to log into Calibre-web it was offline. I discovered services cps and apache2 both had failed and refused to start.

After a load of online research and tinkering around I managed to get the cps service backup and running and then after much more time apache2 service came back to life.

I can now log into Calibre-web, perusal the ebook library and read an ebook in browser. However, I can no longer download ebooks (epub or mobi) and I no longer can send ebooks to my kindle account via "Send epub to eReader".

Here is an example:

I can select an ebook: 001

I can open the ebook in "Read in Browser - epub": 002

When I try to download an epub format, I get a html 404 error: 003

When I try to download mobi format, I get a html 404 error: 004

When I try to send an ebook to my Amazon account, Calibre-web says Success!: 005

Tasks shows an immediate failure: 006

To Reproduce

I don't think this issue can be reproduced. I suspect a operating system and/or program update caused some issues with Calibre-web and Appach2.

Logfile

Here is the lastest debug logfiles: Calibre-Web-debug-pack.zip

Expected behavior

If there is no clear-cut solution to this issue I will purge Calibre-web and try a re-install.

Environment (please complete the following information):

Some information about the server: NAME="Ubuntu" VERSION="20.04.6 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.6 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal

OS: Ubuntu 20.04.6 LTS x86_64 Kernel: 5.4.0-181-generic Uptime: 2 days, 38 mins Packages: 1700 (dpkg) Shell: bash 5.0.17 Terminal: /dev/pts/0 CPU: Intel Pentium N3700 (4) @ 2.400GHz GPU: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Memory: 1540MiB / 7429MiB

Python 3.8.10 Calibre-web version: 5/5/24, 7:18 PM

OzzieIsaacs commented 4 months ago

Please update "tornado" to a version >=6.3 as requested by the logfile, and please also update "flask-login" to a newer version (both are not likely to help, but give me a better feeling) The logfile shows several errors regarding reading files: [2024-05-11 16:16:33,746] ERROR {cps.tasks.mail:147} [Errno 2] No such file or directory: '/tmp/calibre_web/6434bddd-2049-4017-902a-f2cb59916b43.epub' [2024-05-11 16:16:33,749] ERROR {cps.tasks.mail:272} The requested file could not be read. Maybe wrong permissions? Could you please check the permissions of the user running calibre-web? You activated apply metadata on download/send to email, please deactivate this feature temporarly, this is calling calibre and coping a file to the temp folder, and it looks like something is going wrong there. grafik

Please set the loglevel to DEBUG and try to download/mail a book and check the output for some more hints (if in doubt, please post the new logfile here)

rsauve commented 4 months ago

I removed and re-installed tornado:

pip install -Iv tornado==6.3 Using pip 24.0 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8) Defaulting to user installation because normal site-packages is not writeable Collecting tornado==6.3 Obtaining dependency information for tornado==6.3 from https://files.pythonhosted.org/packages/00/47/51366fdc68fbd552150f5e36582875c8c8cd14623f946ce37730418e3580/tornado-6.3-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata Using cached tornado-6.3-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.5 kB) Using cached tornado-6.3-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (426 kB) Installing collected packages: tornado ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. calibreweb 0.6.20 requires tornado<6.3,>=4.1, but you have tornado 6.3 which is incompatible. Successfully installed tornado-6.3

I upgraded flask-login:

pip install flask-login --upgrade Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: flask-login in /usr/local/lib/python3.8/dist-packages (0.5.0) Collecting flask-login Downloading Flask_Login-0.6.3-py3-none-any.whl.metadata (5.8 kB) Requirement already satisfied: Flask>=1.0.4 in /usr/local/lib/python3.8/dist-packages (from flask-login) (2.0.1) Requirement already satisfied: Werkzeug>=1.0.1 in /usr/local/lib/python3.8/dist-packages (from flask-login) (2.0.1) Requirement already satisfied: Jinja2>=3.0 in ./.local/lib/python3.8/site-packages (from Flask>=1.0.4->flask-login) (3.0.2) Requirement already satisfied: itsdangerous>=2.0 in /usr/local/lib/python3.8/dist-packages (from Flask>=1.0.4->flask-login) (2.0.1) Requirement already satisfied: click>=7.1.2 in /usr/local/lib/python3.8/dist-packages (from Flask>=1.0.4->flask-login) (8.0.1) Requirement already satisfied: MarkupSafe>=2.0 in ./.local/lib/python3.8/site-packages (from Jinja2>=3.0->Flask>=1.0.4->flask-login) (2.0.1) Downloading Flask_Login-0.6.3-py3-none-any.whl (17 kB) Installing collected packages: flask-login ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. calibreweb 0.6.20 requires Flask-Login<0.6.3,>=0.3.2, but you have flask-login 0.6.3 which is incompatible. calibreweb 0.6.20 requires tornado<6.3,>=4.1, but you have tornado 6.3 which is incompatible. Successfully installed flask-login-0.6.3

Calibre-web cps service: cat /etc/systemd/system/cps.service

startup service

[Unit] Description=calibre-web server After=network.target

[Service] Type=simple User=robert Group=robert ExecStart=/home/robert/.local/bin/cps

[Install] WantedBy=multi-user.target

Calibre ebook library directory: drwxrwsr-x 1 robert robert 150K May 8 21:55 'Calibre Library'

Set Log Level to: DEBUG

Feature Configuration: Disabled - Embed Metadata to Ebook File on Download/Conversion/e-mail (needs Calibre/Kepubify binaries)

Saved changes.

Restart both cps and apache2 services.

Ozzie, mate you did it again! All is good! I can now download ebooks and send to my Amazon Kindle account. You are a legend!

Cheers,

Robert

OzzieIsaacs commented 4 months ago

My guess is that calibre itself creates the file with the embedded metadata with unsuitable permissions, so calibre-web can‘t read them afterwards. Anyway, you are happy I‘m happy, all good