Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please update sqlite to 3.31.1. #108

Closed
BoneAsh opened this issue Nov 30, 2020 · 13 comments · Fixed by #114
Closed

Please update sqlite to 3.31.1. #108

BoneAsh opened this issue Nov 30, 2020 · 13 comments · Fixed by #114

Comments

@BoneAsh
Copy link

BoneAsh commented Nov 30, 2020

I delete book error. janeczku/calibre-web#1639, please update sqlite to 3.31.1 to resolve it.

@project-bot project-bot bot added this to To do in Issue & PR Tracker Nov 30, 2020
@github-actions
Copy link

Thanks for opening your first issue here! Be sure to follow the issue template!

@jackhadrill
Copy link

Expected Behavior

When a book is deleted using the web UI, it should be deleted from both the disk and the calibre databse.

Current Behavior

The book is only deleted from disk. It persists in the database and will continue to display on the web UI.

Steps to Reproduce

  1. Remove book using web UI.

Identified Fix

Update SQLite to 3.31.1 (or update Ubuntu to 20.04)/

Environment

OS: N/A
CPU architecture: x86_64
How docker service was installed: Docker CE

Command used to create docker container (run/create/compose/screenshot)

version: "3.0"
services:
  calibre-web:
    image: ghcr.io/linuxserver/calibre-web
    container_name: calibre-web
    environment:
      - TZ=Europe/London
      - DOCKER_MODS=linuxserver/calibre-web:calibre
    volumes:
      - /opt/config:/config
      - /opt/books:/books
    ports:
      - 8083:8083

@jackhadrill
Copy link

I am also experiencing this issue. Hopefully it's a quick fix for someone who's more familiar with this repository!

@tobbenb
Copy link
Member

tobbenb commented Dec 1, 2020

As far as I can see we are not installing sqlite at all. Which version does calibre-web say we have installed?
I don't have access to my server as I'm moving, so can't check.
It isn't sqlalchemy that is installed from calibre-web's requirements.txt?

The reason we haven't moved to focal is that there was a bug in libseccomp that made images useless for arm users. The fix either has to be installed manually or enabling backports.
18.04 is an LTS release also.

@jackhadrill
Copy link

From one of the calibre-web maintainers: janeczku/calibre-web#1639 (comment)

You issue:
You installed calibre version 5.xx, accessed the the database with this program and afterwards Calibre-Web not working anymore. Now you can change calibre-Web versions forth and back, the error is still the same, trying to delete a book creates the error, even with Calibre-Web versions which worked before.
You are using an older Linux distro like Ubuntu 18.04, ...

Having this information, the solution is very easy, it has nothing to do with Calibre-Web. Calibre added new tables in the database, this tables require new features, which the sqlite driver of your distro is not supporting (e.g. 3.22 for Ubuntu, visible in about section).
You are lucky, because if I hadn't had the same problem, I would never found it with the information you provided. I created the issue template for asking basic infomration, this would have helped here a lot and would have saved both of use time.

Solution:
Please install pysqlite3-binary from pip, search for the installed package (something like ..site-packages/pysqlite3/_sqlite3.cpython-36m-x86_64-linux-gnu.so) symlink the shared library to the calibre-web root folder with a filename _sqlite3.so.
Restart Calibre-web, you'll see the new driver version in the about section:

@tobbenb
Copy link
Member

tobbenb commented Dec 1, 2020

Not sure when we are going to rebase to ubuntu focal, so we probably need to do the dirty fix until then.

@jackhadrill
Copy link

Something like this should work for x86_64. I don't have any arm dev environment to test the fix on any other archs.

echo "**** install updated SQLite driver ****" && \
pip3 install --no-cache-dir -U pysqlite3-binary && \
ln -s /usr/local/lib/python3.6/dist-packages/pysqlite3-binary/_sqlite3.cpython-36m-x86_64-linux-gnu.so /app/calibre-web/_sqlite3.so && \

@drizuid
Copy link
Member

drizuid commented Dec 7, 2020

you would need to install pip3 first; we only have it in there to install the requirements.txt stuff, then it's purged. Much like @tobbenb mentioned though, i don't see anywhere where we are adding pysqlite, sqlite, or anything similar outside of sqlalchemy to the image.

@jackhadrill
Copy link

Much like @tobbenb mentioned though, i don't see anywhere where we are adding pysqlite, sqlite, or anything similar outside of sqlalchemy to the image.

The SQLite3 driver is packaged into Ubuntu by default. The version in 18.04 is not compatible with features used by one of the tables in the latest version of calibre-web. Updating to 20.04 fixes this. Although, as @tobbenb mentioned, Focal doesn't seem to be high on your list of priorities.

Whilst I appreciate the following manifests are for the live versions rather than the bootstrapped versions, they should demonstrate that SQLite3 is installed by default and explain the mismatched versions.

http://releases.ubuntu.com/18.04/ubuntu-18.04.5-live-server-amd64.manifest
libsqlite3-0:amd64 3.22.0-1ubuntu0.4 (Not working)

http://releases.ubuntu.com/20.04/ubuntu-20.04.1-live-server-amd64.manifest
libsqlite3-0:amd64 3.31.1-4ubuntu0.2 (Working)

The workaround proposed by calibre-web's maintainer, whilst dirty, solves this problem in the short term.

@Roxedus
Copy link
Member

Roxedus commented Dec 9, 2020

Focal has issues when run on certain hardware due to upstream bugs, which is why we want to hold the upgrade, if we can.

@jackhadrill
Copy link

I understand. Hopefully we can incorporate the maintainer's suggested fix until those bugs are squashed.

@CHBMB
Copy link
Member

CHBMB commented Dec 9, 2020

@jackhadrill Thanks for the input, fwiw I've only just picked this up and tried your fix.

ImportError: libsqlite3-c8e69d31.so.0.8.6: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/app/calibre-web/cps.py", line 34, in <module>
    from cps import create_app
  File "/app/calibre-web/cps/__init__.py", line 72, in <module>
    ub.init_db(cli.settingspath)
  File "/app/calibre-web/cps/ub.py", line 676, in init_db
    engine = create_engine(u'sqlite:///{0}'.format(app_db_path), echo=False)
  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/__init__.py", line 500, in create_engine
    return strategy.create(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/strategies.py", line 87, in create
    dbapi = dialect_cls.dbapi(**dbapi_args)
  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/dialects/sqlite/pysqlite.py", line 430, in dbapi
    from sqlite3 import dbapi2 as sqlite
  File "/usr/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *

I'll try and take a bit more of a look at this tonight.

Rabattkarte added a commit to Rabattkarte/docker-calibre-web that referenced this issue Dec 18, 2020
Rabattkarte added a commit to Rabattkarte/docker-calibre-web that referenced this issue Dec 18, 2020
Rabattkarte added a commit to Rabattkarte/docker-calibre-web that referenced this issue Dec 18, 2020
@Rabattkarte
Copy link

Hey @CHBMB, I created #111 to fix this issue. I choosed @jackhadrill's approach. I hope the PR is in line with the contribution guidelines. 🙂

Rabattkarte added a commit to Rabattkarte/docker-calibre-web that referenced this issue Dec 21, 2020
CHBMB added a commit that referenced this issue Jan 14, 2021
Can't be merged to master until upstream push a new release.  See [here](janeczku/calibre-web#1755)

Will fix [this](#108) and also will close pending PR [here](#111)
@CHBMB CHBMB mentioned this issue Jan 14, 2021
Issue & PR Tracker automation moved this from To do to Done Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
7 participants