*New 12.2 series Release:
2021-11-21: XigmaNAS 12.2.0.4.8860- released!

We really need "Your" help on XigmaNAS Language packages. Please help us today!

XigmaNAS talks on IRC https://web.libera.chat/#xigmanas, ircs://irc.libera.chat:6697 (TLS) or irc://irc.libera.chat:6667 (plain text)

[HOWTO] Install Calibre Server inside a Jail

Only Admin's or Moderators can move thread's to this sub-forum.
Nobody should start a new thread on this sub-forum.
Anybody can reply to a thread on this sub-forum.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
Hiji56
Advanced User
Advanced User
Posts: 170
Joined: Feb 13th, '21, 11:33
Status: Offline

[HOWTO] Install Calibre Server inside a Jail

#1

Post by Hiji56 »

"
by oldskater»06 Aug 2014 12:42
I have managed to get this working and thought I would share in case it is of use to anyone else.
Hopefully this is in the correct format, I have not made a howto before.
1. Create Jail and mount Calibre Library folder via The Brig. My fstab looks like this
/mnt/1TBSecondary/Backups/Uber/K /mnt/1TBPrimary/System/Jail/Calibre/mnt/K nullfs rw 0 0
2. Enter Jail. I add nano as my preferred editor, this is up to you. Code: Select all

Code: Select all

pkg_add -r nano
3. Then install Calibre Code: Select all

Code: Select all

pkg_add -r calibre
4. configure the /etc/rc.conf file. The /usr/local/etc/rc.d/calibre file will tell you what needs to be defined in the configuration file.
I have added the following lines to mine (edit/add to yours as needed)
calibre_enable=""YES""
calibre_user=""root""
calibre_library=""/mnt/K""
5. I also had to change user to root in the /usr/local/etc/rc.d/calibre file
: ${calibre_user:=root}
6. Restart jail and all should be working. Access your library via 'jail_ip_address:8080 (unless of course you changed your port at step 4.)
If needed you can manually start your jail using Code: Select all

Code: Select all

calibre-server --with-library=""/mnt/PATH_TO_YOUR_LIBRARY""
I think COPS ""http://blog.slucas.fr/en/oss/calibre-opds-php-server"" would be a better solution, but as yet I don't have the knowledge to get this working.
If anyone can help with that it would be much appeciated.
"
"
by oldskater»06 Aug 2014 13:13
And here is a screenshot
001.png
"
"
by laster13»19 Oct 2014 11:44
hi
thanks for your howto
I have these error
002.PNG
i have place epub in library but calibre doesn't see it
"
"
by raulfg3»19 Oct 2014 12:05
please revise that this line really point to your lib: calibre_library=""/mnt/K""
Remember you are inside a jail so you need to mount your real lib inside the /mnt of your jail.
Post a ls -s of your lib to see if have permission.
"
"
by laster13»19 Oct 2014 12:25
thank for your answer
Code: Select all

Code: Select all

root@apache:/ # ls -s /mnt/book
896 Alice's Adventures in Wonderland - Lewis Carroll.epub
832 The Adventures of Sherlock Holmes - Arthur Conan Doyle (1).epub
236 annunzio_episcopo_et_cie.epub
116 metadata.db
"
"
by laster13»19 Oct 2014 12:57
these version is 0.9.42 and i see that calibre exist in ports here
deskutils/calibre and the version is 1.48.0
""http://portsmon.freebsd.org/portovervie ... me=calibre""
do you think i can build this new version ?
Code: Select all

Code: Select all

cd /usr/ports/deskutils/calibre
Code: Select all

Code: Select all

make install clean
"
"
"
"
by laster13»21 Oct 2014 22:09
hi
i have build calibre 1.48.0 but i have always the same error. I place epub in /mnt/K inside the jail
Code: Select all

Code: Select all

