You are not logged in.

#1 2023-09-01 18:38:00

aurel
Member
Registered: 2023-06-20
Posts: 24

Can't create a daemon with systemctl for a calibre server - Solved

Hi everyone, I hope you're having a great day !
I'm trying to have a calibre server running like a daemon so i don't have to start it manually each time I'm logging on. So I tried making it work by creating a .service file

## startup service
[Unit]
Description=calibre content server
After=network.target

[Service]
Type=simple
User=aurel
Group=aurel
ExecStart=/usr/bin/calibre-server --userdb /srv/calibre/users.sqlite --enable-auth

[Install]
WantedBy=multi-user.target

And i did

sudo systemctl daemon-reload
sudo systemctl enable calibre-server

But I have this error after the second command:

Failed to parse lines 'ow'

Anyone know why and how to fix it ?
Thanks

Last edited by aurel (2023-09-03 14:50:28)

Offline

#2 2023-09-01 18:55:44

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

I rebooted and the

sudo systemctl enable --now calibre-service

worked. But the server isn't launching. I don't know why.

$ systemctl status calibre-server.service
× calibre-server.service - calibre content server
     Loaded: loaded (/etc/systemd/system/calibre-server.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Fri 2023-09-01 20:51:38 CEST; 1min 0s ago
   Duration: 3ms
    Process: 485 ExecStart=/usr/bin/calibre-server --userdb /srv/calibre/users.sqlite --enable-auth (code=exited, sta
   Main PID: 485 (code=exited, status=216/GROUP)
        CPU: 1ms

Sep 01 20:51:38 archlinux systemd[1]: Started calibre content server.
Sep 01 20:51:38 archlinux (e-server)[485]: calibre-server.service: Failed to determine group credentials: No such pro
Sep 01 20:51:38 archlinux (e-server)[485]: calibre-server.service: Failed at step GROUP spawning /usr/bin/calibre-ser
Sep 01 20:51:38 archlinux systemd[1]: calibre-server.service: Main process exited, code=exited, status=216/GROUP
Sep 01 20:51:38 archlinux systemd[1]: calibre-server.service: Failed with result 'exit-code'.

Offline

#3 2023-09-01 19:25:02

ua4000
Member
Registered: 2015-10-14
Posts: 554

Re: Can't create a daemon with systemctl for a calibre server - Solved

Did the server run already fine without systemd? Could you started and used it by manual start ?
As same user aurel ?
You have enabled  --enable-auth - did you follow the guide to configure auth ?

Which was your reference for setup ? https://manual.calibre-ebook.com ?

Offline

#4 2023-09-01 19:29:20

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

Yes for all, i used the official manual to get the server running fine without systemd. And for the daemon i followed this site .
But I did some change, to the calibre-server bin location and i changed the command to suit what i wanted.

Last edited by aurel (2023-09-01 19:39:09)

Offline

#5 2023-09-01 19:44:19

ua4000
Member
Registered: 2015-10-14
Posts: 554

Re: Can't create a daemon with systemctl for a calibre server - Solved

"aurel" is a special user for the calibre server or your normal desktop user ?
Did you run some commands as root ? Are all files and folders for the calibre server owned by user aurel ?

Which user + command did you use exactly to start the service without systemd - and this setup worked, right ?

I'm trying to understand, if your calibre setup is broken, or if it's only the broken systemd start unit.

Last edited by ua4000 (2023-09-01 19:44:49)

Offline

#6 2023-09-01 19:52:17

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

aurel is the regular user for linux and also for calibre.
I'm always using aurel and never did command with root.
All the directories used by calibre, are read and write for anyone. And they are owned by aurel.

calibre-server --userdb /srv/calibre/users.sqlite --enable-auth

is the command I used when launching it mannualy and I had 0 problem.

Offline

#7 2023-09-01 19:54:05

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

When I say its a user for calibre, it's the username.

Offline

#8 2023-09-01 20:04:49

ua4000
Member
Registered: 2015-10-14
Posts: 554

Re: Can't create a daemon with systemctl for a calibre server - Solved

I would advise not to create a system wide unit, but only one for your user:
https://wiki.archlinux.org/title/Systemd/User

something like this, all inside your home and as your user, except one sudo:

# ~/.config/systemd/user/calibre-server.service
[Unit]
Description=calibre content server

[Service]
Type=forking
ExecStart=/usr/bin/calibre-servercalibre-server --userdb /srv/calibre/users.sqlite --enable-auth

[Install]
WantedBy=default.target

^^On the type simple or forking I'm unsure.

mkdir --parents ~/.config/systemd/user
nano  ~/.config/systemd/user/calibre-server.service
<<< put in the above unit and save it, or use your favorite editor

sudo loginctl enable-linger  aurel             # see wiki what this does

systemctl --user daemon-reload
systemctl --user cat      calibre-server.service
systemctl --user reenable calibre-server.service
systemctl --user restart  calibre-server.service
systemctl --user status   calibre-server.service -l

# added:
journalctl --user -u calibre-server.service

Last edited by ua4000 (2023-09-01 20:07:27)

Offline

#9 2023-09-01 20:22:03

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

[aurel@archlinux ~]$ mkdir -p .config/systemd/user
[aurel@archlinux ~]$ vim .config/systemd/user/calibre-server.service
[aurel@archlinux ~]$ sudo loginctl enable-linger aurel
[aurel@archlinux ~]$ systemctl --user daemon-reload
[aurel@archlinux ~]$ systemctl --user cat calibre-server.service
# /home/aurel/.config/systemd/user/calibre-server.service
# ~/.config/systemd/user/calibre-server.service
[Unit]
Description=calibre content server

[Service]
Type=forking
ExecStart=/usr/bin/calibre-servercalibre-server --userdb /srv/calibre/users.sqlite --enable-auth

[Install]
WantedBy=default.target
[aurel@archlinux ~]$ systemctl --user reenable calibre-server.service
Created symlink /home/aurel/.config/systemd/user/default.target.wants/calibre-server.service → /home/aurel/.config/sy
service.
[aurel@archlinux ~]$ systemctl --user restart calibre-server.service
Job for calibre-server.service failed because the control process exited with error code.
See "systemctl --user status calibre-server.service" and "journalctl --user -xeu calibre-server.service" for details.
[aurel@archlinux ~]$ systemctl --user status calibre-server.service
× calibre-server.service - calibre content server
     Loaded: loaded (/home/aurel/.config/systemd/user/calibre-server.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Fri 2023-09-01 22:12:59 CEST; 37s ago
    Process: 45017 ExecStart=/usr/bin/calibre-servercalibre-server --userdb /srv/calibre/users.sqlite --enable-auth (
        CPU: 1ms

Sep 01 22:12:59 archlinux systemd[909]: Starting calibre content server...
Sep 01 22:12:59 archlinux (e-server)[45017]: calibre-server.service: Failed to locate executable /usr/bin/calibre-ser
Sep 01 22:12:59 archlinux (e-server)[45017]: calibre-server.service: Failed at step EXEC spawning /usr/bin/calibre-se
Sep 01 22:12:59 archlinux systemd[909]: calibre-server.service: Control process exited, code=exited, status=203/EXEC
Sep 01 22:12:59 archlinux systemd[909]: calibre-server.service: Failed with result 'exit-code'.
Sep 01 22:12:59 archlinux systemd[909]: Failed to start calibre content server.
[aurel@archlinux ~]$ journalctl --user -xeu calibre-server.service
~
~
~
~
~
~
~
~
~
~
~
~
~
Sep 01 22:12:59 archlinux systemd[909]: Starting calibre content server...
░░ Subject: A start job for unit UNIT has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit UNIT has begun execution.
░░
░░ The job identifier is 193.
Sep 01 22:12:59 archlinux (e-server)[45017]: calibre-server.service: Failed to locate executable /usr/bin/calibre-ser
░░ Subject: Process /usr/bin/calibre-servercalibre-server could not be executed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The process /usr/bin/calibre-servercalibre-server could not be executed and failed.
░░
░░ The error number returned by this process is ERRNO.
Sep 01 22:12:59 archlinux (e-server)[45017]: calibre-server.service: Failed at step EXEC spawning /usr/bin/calibre-se
░░ Subject: Process /usr/bin/calibre-servercalibre-server could not be executed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The process /usr/bin/calibre-servercalibre-server could not be executed and failed.
░░
░░ The error number returned by this process is ERRNO.
Sep 01 22:12:59 archlinux systemd[909]: calibre-server.service: Control process exited, code=exited, status=203/EXEC
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit UNIT has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 203.
Sep 01 22:12:59 archlinux systemd[909]: calibre-server.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit UNIT has entered the 'failed' state with result 'exit-code'.
Sep 01 22:12:59 archlinux systemd[909]: Failed to start calibre content server.
░░ Subject: A start job for unit UNIT has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit UNIT has finished with a failure.
░░
░░ The job identifier is 193 and the job result is failed.

Offline

#10 2023-09-01 20:29:04

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

/usr/bin/calibre-server is the right path so idk why it's not working

Offline

#11 2023-09-01 20:38:42

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,489
Website

Re: Can't create a daemon with systemctl for a calibre server - Solved

ExecStart=/usr/bin/calibre-servercalibre-server

Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#12 2023-09-02 07:33:31

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

Thanks it works well !

Offline

#13 2023-09-02 11:47:02

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

I have a new problem after few minutes. The server just stops working.

[aurel@archlinux ~]$ systemctl --user status calibre-server.service
× calibre-server.service - calibre content server
     Loaded: loaded (/home/aurel/.config/systemd/user/calibre-server.service; enabled; preset: enabled)
     Active: failed (Result: timeout) since Sat 2023-09-02 13:44:46 CEST; 1min 44s ago
    Process: 536 ExecStart=/usr/bin/calibre-server --userdb /srv/calibre/users.sqlite --enable-auth (code=exited, status=0/SUCCESS)
        CPU: 599ms

Sep 02 13:44:19 archlinux calibre-server[536]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 02 13:44:19 archlinux calibre-server[536]:   File "/usr/lib/calibre/calibre/srv/code.py", line 354, in set_session_data
Sep 02 13:44:19 archlinux calibre-server[536]:     ctx.user_manager.set_session_data(rd.username, ud)
Sep 02 13:44:19 archlinux calibre-server[536]:   File "/usr/lib/calibre/calibre/srv/users.py", line 146, in set_session_data
Sep 02 13:44:19 archlinux calibre-server[536]:     c.execute('UPDATE users SET session_data=? WHERE name=?', (data, username))
Sep 02 13:44:19 archlinux calibre-server[536]:   File "src/cursor.c", line 240, in resetcursor
Sep 02 13:44:19 archlinux calibre-server[536]: apsw.ReadOnlyError: ReadOnlyError: attempt to write a readonly database
Sep 02 13:44:46 archlinux systemd[498]: calibre-server.service: start operation timed out. Terminating.
Sep 02 13:44:46 archlinux systemd[498]: calibre-server.service: Failed with result 'timeout'.
Sep 02 13:44:46 archlinux systemd[498]: Failed to start calibre content server.

Anyone know how to fix it ?

Offline

#14 2023-09-02 11:52:44

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

I checked and its read and write so i dont know why this doesnt work

Offline

#15 2023-09-02 12:12:26

ua4000
Member
Registered: 2015-10-14
Posts: 554

Re: Can't create a daemon with systemctl for a calibre server - Solved

The error is this:

ReadOnlyError: attempt to write a readonly database

I didn't read the install or any docu, but you use the program as normal user, check this path, is this the right place ?

--userdb /srv/calibre/users.sqlite 

I would expect to have all data in my home...
Nevertheless, you should see the same error, when starting the program manual without systemd.

Offline

#16 2023-09-02 15:34:02

aurel
Member
Registered: 2023-06-20
Posts: 24

Re: Can't create a daemon with systemctl for a calibre server - Solved

When i start it manually I don't have any error.

Offline

#17 2023-09-02 18:17:07

ua4000
Member
Registered: 2015-10-14
Posts: 554

Re: Can't create a daemon with systemctl for a calibre server - Solved

try with "Type=simple" instead of forking in the systemd unit.
This is also according to the example from https://manual.calibre-ebook.com/server … nux-system

Offline

#18 2025-03-06 17:45:38

asadeyemo
Member
Registered: 2025-03-06
Posts: 1

Re: Can't create a daemon with systemctl for a calibre server - Solved

Though, this is coming very late, but from my experience, the error looks like a syntax error.
"Failed to parse lines 'ow'"

You need to use "--now" to enable the service.
systemctl enable --now calibre-server

Last edited by asadeyemo (2025-03-06 17:48:58)

Offline

#19 2025-03-06 18:01:12

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,164

Re: Can't create a daemon with systemctl for a calibre server - Solved

Please don't bump solved 2 year old threads.

https://wiki.archlinux.org/title/Genera … bumping%22

Closing.

Offline

Board footer

Powered by FluxBB