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

Idiot's guide #509

Open
Thomas-O opened this issue Dec 24, 2021 · 33 comments
Open

Idiot's guide #509

Thomas-O opened this issue Dec 24, 2021 · 33 comments

Comments

@Thomas-O
Copy link

Hello,

Earlier this year I used this guide to install COPS server on a Pi2 running DietPi OS v6.3 (Debian Buster). I was happily surprised that it worked given my complete lack of a how and why understanding.

I am attempting to repeat the process by installing COPS on to a Cubox-i with the latest DietPi. I believe the current version of DietPi is a stripped down version of Debian Bullseye 11.2. DietPi don't provide an off-the-shelf version for the Cubox-i so I used their bash script to convert Armbian to DietPi v7.9.

As previously, it is my plan to host the Calibre library on a usb stick. With the Calibre library copied from PC to Cubox-i via Syncthing. Syncthing is already installed on the CuBox-i/DietPi and working AOK. A ProFTP server is providing access from PC file browser to the stick and Calibre library.

Unfortunately things aren't going as smoothly with the COPS server installation. And being a technical buffoon I have no idea what's gone wrong or how to fix it. Though I suspect the issue might be something to do with the versions of Debian and PHP.

I'm sorry if this appeal is a bit vague, but I don't really have much of a clue what I'm doing. Any help and guidance much appreciated. Though if anyone has time to knock-up an updated step-by-step how-to guide for idiots like me then that would be wonderful and doubly appreciated.

Thanks

Thomas

@marioscube
Copy link

@Thomas-O

Please post the output of http:/cops/checkconfig.php

@Thomas-O
Copy link
Author

Thomas-O commented Dec 31, 2021

@Thomas-O

Please post the output of http:/cops/checkconfig.php

I hope you'll forgive me but I don't know how to copy all the text from nano. Is this enough?

require_once 'config.php';
require_once 'base.php';
$err = getURLParam('err', -1);
$full = getURLParam('full');
$error = NULL;
switch ($err) {
case 1 :
$error = 'Database error';
break;

The database error is most likely something that I've messed up. Could you take a look at the guide and tell me which bits I should be changing if my library is in mnt/cops/library and the ip address is 192.168.1.104. I thought it was simple enough that even a non-technical buffoon like me could get it right, but...

@marioscube
Copy link

@Thomas-O

Ah, I think we misunderstood one another / I was not clear enough with what I need to help you. ;-)

What I need is a screenshot from your browser of http:/cops/checkconfig.php

So probably of http://192.168.1.104/cops/checkconfig.php

I then can see:

  • What version PHP you have installed
  • if all php modules are isntalled
  • if config_local.php (copied from config_default.php) points to an existing calibre database and if this database is readable.

config_local.php should point to:

$config['calibre_directory'] = '/mnt/cops/library/';

@Thomas-O
Copy link
Author

Thomas-O commented Jan 1, 2022

The web address doesn't give me anything other than a report that it's unable to connect. Nothing seems to be working. So I've decided to wipe the slate and start again. New year and all that. This time making sure that I actually understand every step.

Q1. What can I do about the below when trying to apt get install php5-gd php5-sqlite php5-json php5-intl ?

Package php5-sqlite is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Unable to locate package php5-gd
E: Package 'php5-sqlite' has no installation candidate
E: Unable to locate package php5-json
E: Unable to locate package php5-intl

@marioscube
Copy link

@Thomas-O

The guide you used to setup COPS should still work wit one (1) exception: Debian Bullseye no longer uses PHP5 but uses PHP7.4.

So to install all the required PHP modules for COPS you should:

sudo apt-get install php7.4-gd php7.4-sqlite3 php7.4-json php7.4-intl php7.4-xml php7.4-mbstring php7.4-zip

Then follow the guide!

Please report back if it works or not. :-)

@Thomas-O
Copy link
Author

Thomas-O commented Jan 1, 2022

Please report back if it works or not. :-)