Error: No books found
TypeError: undefined is not a function
    at Object.printStackTrace.implementation.createException (http://192.168.0.104:8080/static/stacktrace.js:81:18)
    at Object.printStackTrace.implementation.run (http://192.168.0.104:8080/static/stacktrace.js:66:25)
    at printStackTrace (http://192.168.0.104:8080/static/stacktrace.js:57:62)
    at render_error (http://192.168.0.104:8080/static/browse/browse.js:134:18)
    at booklist (http://192.168.0.104:8080/static/browse/browse.js:271:29)
    at HTMLDocument. (http://192.168.0.104:8080/browse/category/newest:33:17)
    at Function.jQuery.extend.ready (http://192.168.0.104:8080/static/jquery.js:392:9)
    at HTMLDocument.DOMContentLoaded (http://192.168.0.104:8080/static/jquery.js:745:10)
i have this screen
003.JPG
i have not other categorie like authors, formats, genre.... and calibre doesn't find my library...
/etc/rc.conf
Code: Select all

Code: Select all

sendmail_enable=""NONE""
syslogd_flags=""-ss""
rpc_bind=""NO""
network_interfaces=""""
cron_flags=""$cron_flags -J 15""
calibre_enable=""YES""
calibre_user=""root""
calibre_library=""/mnt/K""
/usr/local/etc/rc.d/calibre
Code: Select all

Code: Select all

#!/bin/sh
#
# $FreeBSD: head/deskutils/calibre/files/calibre.in 362498 2014-07-21 21:31:27Z marino $
#
# PROVIDE: calibre
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable calibre_server:
#
# calibre_enable (bool):        Set it to ""YES"" to enable calibre
#                               Default is ""NO"".
# calibre_port (int):port that calibre_server listens on
#Default is 8080
# calibre_user (string):user that calibre_server runs as
#Default is calibre
# calibre_home (string):home directory for calibre_server
#Default is the home directory of calibre_user
# calibre_username (string):username for calibre authentication
#Default is calibre
# calibre_password (string):If set then access is restricted
#default is unrestricted
# calibre_url_prefix (string):  prefix to append to all URLs
#default is unset
# calibre_library (string):path to library folder to serve content from
#
#
##########################################################
. /etc/rc.subr
name=calibre
rcvar=calibre_enable
load_rc_config $name
: ${calibre_enable:=yes}
: ${calibre_user:=root}
: ${calibre_library:=/mnt/K}
pidfile=/var/run/${name}/${name}.pid
command=/usr/local/bin/calibre-server
command_interpreter=python2
required_dirs=${calibre_library}
start_cmd=${name}_start
start_precmd=""install -d -o ${calibre_user} -m755 /var/run/${name}""
calibre_start()
{
if [ ! -z ""${calibre_port}"" ]; then
command_args=""${command_args} --port=${calibre_port}""
fi
if [ ! -z ""${calibre_username}"" ]; then
command_args=""${command_args} --username=${calibre_username}""
fi
if [ ! -z ""${calibre_password}"" ]; then
command_args=""${command_args} --password=${calibre_password}""
fi
if [ ! -z ""${calibre_url_prefix}"" ]; then
command_args=""${command_args} --url-prefix=${calibre_url_prefix}""
fi
calibre_home=${calibre_home:-$(getent passwd ${calibre_user} | awk -F: '{print $6}')}
HOME=${calibre_home:-/nonexistent}
/usr/sbin/daemon -f -u ${calibre_user} -p ${pidfile} ${command} ${command_args} --with-library ${calibre_library}
}
run_rc_command ""$1""
"
"
by oldskater»22 Oct 2014 21:39
This seems to be a problem with your mounted folder.
I think calibre is just not seeing your book share
What is the path to your share with your epub's?
my fstab looks like this ""/mnt/1TBSecondary/Backups/Uber/K /mnt/1TBPrimary/System/Jail/Calibre/mnt/K nullfs rw 0 0""
But you must change this to match your own file structure.
for example if you had your books in your nas on
/mnt/Files/Books
then your fstab would be
/mnt/Files/Books /mnt/Files/Books nullfs rw 0 0
Hope this makes sense
"
"
by laster13»22 Oct 2014 21:44
Sorry fort my english
I dont write a mount point on fstab because i put files in folders inside the jail /mnt/K
Is this my mistake?
edit /etc/fstab.... in jail calibre
Code: Select all

Code: Select all

/mnt/pool1/K /mnt/pool1/Jail/calibre/mnt/K nullfs rw 0 0
...always the same error
"
"
by oldskater»23 Oct 2014 09:25
Yes you will need to mount the directory containing your epubs into the jail.
Do this using fstab within the Brig.
"
"
by laster13»23 Oct 2014 09:33
yes i'm using fstab within the Brig to mount directory but it doesn't work
Code: Select all

Code: Select all

/mnt/pool1/K /mnt/pool1/Jail/calibre/mnt/K nullfs rw 0 0
"
"
by oldskater»23 Oct 2014 11:14
Ok, I will be home next week and will be able to look at my system and maybe help some more.
I think we need to make some fundamental checks on your system as that mount command you are running should work.
Are your epubs actually in a directory named ""K""?
Or as in your post above your books are in ""/mnt/book""?
"
"
by raulfg3»23 Oct 2014 11:19
check permission and owner, please post ls of /mnt/pool1/K and same for /mnt/pool1/Jail/calibre/mnt/K
"
"
by laster13»23 Oct 2014 21:23
Code: Select all

Code: Select all

nas4free: / # ls -l /mnt/pool1/K
total 1844
-rw-r--r--  1 root  wheel  854907 Oct 19 07:13 Alice's Adventures in Wonderland - Lewis Carroll.epub
-rw-r--r--  1 root  wheel  791008 Oct 19 07:15 The Adventures of Sherlock Holmes - Arthur Conan Doyle .epub
-rw-r--r--  1 root  wheel  116736 Oct 23 17:25 metadata.db
Code: Select all

Code: Select all

nas4free: / # ls -l /mnt/pool1/Jail/calibre/mnt/K
total 1844
-rw-r--r--  1 root  wheel  854907 Oct 19 07:13 Alice's Adventures in Wonderland - Lewis Carroll.epub
-rw-r--r--  1 root  wheel  791008 Oct 19 07:15 The Adventures of Sherlock Holmes - Arthur Conan Doyle .epub
-rw-r--r--  1 root  wheel  116736 Oct 23 17:25 metadata.db
thanks
"
"
by raulfg3»23 Oct 2014 22:37
perhaps is a bug like this: ""https://bugs.launchpad.net/calibre/+bug/1351411""
"
"
by oldskater»27 Oct 2014 19:39
laster13 are you still trying to get this working?
From the above it looks like your mounts are correct so the next thing to check is your configuration.
Your /etc/rc.conf file above looks to be correct.
My /usr/local/etc/rc.d looks a little different to yours.
It looks like you edited a couple of extra line.
The only thing I changed in this file was the one line
Code: Select all

Code: Select all

: ${calibre_user:=root}
Everything else was left as default.
Maybe trying replacing with mine or editing yours and see if that helps.
Code: Select all

Code: Select all

#!/bin/sh
#
# $FreeBSD: head/deskutils/calibre/files/calibre.in 322136 2013-07-01 18:34:45Z madpilot $
#
# PROVIDE: calibre
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable calibre_server:
#
# calibre_enable (bool):        Set it to ""YES"" to enable calibre
#                               Default is ""NO"".
# calibre_port (int):port that calibre_server listens on
#Default is 8080
# calibre_user (string):user that calibre_server runs as
#Default is calibre
# calibre_username (string):username for calibre authentication
#Default is calibre
# calibre_password (string):If set then access is restricted
#default is unrestricted
# calibre_url_prefix (string):  prefix to append to all URLs
#default is unset
# calibre_library (string):path to library folder to serve content from
#
#
##########################################################
. /etc/rc.subr
name=calibre
rcvar=calibre_enable
load_rc_config $name
: ${calibre_enable:=NO}
: ${calibre_user:=root}
: ${calibre_library:=/nonexistent}
pidfile=/var/run/${name}/${name}.pid
command=/usr/local/bin/calibre-server
command_interpreter=python2.7
required_dirs=${calibre_library}
start_cmd=${name}_start
start_precmd=""install -d -o ${calibre_user} -m755 /var/run/${name}""
calibre_start()
{
if [ ! -z ""${calibre_port}"" ]; then
command_args=""${command_args} --port=${calibre_port}""
fi
if [ ! -z ""${calibre_username}"" ]; then
command_args=""${command_args} --username=${calibre_username}""
fi
if [ ! -z ""${calibre_password}"" ]; then
command_args=""${command_args} --password=${calibre_password}""
fi
if [ ! -z ""${calibre_url_prefix}"" ]; then
command_args=""${command_args} --url_prefx=${calibre_url_prefix}""
fi
/usr/sbin/daemon -f -u ${calibre_user} -p ${pidfile} ${command} ${command_args} --with-library ${calibre_library}
}
run_rc_command ""$1""
"
"
by laster13»28 Oct 2014 10:33
hi
i have create a new jail jail with a new install of calibre. rc.conf and calibre (rc.d) are exactly as you but always the same error. perhaps some packages must to be installed.
thank for your help
"
"
by oldskater»28 Oct 2014 21:51
Hi laster13, I don't think there is much else i can suggest as you seem to have the exact same setup as me.
As a last attempt to help you here are the details of my jail, just in case that helps.
Jail Type - Full, built on - FreeBSD-i386-9.2-RELEASE-base.txz
"
"
by laster13»29 Oct 2014 10:35
hi
My jail is on FreeBSD-amd64-9.2-RELEASE-base.txz and nas4free embedded. Perhaps you are in full install nas4free?
thanks
"
"
by oldskater»29 Oct 2014 11:33
No I also have an embedded installation.
One more thought. In your post above you show this
Code: Select all

Code: Select all

nas4free: / # ls -l /mnt/pool1/Jail/calibre/mnt/K
total 1844
-rw-r--r--  1 root  wheel  854907 Oct 19 07:13 Alice's Adventures in Wonderland - Lewis Carroll.epub
-rw-r--r--  1 root  wheel  791008 Oct 19 07:15 The Adventures of Sherlock Holmes - Arthur Conan Doyle .epub
-rw-r--r--  1 root  wheel  116736 Oct 23 17:25 metadata.db
So this is what N4F can see in your calibre mount. But to be sure you need to enter the jail and then run ls on /mnt/K to double check what your jail actually has in that directory..
enter the calibre jail and run this, then let me know what the output is
Code: Select all

Code: Select all

root@Calibre:/ # ls /mnt/K
I'm sure it will be fine, but worth double checking
"
"
by laster13»30 Oct 2014 10:06
hi
Code: Select all

Code: Select all

root@calibre:/ # ls /mnt/K
Alice's Adventures in Wonderland - Lewis Carroll.epub           metadata.db
The Adventures of Sherlock Holmes - Arthur Conan Doyle .epub
root@calibre:/ #
thank
"
"
by laster13»18 Dec 2014 23:16
hi oldskater
Would you mind to repeat the installation to check that it works with the new dependances. i've written many howto, and I am not a beginner but I 'm unable to install calibre with your instructions. I would be very grateful if you could help me. Could you give also some indications about the way you configure your jail.
i would like to write a howto for french community
""http://forums.nas4free.org/viewforum.php?f=94""
many thanks
laster13
"
"
by laster13»19 Dec 2014 21:16
hi
i found
Code: Select all

Code: Select all

calibredb add /mnt/K/toadd/* --library-path /mnt/k
to add the Books to Calibre's Database
thanks for your help
"
"
by laster13»21 Dec 2014 14:14
hi
I wrote a french howto for installing calibre + COPS
""http://forums.nas4free.org/viewtopic.ph ... amp;t=7922""
"
Post Reply