Bug 28800

Summary: Library list at /cgi-bin/koha/admin/branches.pl appears empty
Product: Koha Reporter: Manos PETRIDIS <egpetridis>
Component: System AdministrationAssignee: Mason James <mtj>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: gmcharlt, jonathan.druart
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28811
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26893
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28926
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: kept back packages (image 1/6)
kept back packages (image 2/6)
kept back packages (image 3/6)
kept back packages (image 4/6)
kept back packages (image 5/6)
kept back packages (image 6/6)

Description Manos PETRIDIS 2021-08-02 17:16:52 UTC
I've noticed that the list of libraries comes up empty, although libraries have been defined.
When trying to create a new library with the same code as an existing one, the expected error message appears, however one is left unable to manage the existing libarries.

Video recording (54MB) available at 
https://emedgroupgr-my.sharepoint.com/:v:/g/personal/mpetridis_emedgroup_gr/EcSNYW0Y_YxPoWnr2wkohWMBFABMw6-X2wbVyvXcV0o0KA?e=Cvnchg
Comment 1 Owen Leonard 2021-08-02 18:24:06 UTC
Can you check the browser console to see if there are JavaScript errors on the page? It seems likely that an error is preventing the API from passing the information to the DataTable.
Comment 2 Manos PETRIDIS 2021-08-02 18:46:40 UTC
Errors in console are:

jquery-2.2.3.min_21.0501003.js:4 GET http://192.168.1.148:8081/api/v1/libraries?_page=1&_per_page=20&q=%5B%5D&_match=contains&_order_by=%2Bme.name 404 (Not Found)

send @ jquery-2.2.3.min_21.0501003.js:4
ajax @ jquery-2.2.3.min_21.0501003.js:4
sa @ datatables.min_21.0501003.js:75
lb @ datatables.min_21.0501003.js:75
P @ datatables.min_21.0501003.js:67
T @ datatables.min_21.0501003.js:69
ha @ datatables.min_21.0501003.js:86
e @ datatables.min_21.0501003.js:131
(anonymous) @ datatables.min_21.0501003.js:131
each @ jquery-2.2.3.min_21.0501003.js:2
each @ jquery-2.2.3.min_21.0501003.js:2
n @ datatables.min_21.0501003.js:121
$.fn.api @ datatables_21.0501003.js:774
(anonymous) @ branches.pl:29830
i @ jquery-2.2.3.min_21.0501003.js:2
fireWith @ jquery-2.2.3.min_21.0501003.js:2
ready @ jquery-2.2.3.min_21.0501003.js:2
J @ jquery-2.2.3.min_21.0501003.js:2

and 

datatables_21.0501003.js:515 DataTables warning: table id=libraries - Ajax error. For more information about this error, please see http://datatables.net/tn/7

jQuery.fn.dataTable.ext.errMode @ datatables_21.0501003.js:515
K @ datatables.min_21.0501003.js:113
error @ datatables.min_21.0501003.js:74
i @ jquery-2.2.3.min_21.0501003.js:2
fireWith @ jquery-2.2.3.min_21.0501003.js:2
z @ jquery-2.2.3.min_21.0501003.js:4
(anonymous) @ jquery-2.2.3.min_21.0501003.js:4
load (async)
send @ jquery-2.2.3.min_21.0501003.js:4
ajax @ jquery-2.2.3.min_21.0501003.js:4
sa @ datatables.min_21.0501003.js:75
lb @ datatables.min_21.0501003.js:75
P @ datatables.min_21.0501003.js:67
T @ datatables.min_21.0501003.js:69
ha @ datatables.min_21.0501003.js:86
e @ datatables.min_21.0501003.js:131
(anonymous) @ datatables.min_21.0501003.js:131
each @ jquery-2.2.3.min_21.0501003.js:2
each @ jquery-2.2.3.min_21.0501003.js:2
n @ datatables.min_21.0501003.js:121
$.fn.api @ datatables_21.0501003.js:774
(anonymous) @ branches.pl:29830
i @ jquery-2.2.3.min_21.0501003.js:2
fireWith @ jquery-2.2.3.min_21.0501003.js:2
ready @ jquery-2.2.3.min_21.0501003.js:2
J @ jquery-2.2.3.min_21.0501003.js:2
Comment 3 Jonathan Druart 2021-08-06 13:05:46 UTC
You are getting a 404 for /api/v1/libraries, that's not normal. How did you install Koha? Did you proceed to an upgrade recently? If so, from which version?

Try restarting memcached, apache2 then koha-common.
Comment 4 Manos PETRIDIS 2021-08-26 12:35:04 UTC
My koha installation is a plain Jane one, installed via packages on debian 9. The database though has been restored a couple of times, during migrations from previous installations.  

I have rebooted the server, yet the problem persists. 
Have since upgraded to the latest package version -was already at 21.05 though- however the library list still comes up empty. 