It's a nope. The PHP installed just fine but COPS still won't start. One thing I was uncertain about: the symbolic link to the library in the guide. Is it necessary, and if required shouldn't the line (sudo ln -s "/home/pi/Calibre Library" library) be different somehow? What with my library being in /mnt/cops/library and also if this is DietPi rather than Raspbian.

I made sure that /mnt/cops/library was 777 chmoded before I started. I don't know if that's a help, hindrance or no odds.

@marioscube
Copy link

in a terminal on the Cubox type:

systemctl status cops

what is the output?

@Thomas-O
Copy link
Author

Thomas-O commented Jan 1, 2022

root@DietPi:~# systemctl status cops
● cops.service - Cops Service
Loaded: loaded (/etc/systemd/system/cops.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2022-01-01 19:01:56 GMT; 293ms ago
Process: 2143 ExecStart=/usr/bin/php -S 192.168.1.104:8080 -t /var/www/cops/ (code=exited, status=203/EXEC)
Main PID: 2143 (code=exited, status=203/EXEC)
CPU: 6ms

@marioscube
Copy link

Ok service not started, thought so.

What is the output of:

find /usr/bin - name php*

@Thomas-O
Copy link
Author

Thomas-O commented Jan 1, 2022

root@DietPi:~# find /usr/bin - name php*
/usr/bin
/usr/bin/unmkinitramfs
/usr/bin/logger
/usr/bin/tempfile
/usr/bin/ping4
/usr/bin/screendump
/usr/bin/reset
/usr/bin/lsusb
/usr/bin/more
/usr/bin/shred
/usr/bin/nisdomainname
/usr/bin/hostname
/usr/bin/toe
/usr/bin/gpg-agent
/usr/bin/which
/usr/bin/pidof
/usr/bin/bzdiff
/usr/bin/readlink
/usr/bin/dpkg-split
/usr/bin/yes
/usr/bin/ping6
/usr/bin/pmap
/usr/bin/unzipsfx
/usr/bin/dash
/usr/bin/routel
/usr/bin/chown
/usr/bin/kwboot
/usr/bin/wget
/usr/bin/systemd-notify
/usr/bin/runcon
/usr/bin/sed
/usr/bin/cut
/usr/bin/ls
/usr/bin/sensible-editor
/usr/bin/savelog
/usr/bin/deallocvt
/usr/bin/zfgrep
/usr/bin/addpart
/usr/bin/crontab
/usr/bin/systemd-path
/usr/bin/sha256sum
/usr/bin/dpkg-statoverride
/usr/bin/choom
/usr/bin/top
/usr/bin/timedatectl
/usr/bin/bzfgrep
/usr/bin/w
/usr/bin/truncate
/usr/bin/systemd-cgls
/usr/bin/ss
/usr/bin/bzip2
/usr/bin/logname
/usr/bin/join
/usr/bin/systemd-tty-ask-password-agent
/usr/bin/bunzip2
/usr/bin/true
/usr/bin/sleep
/usr/bin/ipcs
/usr/bin/apt-key
/usr/bin/nsenter
/usr/bin/systemd-hwdb
/usr/bin/cvtsudoers
/usr/bin/pstree
/usr/bin/login
/usr/bin/mount
/usr/bin/tzselect
/usr/bin/zipgrep
/usr/bin/gpgconf
/usr/bin/ipcrm
/usr/bin/dpkg-deb
/usr/bin/busctl
/usr/bin/hostnamectl
/usr/bin/head
/usr/bin/date
/usr/bin/rtstat
/usr/bin/7zr
/usr/bin/sum
/usr/bin/kbdinfo
/usr/bin/sensible-pager
/usr/bin/sort
/usr/bin/chgrp
/usr/bin/zdiff
/usr/bin/lsattr
/usr/bin/faillog
/usr/bin/partx
/usr/bin/peekfd
/usr/bin/tabs
/usr/bin/systemd-delta
/usr/bin/perf
/usr/bin/dropbearconvert
/usr/bin/debconf-show
/usr/bin/select-editor
/usr/bin/sudoreplay
/usr/bin/iconv
/usr/bin/fgconsole
/usr/bin/install
/usr/bin/debconf-escape
/usr/bin/watch
/usr/bin/tac
/usr/bin/debconf-apt-progress
/usr/bin/curl
/usr/bin/linux32
/usr/bin/tr
/usr/bin/lsns
/usr/bin/openssl
/usr/bin/gpgtar
/usr/bin/infocmp
/usr/bin/sudoedit
/usr/bin/bashbug
/usr/bin/whoami
/usr/bin/bzcmp
/usr/bin/bzmore
/usr/bin/gzexe
/usr/bin/pgrep
/usr/bin/sha1sum
/usr/bin/gunzip
/usr/bin/expiry
/usr/bin/systemd-machine-id-setup
/usr/bin/fgrep
/usr/bin/debconf-copydb
/usr/bin/clear_console
/usr/bin/basename
/usr/bin/comm
/usr/bin/dpkg-divert
/usr/bin/ckbcomp
/usr/bin/mkdir
/usr/bin/gpgparsemail
/usr/bin/rmdir
/usr/bin/pidwait
/usr/bin/rdma
/usr/bin/locale
/usr/bin/cksum
/usr/bin/sudo
/usr/bin/run-parts
/usr/bin/seq
/usr/bin/bzless
/usr/bin/delpart
/usr/bin/xargs
/usr/bin/psfgettable
/usr/bin/tty
/usr/bin/bzexe
/usr/bin/usb-devices
/usr/bin/mktemp
/usr/bin/mkenvimage
/usr/bin/scriptreplay
/usr/bin/utmpdump
/usr/bin/chmod
/usr/bin/dbclient
/usr/bin/bzgrep
/usr/bin/bzcat
/usr/bin/systemd-inhibit
/usr/bin/usbhid-dump
/usr/bin/setfont
/usr/bin/uname
/usr/bin/expr
/usr/bin/routef
/usr/bin/findmnt
/usr/bin/systemd-analyze
/usr/bin/last
/usr/bin/sha512sum
/usr/bin/znew
/usr/bin/md5sum
/usr/bin/lcf
/usr/bin/systemd-cgtop
/usr/bin/zcmp
/usr/bin/sync
/usr/bin/dh_bash-completion
/usr/bin/setsid
/usr/bin/gpg-zip
/usr/bin/nawk
/usr/bin/pathchk
/usr/bin/zcat
/usr/bin/lsinitramfs
/usr/bin/setkeycodes
/usr/bin/renice
/usr/bin/lspgpot
/usr/bin/systemd-sysusers
/usr/bin/gpgv
/usr/bin/expand
/usr/bin/linux-update-symlinks
/usr/bin/touch
/usr/bin/prlimit
/usr/bin/dirmngr
/usr/bin/unzip
/usr/bin/echo
/usr/bin/systemd-detect-virt
/usr/bin/shuf
/usr/bin/dirmngr-client
/usr/bin/egrep
/usr/bin/whiptail
/usr/bin/dropbearkey
/usr/bin/systemd-stdio-bridge
/usr/bin/splitfont
/usr/bin/ischroot
/usr/bin/newgrp
/usr/bin/vdir
/usr/bin/gpgsm
/usr/bin/ucfq
/usr/bin/sh
/usr/bin/gpgcompose
/usr/bin/numfmt
/usr/bin/flock
/usr/bin/pstree.x11
/usr/bin/slabtop
/usr/bin/systemd-mount
/usr/bin/hostid
/usr/bin/timeout
/usr/bin/setterm
/usr/bin/setleds
/usr/bin/cpio
/usr/bin/tee
/usr/bin/csplit
/usr/bin/free
/usr/bin/stat
/usr/bin/chcon
/usr/bin/perl
/usr/bin/systemd-umount
/usr/bin/linux-check-removal
/usr/bin/pico
/usr/bin/lastb
/usr/bin/udevadm
/usr/bin/mknod
/usr/bin/dd
/usr/bin/zgrep
/usr/bin/systemd-id128
/usr/bin/pslog
/usr/bin/showconsolefont
/usr/bin/ctstat
/usr/bin/basenc
/usr/bin/uniq
/usr/bin/systemd-ask-password
/usr/bin/link
/usr/bin/namei
/usr/bin/tsort
/usr/bin/zdump
/usr/bin/apt-config
/usr/bin/chvt
/usr/bin/find
/usr/bin/loadunimap
/usr/bin/test
/usr/bin/uncompress
/usr/bin/ptx
/usr/bin/id
/usr/bin/wc
/usr/bin/du
/usr/bin/bzip2recover
/usr/bin/apt-cache
/usr/bin/tail
/usr/bin/nice
/usr/bin/domainname
/usr/bin/sg
/usr/bin/psfaddtable
/usr/bin/split
/usr/bin/prtstat
/usr/bin/linux-version
/usr/bin/rgrep
/usr/bin/df
/usr/bin/killall
/usr/bin/b2sum
/usr/bin/unshare
/usr/bin/psfstriptable
/usr/bin/dirname
/usr/bin/mkfifo
/usr/bin/funzip
/usr/bin/kill
/usr/bin/gpg-connect-agent
/usr/bin/tar
/usr/bin/sha224sum
/usr/bin/nohup
/usr/bin/dnsdomainname
/usr/bin/ps
/usr/bin/deb-systemd-helper
/usr/bin/zless
/usr/bin/systemd-socket-activate
/usr/bin/taskset
/usr/bin/pwd
/usr/bin/setpriv
/usr/bin/bash
/usr/bin/loadkeys
/usr/bin/debconf-set-selections
/usr/bin/loginctl
/usr/bin/codepage
/usr/bin/rnano
/usr/bin/zipinfo
/usr/bin/chattr
/usr/bin/editor
/usr/bin/script
/usr/bin/fallocate
/usr/bin/snice
/usr/bin/networkctl
/usr/bin/nl
/usr/bin/wdctl
/usr/bin/mksunxiboot
/usr/bin/ip
/usr/bin/chfn
/usr/bin/apt-get
/usr/bin/unicode_stop
/usr/bin/showkey
/usr/bin/md5sum.textutils
/usr/bin/journalctl
/usr/bin/psfxtable
/usr/bin/umount
/usr/bin/debconf
/usr/bin/apt-cdrom
/usr/bin/bzegrep
/usr/bin/c_rehash
/usr/bin/fmt
/usr/bin/perl5.32.1
/usr/bin/tload
/usr/bin/grep
/usr/bin/zmore
/usr/bin/setvtrgb
/usr/bin/getopt
/usr/bin/mt-gnu
/usr/bin/unicode_start
/usr/bin/mountpoint
/usr/bin/arch
/usr/bin/lscpu
/usr/bin/base64
/usr/bin/awk
/usr/bin/pager
/usr/bin/vmstat
/usr/bin/systemd-tmpfiles
/usr/bin/mapscrn
/usr/bin/mt
/usr/bin/htop
/usr/bin/watchgnupg
/usr/bin/ping
/usr/bin/nstat
/usr/bin/kbd_mode
/usr/bin/printf
/usr/bin/dmesg
/usr/bin/dumpkeys
/usr/bin/dpkg-query
/usr/bin/stdbuf
/usr/bin/groups
/usr/bin/resolvectl
/usr/bin/mv
/usr/bin/systemd
/usr/bin/zegrep
/usr/bin/tic
/usr/bin/lnstat
/usr/bin/pinentry-curses
/usr/bin/sensible-browser
/usr/bin/getent
/usr/bin/chrt
/usr/bin/bootctl
/usr/bin/rm
/usr/bin/gzip
/usr/bin/captoinfo
/usr/bin/migrate-pubring-from-classic-gpg
/usr/bin/users
/usr/bin/dpkg-trigger
/usr/bin/printenv
/usr/bin/uptime
/usr/bin/ionice
/usr/bin/dpkg-realpath
/usr/bin/systemd-cat
/usr/bin/tput
/usr/bin/update-alternatives
/usr/bin/gpgsplit
/usr/bin/apt
/usr/bin/su
/usr/bin/diff
/usr/bin/lslocks
/usr/bin/ipcmk
/usr/bin/sdiff
/usr/bin/ucf
/usr/bin/resizepart
/usr/bin/env
/usr/bin/factor
/usr/bin/[
/usr/bin/pinentry
/usr/bin/ypdomainname
/usr/bin/paste
/usr/bin/usbreset
/usr/bin/fold
/usr/bin/cmp
/usr/bin/kmod
/usr/bin/systemd-escape
/usr/bin/setlogcons
/usr/bin/nproc
/usr/bin/mk_modmap
/usr/bin/kernel-install
/usr/bin/apt-mark
/usr/bin/infotocap
/usr/bin/lsmem
/usr/bin/setupcon
/usr/bin/gpg-wks-server
/usr/bin/setarch
/usr/bin/dir
/usr/bin/gpg
/usr/bin/ldd
/usr/bin/pldd
/usr/bin/debconf-communicate
/usr/bin/who
/usr/bin/deb-systemd-invoke
/usr/bin/mcookie
/usr/bin/od
/usr/bin/dumpimage
/usr/bin/localedef
/usr/bin/diff3
/usr/bin/getkeycodes
/usr/bin/mkimage
/usr/bin/p7zip
/usr/bin/tset
/usr/bin/systemd-resolve
/usr/bin/pr
/usr/bin/ln
/usr/bin/systemctl
/usr/bin/dpkg
/usr/bin/rbash
/usr/bin/gpasswd
/usr/bin/unexpand
/usr/bin/pinky
/usr/bin/lastlog
/usr/bin/unlink
/usr/bin/realpath
/usr/bin/lsblk
/usr/bin/passwd
/usr/bin/localectl
/usr/bin/mawk
/usr/bin/cat
/usr/bin/cp
/usr/bin/pkill
/usr/bin/pwdx
/usr/bin/false
/usr/bin/lslogins
/usr/bin/catchsegv
/usr/bin/whereis
/usr/bin/scriptlive
/usr/bin/linux64
/usr/bin/rev
/usr/bin/systemd-run
/usr/bin/setmetamode
/usr/bin/dpkg-maintscript-helper
/usr/bin/openvt
/usr/bin/lsipc
/usr/bin/fincore
/usr/bin/nano
/usr/bin/stty
/usr/bin/mesg
/usr/bin/getconf
/usr/bin/zforce
/usr/bin/clear
/usr/bin/fuser
/usr/bin/skill
/usr/bin/sha384sum
/usr/bin/kbxutil
/usr/bin/lsmod
/usr/bin/chsh
/usr/bin/wall
/usr/bin/chage
/usr/bin/base32
/usr/bin/dircolors
/usr/bin/ucfr
find: ‘-’: No such file or directory
find: ‘name’: No such file or directory
find: ‘php*’: No such file or directory

@marioscube
Copy link

My mistake. It should be

find /usr/bin -name php*

witout the “ “ between - and name.

However, where is php or php7.

It needs to be installed (not in th guide). Try:

sudo apt-get install php7.4

@Thomas-O
Copy link
Author

Thomas-O commented Jan 2, 2022

Bingo!

Aside from Warning: Could not load Apache 2.4 maintainer script helper, everything is working and tickety-boo.

Thank you so much for your patient help.

@Thomas-O
Copy link
Author

Thomas-O commented Jan 14, 2022

Really sorry to be a bother again, but while COPS seemed to working fine it's not possible to open ePubs downloaded with either my Kobo Aura One or Android phone. While the Kobo doesn't provide any information, the ReadEra app on the phone reports a decoding error.

All is not entirely lost as it's possible to download ePubs from COPS to a relative's laptop via a web browser and then open and read the ePubs with their copy of Calibre. Though this isn't much help with my Kobo Aura One.

COPS was / is my best hope to bypass the horribly unreliable USB connection between my PC and Kobo e-reader - which is apparently a common problem - so if you have any ideas and solutions they'd be gratefully received. And once again, I'm sorry to be such a nuisance.

@marioscube
Copy link

marioscube commented Jan 14, 2022

@Thomas-O

For Kobo COPS needs a setting in config_local.php

    /*
     * use URL rewriting for downloading of ebook in HTML catalog
     * See Github wiki for more information
     *  1 : enable
     *  0 : disable
     */
    $config['cops_use_url_rewriting'] = '1';

cops_url_rewriting must be set to 1.

No problem, I'm here to help if I can.

@Thomas-O
Copy link
Author

cops_url_rewriting must be set to 1.

Did you mean config_default.php? I can't find the option in config_local.php.

@marioscube
Copy link

Copy

/*
 * use URL rewriting for downloading of ebook in HTML catalog
 * See Github wiki for more information
 *  1 : enable
 *  0 : disable
 */
$config['cops_use_url_rewriting'] = '1';

into config_local.php

@Thomas-O
Copy link
Author

Sorry for being a bit dim. OK, I've copied the above to /var/www/cops/config_local.php. Though now when I try to download I see a 404 report with "The requested resource......was not found on this server."

@marioscube
Copy link

Let us try this:

in the terminal type: sudo a2enmod rewrite then sudo systemctl restart apache2

does this help?

@Thomas-O
Copy link
Author

sudo: a2enmod: command not found

DietPi is using Nginx as the webserver. And I don't think Apache is installed. When I tried Issue apache2 -v to check if Apache is installed the only thing I got was -bash: Issue: command not found.

Could this be the problem?

I can install Apache but DietPi will demand that I remove Nginx first.

@marioscube
Copy link

My mistake, I forgot you run cops on php, not on a web server like apache. Apache is not installed.

Then my suggested commands will not work.

I (quickly) tested COPS on php only with my setup and it worked (downloading a book from my Kobo glo HD), but I have apache installed and I do not know if that helps or not.

On monday I can test your setup in a VM on another machine (PC) that I cannot access now.
Maybe I can confirm your error.

As an afterthought. Do you still use the symbolic link or do you point COPS directly to the calibre library? And is the calibre library (for testing only) 777?

@Thomas-O
Copy link
Author

Thomas-O commented Jan 15, 2022

The calibre library on the SBC /DietPi is 777. And I've set both ends of Syncthing to ignore permissions.

Q. Does the original on my PC also need to be 777?

Not sure about the link or the direct pointing? I didn't understand the symbolic link thing but followed the guide as directed by entering sudo ln -s "/home/pi/Calibre Library" library and adding the following to var/www/cops/config_local.php

 <?php
    if (!isset($config))
        $config = array();
    $config['calibre_directory'] = '/mnt/cops/calibre/';
    $config['cops_title_default'] = "COPS";
$config['cops_use_url_rewriting'] = "0";

Should add that I've installed Apache but that didn't help.

Also, I then toggled the url rewriting line between 1 an 0.

0 = I can download to a desktop and add to a 3rd party copy of calibre but the Kobo is still kaput.

1 = a return to the report that "The requested resource......was not found on this server."

One last thing, the Kobo is happy downloading from my PC's Calibre content server. At least when I direct the e-reader's web browser to the mobile site. I'm lucky to have that as a fall back but it's nowhere near as easy to navigate as COPS, nor is it as convenient.

@marioscube
Copy link

A - I do not think that the original calibre library on your PC needs to be 777.

Your config_local.php looks OK.

The problem is that the Kobo (mine does) needs $config['cops_use_url_rewriting'] = '1';

But for you this gives an error I can not reproduce on my apache COPS setup. As I said hopefully on monday I can, maybe even by installing DietPi on an old Pi. What Pi do you use?

And as just a question: why not use the standard raspbian (raspiOS) distribution? Any specific preferences?

@Thomas-O
Copy link
Author

Thomas-O commented Jan 15, 2022

Unfortunately I can't use raspbian because the SBC is a Cubox-i. And DietPi with its preconfigured install and config options is a great help to those like me who aren't that technical.

As much as I like playing around with this stuff, I find my brain isn't naturally inclined towards this arena. I'm self-employed as an artist/craft bloke and very much on the artistic spectrum. While I keep plugging away and picking up bits and bobs here and there, very little of this makes intuitive sense. For me DietPi is a useful bridge between the befuddling technological and the quotidian utility.

@marioscube
Copy link

Do you use your Cubox-I for any other projects beside COPS that use nginx?

While I have found a way that should make it possible to use your Kobo with your setup of COPS it’s just beyond my coding capabilities.

COPS can also work with nginx, but I’m a Apache man and have never really understood how to setup nginx.

For COPS to work with your DietPi setup you probably need to uninstall nginx and install apache2. Then you need to disable the service you installed to start php as a webserver.

On Monday I will try to make a short “idiots guide” on how to install COPS and Apache on DietPi that works with Kobo.

I like to see myself as an advanced user who likes to help out and fix things.

@Thomas-O
Copy link
Author

Thomas-O commented Jan 17, 2022

Other than COPS + syncthing, the only other things on the Cubox-i are Transmission and ProFTP.

Today I've been able to borrow a powered usb hub so it's been possible to point my PC's file browser at the Kobo's storage. Where I can see that the Kobo is actually downloading the ePub files from COPS; it just can't open them.

I had thought it might be a corruption problem or a Syncthing issue. So I reformatted the flash drive with the synchronised library. Then re-synchronised the calibre library. While I have only a very sketchy understanding of Syncthing, permissions etc I really can't see an issue.

I can access the flash drive on the Cubox-i via my PC's file browser and open any ePub with desktop e-book viewers. The same when I connect the flash drive directly to my PC.

I can also use the PC to side-load the files from the flash drive to the KOBO and then open them on the e-reader without problem. And I can add with Calibre when connected to the PC with a usb or via the content server. The only thing I can't do is successfully transfer them from COPS to the Kobo via the e-reader's web browser.

@marioscube
Copy link

@Thomas-O

As promised I made a shortened "idiots-guide" for setting up COPS with the build in PHPwebserver on DietPi.
This is based on link

For me this worked out of the box (after I fixed a stupid mistake in config_local.php) in a virtual machine (VirtualBox) on a Linux PC.

0 - if not root, then add sudo to the front of the (bold) lines.

1 - Download COPS
cd /var/www/
mkdir cops
cd cops
wget https://github.com/seblucas/cops/releases/download/1.1.3/cops-1.1.3.zip
unzip cops-1.1.3.zip

2 - Calibre Library
copy the calibre library to /mnt/cops/library

3 - setup config_local.php
nano /var/www/cops/config_local.php

<?php

 if (!isset($config)) {
     $config = array();
 }

 $config['calibre_directory'] = '/mnt/cops/library/';

 $config['cops_title_default'] = "COPS";

 $config['cops_use_url_rewriting'] = "0";

4 - install PHP and additional modules
apt install php7.4
apt install php7.4-xml php7.4-mbstring php7.4-zip php7.4-gd php7.4-sqlite3 php7.4-json php7.4-intl

5 - test
php -S 192.168.1.104:8080 -t /var/www/cops/
(you can exit this with ^C)

In a webbrowser on a PC
http://192.168.1.104:8080

You should see COPS and are able to download.

Now try the same on a kobo. For me it worked
 - Kobo Glo HD
 - Kobo software version 4.30.18838 (10/30/21)
 
If it works (or not) ^C

6 - setup a service
nano /etc/systemd/system/cops.service

[Unit]
Description=Cops Service
After=network.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/bin/php -S 192.168.50.1:8080 -t /var/www/cops/
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target

Then test the cops.service
**systemctl start cops**
**systemctl status cops**

if it works	
**systemctl enable cops.service**

Let me know if this works.
If not I can test with an older Raspberry Pi.

@Thomas-O
Copy link
Author

Wow. Thanks for doing all this. Way beyond the call of duty. I will give it a whirl tomorrow night and report back.

@marioscube
Copy link

marioscube commented Jan 17, 2022

The strange thing is that my “solution” should not work with a Kobo, but it still seems to work.
Maybe it’s a feature of newer Kobo firmware.
On what firmware version is your Kobo?

Or there is something wrong with your php setup.
Did you install (apt install php7.4) the needed version of php?

@Thomas-O
Copy link
Author

Firmware: v4.30 10/30/21

php: 7.4.25-1+deb11u1

@marioscube
Copy link

marioscube commented Jan 18, 2022

Kobo firmware and PHP version are OK. The same as I have.

Do you have other ebook readers installed on android to test with?
I'm on iOS myself, but maybe there is an app on android and iOS to test with.

Installng dietPi on a Raspberry Pi 1B (the oldest version).

This gives slow a new meaning...............

Then on to testing with COPS, and that's fun!

Tested this new setup:

  • browser = OK
  • Kobo Glo HD = OK (should not, but it works)
  • OPDS = OK
  • PocketBook (OPDS) = OK

@marioscube
Copy link

@Thomas-O

I'm starting to think that the only (3) remaining possibilities why it does not work for you are:

  • Kobo aura does not work with COPS. But android apps also don't work, so I do not think this is the problem.
  • some error in your setup. Possible, but not probable if you followed my "guide". Copy the contents of config_local.php exactly! (I did go wrong there once......... effects were not nice to debug)
  • the place of the calibre library on a USB stick. How do you mount the stick? Perhaps, even though access is 777, dietpi changes it in some way.
    For testing only: copy the calibre library from the stick to inside the /var/www/cops library and point COPS to /var/www/cops/library/ in config_local.php. then try again. Will test this myself tomorrow, have to find a suitable USB stick).

@Thomas-O
Copy link
Author

Thomas-O commented Jan 19, 2022

It worked!

However, not on the Cubox-i. I've found the old Raspberry Pi2 and stepped through the idiot guide and everything is working as it should. I used the DietPi image with the Raspbian repository for this latest attempt. Which is perhaps why I needed to add software-properties-common and a repository before I could install php7.4.

After everything was installed and started I can access via and download to the Kobo, phone, tablet and PC. And importantly, I can also open and read the files.

My suspicion is that the problem I've faced with the Cubox-i is rooted in the Armbian image I used as the base for DietPi. DietPi don't make a version for the Cubox-i. However, they do have a script which will convert anything Debian to DietPi.

The conversion from Armbian to DietPi seemed to go without a hitch, but my guess is that either the original or the conversion has something vital missing or amiss. And there's next to no chance of me figuring out what's awry. Not in a month of Sundays. So I've decided to cut my losses and stick with the Pi2. Maybe using the Cubox-i as a very expensive paperweight. Or something to throw at next door's cat: the damned thing howling and shrieking at 2am every bloody night.

The only thing left to say is to thank you for your help, your guidance and your patience. And I hope that this dimwit hasn't been too great a nuisance.

If at first you don't succeed, try, try again. Then quit. There's no point in being a damn fool about it.
W. C. Fields

@marioscube
Copy link

Who am I to disagree with W.C. Fields!

When I installed dietpi on my Raspberry Pi 1b I did not need to add software-properties-common and a repository before I could install php7.4. But if it works, why complain!

Can't you use your Cubox-i with it's "original OS" (if such a thing exists?) or try to install a debian armhf image? Then you might add some value to the Cubox-i. And please do not hurt cats i the process ;-) .

I liked to spend a few hours with helping you and at the same time setting up dietpi and reviving my ancient Raspberry Pi.

If you have more questions about COPS, do not hesitate to ask!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants