linuxserver / docker-calibre

GNU General Public License v3.0
338 stars 62 forks source link

[BUG] Unable to open book in Calibre KasmVNC #136

Closed FreedomJack-X closed 8 months ago

FreedomJack-X commented 10 months ago

Is there an existing issue for this?

Current Behavior

When I am trying to open/edit book in calibre opened through KasmVNC. I am not able to get new window open to open/edit book.

Expected Behavior

No response

Steps To Reproduce

Run the calibre server use 8181 port to access KasmVNC through https port Try to open/edit book

Environment

- OS:Ubuntu 22.04
- How docker service was installed: I used portainer to manage docker image and use docker-compose with portainer to install calibre server

CPU architecture

arm64

Docker creation

Docker-Compose
---
version: "2.1"
services:
  calibre:
    image: lscr.io/linuxserver/calibre:latest
    container_name: calibre-2
    security_opt:
      - seccomp:unconfined
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=PST
    volumes:
      - /home/jj/EBooks:/config
    ports:
      - 8083:8080
      - 8182:8181
      - 8082:8081
    restart: unless-stopped

Container logs

Failed to import PyQt module: PyQt6.QtWebEngineCore with error: libXdamage.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "runpy.py", line 196, in _run_module_as_main
  File "runpy.py", line 86, in _run_code
  File "site.py", line 47, in <module>
  File "site.py", line 43, in main
  File "calibre/utils/ipc/worker.py", line 215, in main
  File "calibre/gui_launch.py", line 102, in wrapper
  File "calibre/gui_launch.py", line 117, in ebook_viewer
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/gui2/viewer/main.py", line 15, in <module>
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/gui2/viewer/ui.py", line 29, in <module>
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/gui2/viewer/annotations.py", line 13, in <module>
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/gui2/viewer/web_view.py", line 12, in <module>
ImportError: cannot import name 'QWebEnginePage' from 'qt.webengine' (/opt/calibre/lib/calibre-extensions/python-lib.bypy.frozen/qt/webengine.pyc)
github-actions[bot] commented 10 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

LinuxServer-CI commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

fdelucchijr commented 9 months ago

Same here, also editing epubs, looks a problem opening external windows 🤔

HaoSs07 commented 9 months ago

Was going to open this problem. It still happens, and it's old, from the first release on KasmVNC "apt update && apt install xchm -y" will let you view/edit epubs, For docx log trows errors with missing packages to open that format, it seems it needs a browser, but won't work, firefox or chromium asks for snap install. And that is another problem in itself... Installing the HUGE LibreOffice, links2 and lynx on the other hand will let you edit docx

drizuid commented 8 months ago

Based on the qt.webengine error, i believe we may need to apply https://github.com/linuxserver/docker-calibre/pull/126 to the master branch. I'll work up a PR and you guys can test

drizuid commented 8 months ago

The PR is building now, once it completes, please test and see if this resolves the issues. Ill update this post with the PR build once I have it.

Update: amd64 tag: lspipepr/calibre:amd64-v6.28.1-pkg-1d4d3e3c-dev-3ddd82eb8fa7b46c870bfeb67fe141217d459ac8-pr-140 arm64 tag: lspipepr/calibre:arm64v8-v6.28.1-pkg-1d4d3e3c-dev-3ddd82eb8fa7b46c870bfeb67fe141217d459ac8-pr-140

HaoSs07 commented 8 months ago

Ok. will test and post update.

drizuid commented 8 months ago

Note, i have no clue if this will let you EDIT, but the ebook-viewer in calibre should open the book for viewing. this fixes the qt webengine sandboxing issue

drizuid commented 8 months ago

@FreedomJack-X @fdelucchijr if you guys don't mind, this is more specifically geared to the errors you guys are seeing, so please test and report back :)

aptalca commented 8 months ago

I'm on the latest stable calibre and I can open epubs with no issues. I never tried editing a book, though. I don't even know how to do that (or had any reason to)

Are you guys using a reverse proxy?

Mine works direct as well as through SWAG

For things that require a browser, you'd have to install a browser as the image doesn't contain one.

HaoSs07 commented 8 months ago

Nope, can't view docx or epub,:

[custom-init] No custom files found, skipping...
_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.

Xvnc KasmVNC 1.2.0 - built Oct  7 2023 18:58:59
Copyright (C) 1999-2018 KasmVNC Team and many others (see README.me)
See http://kasmweb.com for information on KasmVNC.
Underlying X server release 12014000, The X.Org Foundation