MP
Comment 5 Jonathan Druart 2021-08-26 13:31:30 UTC
What's your version of JSON::Validator? Are you using Debian 11?
Comment 6 Jonathan Druart 2021-08-26 13:33:52 UTC
See http://irc.koha-community.org/koha/2021-08-16#i_2371014
Comment 7 Manos PETRIDIS 2021-08-26 17:41:59 UTC
(In reply to Jonathan Druart from comment #5)
> What's your version of JSON::Validator? Are you using Debian 11?

JSON::Validator (0.97)	0.97
JSON (2.07)	2.90
Template::Plugin::JSON::Escape (0.02)	0.02

I'm using Debian 9, wasn't aware that koha is now compatible with later Debian releases.

Koha version:	21.05.02.000
OS version ('uname -a'):	Linux koha 4.9.0-16-amd64 #1 SMP Debian 4.9.272-2 (2021-07-19) x86_64
Perl interpreter:	/usr/bin/perl
Perl version:	5.024001
MySQL version:	mysql Ver 15.1 Distrib 10.4.19-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Apache version:	Server version: Apache/2.4.25 (Debian)
Comment 8 Jonathan Druart 2021-08-27 06:36:05 UTC
(In reply to Manos PETRIDIS from comment #7)
> (In reply to Jonathan Druart from comment #5)
> > What's your version of JSON::Validator? Are you using Debian 11?
> 
> JSON::Validator (0.97)	0.97

On Debian 9 you should have JSON::Validator 3.14.

Do you see the REST API doc if you hit /api/v1/.html?
Comment 9 Jonathan Druart 2021-08-27 06:41:43 UTC
(In reply to Jonathan Druart from comment #8)
> (In reply to Manos PETRIDIS from comment #7)
> > (In reply to Jonathan Druart from comment #5)
> > > What's your version of JSON::Validator? Are you using Debian 11?
> > 
> > JSON::Validator (0.97)	0.97
> 
> On Debian 9 you should have JSON::Validator 3.14.

Hum, forget that, I am not sure actually.

I am getting that in a dev env (ktd/stretch), but that does not make sense.
root@kohadevbox:koha(master|BISECTING)$ pmvers JSON::Validator
3.14
root@kohadevbox:koha(master|BISECTING)$ apt-cache policy libjson-validator-perl
libjson-validator-perl:
  Installed: 3.25+dfsg-1+koha3
  Candidate: 3.25+dfsg-1+koha3
  Version table:
 *** 3.25+dfsg-1+koha3 500
        500 http://debian.koha-community.org/koha-staging dev/main amd64 Packages
        100 /var/lib/dpkg/status
     0.92+dfsg-1 500
        500 http://httpredir.debian.org/debian stretch/main amd64 Packages
Comment 10 Manos PETRIDIS 2021-08-28 06:39:15 UTC
Created attachment 124202 [details]
kept back packages (image 1/6)
Comment 11 Manos PETRIDIS 2021-08-28 06:39:52 UTC
Created attachment 124203 [details]
kept back packages (image 2/6)
Comment 12 Manos PETRIDIS 2021-08-28 06:40:16 UTC
Created attachment 124204 [details]
kept back packages (image 3/6)
Comment 13 Manos PETRIDIS 2021-08-28 06:40:41 UTC
Created attachment 124205 [details]
kept back packages (image 4/6)
Comment 14 Manos PETRIDIS 2021-08-28 06:41:12 UTC
Created attachment 124206 [details]
kept back packages (image 5/6)
Comment 15 Manos PETRIDIS 2021-08-28 06:41:38 UTC
Created attachment 124207 [details]
kept back packages (image 6/6)
Comment 16 Manos PETRIDIS 2021-08-28 06:49:25 UTC
I wonder why version 0.97-1~kohadev1 was installed, and prefered over the current version. Upgrades were performed in command-line (apt-get upgrade) up till now. Upgrade via GUI fixed things and library list appears populated again. Thank you all for your help!

MP
Comment 17 Manos PETRIDIS 2021-08-28 14:27:19 UTC
Could it have anything to do with https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26893 ?
Comment 18 Jonathan Druart 2021-08-30 08:56:00 UTC
Mason, could you have a look at this? Do we need to do something? If 0.97 is not enough we need to update cpanfile then.

If I understand correctly, having ">= 0.97" is usually enough because D9 has 0.92 and 3.25 and so 3.25 is picked. But here, with 0.97 available things are broken.

(In reply to Manos PETRIDIS from comment #11)
> Created attachment 124203 [details]
> kept back packages (image 2/6)

So... where is coming from 0.97-1#kohadev1?
Comment 19 Jonathan Druart 2021-08-30 09:28:49 UTC
Manos, can you post the output of

% sudo grep -r koha /etc/apt/sources.list*
Comment 20 Mason James 2021-08-31 04:11:13 UTC
(In reply to Jonathan Druart from comment #18)
> Mason, could you have a look at this? Do we need to do something? If 0.97 is
> not enough we need to update cpanfile then.
> 
> If I understand correctly, having ">= 0.97" is usually enough because D9 has
> 0.92 and 3.25 and so 3.25 is picked. But here, with 0.97 available things
> are broken.
> 

hi Joubu
i've added a cpanfile patch to bump libjson-validator-perl to 3.14 (and friends)

 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28926
Comment 21 Mason James 2021-08-31 04:17:15 UTC
(In reply to Manos PETRIDIS from comment #16)
> I wonder why version 0.97-1~kohadev1 was installed, and prefered over the
> current version. Upgrades were performed in command-line (apt-get upgrade)
> up till now. Upgrade via GUI fixed things and library list appears populated
> again. Thank you all for your help!
> 
> MP

the problem seems to be fixed, all packages are now at the expected versions