Installing and configuring Calibre-Server

    • OMV 2.x
    • Installing and configuring Calibre-Server

      I am new to OpenMediaVault. I am currently trying to get calibre-server working. After setting up the data directory I get an error "Failed to execute command 'omv-mkconf calibre 2>&1': cp: cannot copy a directory, `/media/4bd32d88-e714-4773-b987-c66b21216c45/media/4bd32d88-e714-4773-b987-c66b21216c45/calibreserver//content', into itself, ".
      I have made a number of attempts to setup this directory. This is my third directory that is now in the directory list.
      I am clearly misunderstanding something.
      A good tutorial on how this server is suppose to work might be the best thing along with some advice on how to start over on the configuration. I have removed the plugin and reinstalled and it retains my previous failed attempts in the drop down.
    • I am not sure what you where trying to do, and what tutorial you are using, but I know that I used the process from the calibre website and it works.
      I used omv 3 since calibre plug in is not available anymore..
      Why are you using omv-mkconf?

      Sent from my SM-N910T using Tapatalk
      omv 3.0.56 erasmus | 64 bit | 4.7 backport kernel
      SM-SC846(24 bay)| H8DME-2 |2x AMD Opteron Hex Core 2431 @ 2.4Ghz |49GB RAM
      PSU: Silencer 760 Watt ATX Power Supply
      IPMI |3xSAT2-MV8 PCI-X |4 NIC : 2x Realteck + 1 Intel Pro Dual port PCI-e card
      OS on 2×120 SSD in RAID-1 |
      DATA: 3x3T| 4x2T | 2x1T
    • Calibre 2.x is still in the Repos of OMV3, so if you don't need Calibre 3.x, you can install it easily with

      Source Code

      1. apt-get install calibre



      to run Calibre server with user permissions, add a system user with a home dir, but without the right to login

      Source Code

      1. adduser calibre --system --ingroup users --disabled-password --disabled-login


      Setup 2 shares in OMV web gui, gain rights/ALC to user calibre and to the users you want to give rights to add books (I set up "import" and "calibre", add SMB/NFS shares to provide books to calibre)

      To start calibre with system.d create a file with nano: /etc/systemd/system/calibre.service containing this:


      Source Code

      1. [Unit]
      2. Description=Calibre Service
      3. After=network.target
      4. [Service]
      5. Type=forking
      6. User=calibre
      7. Group=users
      8. PIDFile=/var/run/calibre/calibre-server.pid
      9. PermissionsStartOnly=true
      10. ExecStartPre=-/bin/mkdir -p /var/run/calibre
      11. ExecStartPre=/bin/chown -R calibre:users /var/run/calibre
      12. ExecStart=/usr/bin/calibre-server \
      13. --daemonize \
      14. --username=calibre \
      15. --port=9400 \
      16. --pidfile=/var/run/calibre/calibre-server.pid \
      17. --with-library=/srv/drive-by-xxx/calibre
      18. [Install]
      19. WantedBy=default.target
      Display All


      the subdirectory "calibre" in /var/run/ is needed for write-permissions to the PID-file. Adopt the library-path (--with-library=/srv/drive-by-xxx/calibre) and the port to your needs.

      Start

      Source Code

      1. systemctl start calibre.service

      Stop

      Source Code

      1. systemctl stop calibre.service

      Status

      Source Code

      1. systemctl status calibre.service

      Install as service

      Source Code

      1. systemctl enable calibre.service




      In calibre home dir (/home/calibre/) create a script named "import.sh" with

      Shell-Script

      1. #!/bin/bash
      2. IFS=$'\n'
      3. /usr/bin/calibredb add -r --with-library=/srv/dev-disk-by-xxx/calibre/ /srv/dev-disk-by-xxx/import/
      4. rm -R /srv/dev-disk-by-xxx/import/*
      5. echo "Import abgeschlossen!" | mailx -s "Import of your favourite ebooks done, Sir!" "your-email-address@xxx.xxx"

      Adopt paths and email according to your needs.

      By copying books to the share "import" and running the script afterwards, books are imported to calibre database. Already present books will not be imported twice. You can create a Cron job to run this script every hour or so to check import folder for books an import them automaticly. (In Web-GUI: Planned Tasks -> Tonus 'daily', user 'root', command

      Source Code

      1. /home/calibre/calibre_import.sh


      To convert books into another format you can use and adopt this script:

      Shell-Script

      1. #!/bin/bash
      2. IFS=$'\n'
      3. for file in `find /srv/dev-disk-by-xxx/calibre/ -type f -name "*.epub"`
      4. do
      5. if [ ! -f "${file%epub}mobi" ]
      6. then
      7. /usr/bin/ebook-convert "$file" "${file%epub}mobi" && chown calibre:users "${file%epub}mobi"
      8. idstring=`dirname "${file%epub}mobi"`
      9. idstring=${idstring%\)}
      10. /usr/bin/calibredb add_format --with-library=/srv/dev-disk-by-xxx/calibre/ ${idstring##*\(} "${file%epub}mobi"
      11. fi
      12. done
      Display All
      I store 2 formats EPUB + MOBI to serve Kindle and Tolino readers within my family. The script checks for all EPUBs and converts them to MOBI if not already a MOBI file is present. You an place this script in /home/calibre/ as well as conversion.sh and set up a Cron job to run it for example every 6 hours.

      Don't forget to grant appropriate rights to the scripts and make them executable

      Source Code

      1. chmod +x /path_to_script/scriptname.sh

      This setup works for me like a charm. I don't use username + password for accessing calibre server since I do not forward the used port in router to public. (Some Kindle have also a problem with the user/password setup)
      My family can access it by VPN (router-router-bonding) directly through their reader devices as installed shop.


      Feel free to hand in some improvements if there are any, I quite appreciate getting them!
      Chaos is found in greatest abundance wherever order is being sought.
      It always defeats order, because it is better organized.
      Terry Pratchett

      The post was edited 7 times, last by riff-raff ().

    • I ported the calibre plugin to the latest OMV but found out that calibre 3.x has many different options. That killed my motivation to go any further.
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • riff-raff wrote:

      The options mean server config options?
      Yep. The unit file is very different and I couldn't even get the server started because it said the database doesn't exist. I couldn't figure out how to create/initialize a new database.
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Since Calibre version 2.50 is in Jesse repo and 2.75 is in Stretch repo, why not stick to verson 2.x for the plugin? This should cover OMV3+4, right? I know, OMV-Extras is a separate thing and can offer newer packages.
      Chaos is found in greatest abundance wherever order is being sought.
      It always defeats order, because it is better organized.
      Terry Pratchett
    • riff-raff wrote:

      why not stick to verson 2.x for the plugin? This should cover OMV3+4, right?
      That sounds like a nice idea but people complain enough as it is when the version used is just a few versions back. Plus, the calibre author recommends against it. I don't use calibre so I don't know what the best solution is. The plugin requires some re-writing whether I use calibre 3.x or use 2.x version from the Debian repos.
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Debian Jesse is not bleeding edge ... in OMV, php is not bleeding edge, the kernel is not bleeding edge, a lot of services are not bleeding edge. Well, most users of OMV don't even notice that. For Calibre, where you see only server web gui, there is small difference in appearance.

      If you look through calibres version 3.x changelogs, its basicly features und functions, minor bugfixing and security related update.
      Chaos is found in greatest abundance wherever order is being sought.
      It always defeats order, because it is better organized.
      Terry Pratchett
    • riff-raff wrote:

      Debian Jesse is not bleeding edge ... in OMV, php is not bleeding edge, the kernel is not bleeding edge, a lot of services are not bleeding edge. Well, most users of OMV don't even notice that.
      Plenty of people want bleeding edge kernels. People have asked for newer php but that isn't really possible. Most media related services/plugins (like plex, emby, couchpotato, sabnzbd, etc), people want the latest release.

      riff-raff wrote:

      If you look through calibres version 3.x changelogs, its basicly features und functions, minor bugfixing and security related update.
      I get that but either way, it requires more work from me for something I don't use.
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • A small addition to my calibre howto:

      To manage the database from remote, share the calibre-folder via Samba, be sure to set correct ACL and permissions for the accessing user for the directory and its subdirectories!

      Stop your calibre server with

      Source Code

      1. systemctl stop calibre.service

      Install a 2.5.0 calibre on your remote computer (for Windows-machines there is a portable edition with this Version) and connect to your share by using the "change library" function. Now you can work on your library, correct import errors or edit metadata.

      If you encounter any errors relating read-only database, your permissions are not set correct.

      use

      Source Code

      1. systemctl start calibre.service
      to restart your server after changes were made to the metadata
      Chaos is found in greatest abundance wherever order is being sought.
      It always defeats order, because it is better organized.
      Terry Pratchett
    • Hi Riff-raff,

      thank you very much for that tut.

      I have understood everything so far.. except this one:

      "Setup 2 shares in OMV web gui, gain rights/ALC to user calibre and to the users you want to give rights to add books (I set up "import" and "calibre", add SMB/NFS shares to provide books to calibre)"



      Can you may give me an advice what I have to do exactly? (may in pictures?) I am mostly new on OMV 3.x and my english is good but I can´t follow it up on my german Web GUI...

      Thanks a lot in advance
      Intel® Celeron® 420 Prozessor (1.6 GHz, 512 KB, L2 Cache)
      2GB DDr2 RAM
      OMV 3.0.94
      2x 3TB Seagate
      1x 2TB Hitachi
      1x 250GB Samsung (Main System OMV )

      The post was edited 1 time, last by Zeb Aztian ().

    • You need two shared folders, in my example 'calibre' (this is where calibre puts its database, the books and all meta data) and the 'import' folder. If you share 'import' with Samba, you can access this folder from your remote PC, copy new ebooks there and import them to the calibre database by using the provided script. Granting rights to these folders is done in the shared folter tab with Privileges and ACL. Privileges need to be set for calibre and the user you want to use to place books in the 'import' folder; read and write permissions should be granted.
      The 'calibre' folder does not need to be shared with Samba since you access Calibre through webinterface or your prefered reading device. You could do it anyways, so you would be able to access the database from a remote calibre installation with GUI as well. In order to do that you would have to stop calibre service before you connect from remote. This is a little nasty, I would not recommed trying to do this.
      The conversion script is designed to convert from EPUB to MOBI for the use on Kindle devices. You can replace all '.MOBI' within the script by your prefered ebook type to adopt your needs.

      Maybe I can set up a virtual machine and take some screenies during a setup to decorate this tutorial

      /rudemode on
      Auf Deutsch geht auch, aber nicht in diesem Thread, Sprachmix wird nicht gern gesehen.
      /rudemode off

      :D
      Chaos is found in greatest abundance wherever order is being sought.
      It always defeats order, because it is better organized.
      Terry Pratchett
    • Hi Riff Raff,

      thanks for your reply :)

      Got it and now I am hanging up on that:
      the subdirectory "calibre" in /var/run/ is needed for write-permissions to the PID-file. Adopt the library-path (--with-library=/srv/drive-by-xxx/calibre) and the port to your needs.


      My calibre.service file is looking as yours but instead of xxx I have chosen the path of my "calibre" folder. What am I doing wrong here?
      Intel® Celeron® 420 Prozessor (1.6 GHz, 512 KB, L2 Cache)
      2GB DDr2 RAM
      OMV 3.0.94
      2x 3TB Seagate
      1x 2TB Hitachi
      1x 250GB Samsung (Main System OMV )
    • Zeb Aztian wrote:

      /srv/drive-by-id-ata-Hitachi_HDS723020BLA642_MN1240F33MV0LD-part1/calibre
      Doesn't seem right, did you check it with ssh or terminal if present? Did you upgraded your installation to OMV3 from an existing OMV2?

      mine looks like this (might be because of raid-use):

      Source Code

      1. /srv/dev-disk-by-label-Storage/calibre
      Chaos is found in greatest abundance wherever order is being sought.
      It always defeats order, because it is better organized.
      Terry Pratchett
    • how does the conent of

      Source Code

      1. /srv
      look like?

      Did you create the calibre user? Did you copy the startup script (service) correct?

      My ownership of these two folders:

      Source Code

      1. ls -la
      to see

      Source Code

      1. drwxrws---+ 22359 root users 913408 Jan 8 20:34 calibre
      2. drwxrws---+ 2 calibre users 4059136 Jul 28 00:55 calibre_import
      with

      Source Code

      1. getfacl calibre
      to see

      Source Code

      1. # file: calibre
      2. # owner: root
      3. # group: users
      4. # flags: -s-
      5. user::rwx
      6. user:calibre:rwx
      7. user:MYNAME:rwx
      8. group::---
      9. mask::rwx
      10. other::---
      11. default:user::rwx
      12. default:user:calibre:rwx
      13. default:user:MYNAME:rwx
      14. default:group::---
      15. default:mask::rwx
      16. default:other::---
      Display All

      What is that SSH-tool you use? Its more like an file explorer, right, nothing to push commands? I prefer SSH remote from Linux hosts and PuTTy from Windows hosts.
      Chaos is found in greatest abundance wherever order is being sought.
      It always defeats order, because it is better organized.
      Terry Pratchett

      The post was edited 4 times, last by riff-raff ().

    • Here the system.ctl status calibre.service


      and here journal.ctl -xn



      Please don't wonder about the 2 HDD which have no space left.. I try to fix this.
      Hopefully this isn't the problem?!

      Regarding your questions how /serv looks like:

      Intel® Celeron® 420 Prozessor (1.6 GHz, 512 KB, L2 Cache)
      2GB DDr2 RAM
      OMV 3.0.94
      2x 3TB Seagate
      1x 2TB Hitachi
      1x 250GB Samsung (Main System OMV )
    • Check content of the following file:

      Source Code

      1. /etc/systemd/system/calibre.service

      Check if folder

      Source Code

      1. /var/run/calibre/
      exists and contains the .pid-file. If there is a .pid, delete it. Check folder permissions as well. The folder should be created by the startscript and rights will be granted as well so that .pid-file can be placed.
      Chaos is found in greatest abundance wherever order is being sought.
      It always defeats order, because it is better organized.
      Terry Pratchett

      The post was edited 1 time, last by riff-raff ().

    • riff-raff wrote:

      Check content of the following file:

      Source Code

      1. /etc/systemd/system/calibre.service

      My file:
      Display Spoiler
      <pre style="color: rgb(0, 0, 0); font-variant-ligatures: normal; orphans: 2; widows: 2; -webkit-user-select: text; position: absolute; top: -99px;">Description=Calibre ServiceAfter=network.target[Service]Type=forkingUser=calibreGroup=usersPIDFile=/var/run/calibre/calibre-server.pidPermissionsStartOnly=trueExecStartPre=-/bin/mkdir /var/run/calibreExecStartPre=/bin/chown -R calibre:users /var/run/calibreExecStart=/usr/bin/calibre-server \ --daemonize \ --username=calibre \ --port=9400 \ --pidfile=/var/run/calibre/calibre-server.pid \ --with-library=/srv/drive-by-id-ata-Hitachi_HDS723020BLA642_MN1240F33MV0LD-part1/calibre[Install] WantedBy=default.target

      Check if folder

      Source Code

      1. /var/run/calibre/
      exists and contains the .pid-file. If there is a .pid, delete it. Check folder permissions as well. The folder should be created by the startscript and rights will be granted as well so that .pid-file can be placed.


      => There is no PID File inside...
      [/quote]
      Intel® Celeron® 420 Prozessor (1.6 GHz, 512 KB, L2 Cache)
      2GB DDr2 RAM
      OMV 3.0.94
      2x 3TB Seagate
      1x 2TB Hitachi
      1x 250GB Samsung (Main System OMV )