[ls.io-init] done.
Obt-Message: Xinerama extension is not present on the server
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-abc'
 2023-10-11 19:05:32,551 [INFO] websocket 0: got client connection from 127.0.0.1
 2023-10-11 19:05:32,591 [PRIO] Connections: accepted: @2a02:xxxxxxxxxxx:8213:6010_1697040332.553815::websocket
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-abc'
/usr/bin/xdg-open: 882: x-www-browser: not found
/usr/bin/xdg-open: 882: firefox: not found
/usr/bin/xdg-open: 882: iceweasel: not found
/usr/bin/xdg-open: 882: seamonkey: not found
/usr/bin/xdg-open: 882: mozilla: not found
/usr/bin/xdg-open: 882: epiphany: not found
/usr/bin/xdg-open: 882: konqueror: not found
/usr/bin/xdg-open: 882: chromium: not found
/usr/bin/xdg-open: 882: chromium-browser: not found
/usr/bin/xdg-open: 882: google-chrome: not found
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening 'file:///library/Stephanie%20Garber/[Caraval]%2003%20Finalul%200.9%20(17188)/[Caraval]%2003%20Finalul%200.9%20-%20Stephanie%20Garber.docx'
Failed to import PyQt module: PyQt6.QtWebEngineCore with error: libXdamage.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "runpy.py", line 196, in _run_module_as_main
  File "runpy.py", line 86, in _run_code
  File "site.py", line 47, in <module>
  File "site.py", line 43, in main
  File "calibre/utils/ipc/worker.py", line 215, in main
  File "calibre/gui_launch.py", line 102, in wrapper
  File "calibre/gui_launch.py", line 117, in ebook_viewer
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/gui2/viewer/main.py", line 15, in <module>
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/gui2/viewer/ui.py", line 29, in <module>
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/gui2/viewer/annotations.py", line 13, in <module>
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/gui2/viewer/web_view.py", line 12, in <module>
ImportError: cannot import name 'QWebEnginePage' from 'qt.webengine' (/opt/calibre/lib/calibre-extensions/python-lib.bypy.frozen/qt/webengine.pyc)
drizuid commented 8 months ago

I wouldn't expect docx to work.. is that even supported by default in calibre? but I, using the PR can open an EPUB and aptalca using :latest can open an EPUB. Oddly enough, i only even see the docx attempt in your log, hm

aptalca commented 8 months ago

xdg-open: no method available for opening . . . You're not going to be able to open a docx without a browser. All the browsers calibre supports are listed in the log. None of them are shipped in the image.

For epub, post the details asked in the issue template

HaoSs07 commented 8 months ago
Failed to import PyQt module: PyQt6.QtWebEngineCore with error: libXdamage.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "runpy.py", line 196, in _run_module_as_main
  File "runpy.py", line 86, in _run_code
  File "site.py", line 47, in <module>
  File "site.py", line 43, in main
  File "calibre/utils/ipc/worker.py", line 215, in main
  File "calibre/gui_launch.py", line 102, in wrapper
  File "calibre/gui_launch.py", line 156, in gui_ebook_edit
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/gui2/tweak_book/main.py", line 12, in <module>
  File "bypy-importer.py", line 279, in exec_module
  File "calibre/ebooks/oeb/polish/check/css.py", line 11, in <module>
ImportError: cannot import name 'QWebEnginePage' from 'qt.webengine' (/opt/calibre/lib/calibre-extensions/python-lib.bypy.frozen/qt/webengine.pyc)

The log for trying to open epub, the same as in main post, I'm also running on arm64

drizuid commented 8 months ago

can you try docker exec -it calibre apt-get update && apt-get install libxdamage1 then try to open the epub?

drizuid commented 8 months ago

actually disregard that, it looks like we already install it https://github.com/linuxserver/docker-calibre/blob/94da2b5b1de45ef34c6a6fa77ae1539219450571/package_versions.txt#L1092 let us ponder

HaoSs07 commented 8 months ago

"apt update && apt install xchm -y" fixed view/edit epub ( as stated above )

drizuid commented 8 months ago

"apt update && apt install xchm -y" fixed open/edit epub ( as stated above )

we are not trying to allow you to edit that is not in our scope, we are trying to resolve the libxdamage issue affecting arm64 using a built-in function, viewing epub.

OK my above showing libxdamage installed was from AMD64, ARM64 is here https://ci-tests.linuxserver.io/linuxserver/calibre/v6.28.1-ls243/arm64v8-v6.28.1-ls243.sbom.html and shows that libxdamage is NOT installed. this should confirm if there's a fix docker exec -it calibre apt-get update && apt-get install libxdamage1 but we will work an addition to my PR

HaoSs07 commented 8 months ago

yes, apt-get update && apt-get install libxdamage1 lets you view ( and edit :P )

drizuid commented 8 months ago

perfect, thank you for testing, i will add to the PR also glad it let you edit!

drizuid commented 8 months ago

give me a few min to mod the PR, then if you can test with the image and no manual apt install and confirm it's good, we can merge. thanks for your patience with this

drizuid commented 8 months ago

@HaoSs07 if you can test with lspipepr/calibre:arm64v8-v6.28.1-pkg-1d4d3e3c-dev-445bc98ae2a1b820a7432e69d403577402fc8083-pr-140 and let me know if all is well?

HaoSs07 commented 8 months ago

Yes, it's working fine.

drizuid commented 8 months ago

thanks for the confirmation!

fdelucchijr commented 8 months ago

Same here, everything working perfect! Thanks @drizuid !!!