View Single Post
Old 06-16-2017, 11:08 AM   #4
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,198
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
Quote:
Originally Posted by Jean-Christophe View Post
I have been lately experiencing a kind of mess up when operating the Calibre 2.55 content server from a xUbuntu computer. The problem seems to have arisen when I upgraded my operation system fom xubuntu 14.04LTS to xUbuntu 16.04.LTS.


I privately share my library to several users on a theme based approach using multiple command line invocations :

calibre-server --daemonize --username 'name-of-user1' -- restriction 'first restriction' --password 'user—1-passwd' --port '1025'
calibre-server --daemonize --username 'name-of-user2' -- restriction 'second restriction' --password 'user—2-passwd' --port '1026'

Folowing the OS upgrade, after login on, all my guests received an "Error 500" warning mentioning cherrypy .

Looking at /home/my-username/.config/calibre/server_error_log I found those following batches of lines :

Code:
[13/Jun/2017:21:04:43] ENGINE Bus STARTING
[13/Jun/2017:21:04:43] ENGINE Started monitor thread '_TimeoutMonitor'.
[13/Jun/2017:21:04:44] ENGINE Serving on http://0.0.0.0:1025
[13/Jun/2017:21:04:46] ENGINE Bus STARTED
[13/Jun/2017:21:07:43] ENGINE Bus STARTING
[13/Jun/2017:21:07:43] ENGINE Started monitor thread '_TimeoutMonitor'.
[13/Jun/2017:21:07:43] ENGINE Serving on http://0.0.0.0:1025
[13/Jun/2017:21:07:46] ENGINE Bus STARTED
[13/Jun/2017:21:08:17] HTTP Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 61, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 54, in do
    ans = func(*args, **kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 108, in authenticate
    self.secret)
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 364, in digest_auth
    ha1 = get_ha1(realm, auth.username)
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 57, in get_ha1
    return md5_hex('%s:%s:%s' % (username, realm, password))
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 30, in <lambda>
    md5_hex = lambda s: md5(ntob(s)).hexdigest()
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cpcompat.py", line 68, in ntob
    assert_native(n)
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cpcompat.py", line 111, in assert_native
    raise TypeError("n must be a native str (got %s)" % type(n).__name__)
TypeError: n must be a native str (got unicode)
The workaround I found was to disable the password request so my guest readers could enjoy the library again, but there is some concern about unsolicited visitors… I can fortunately veil the logs to ban suspicious incomers using iptables, but I hope for a code improvement to be incorporated in a next release.
The version you are using is the distro version. You want to uninstall the distro version and install the supported version. What Ubuntu did was to replaced the patched private version of cherrypy server with the the upstream version of cherrypy server which has a bug that has never been fixed--but was fixed in calibre's private version of cherrypy.

Quote:
Please do not use your distribution provided calibre package, as those are often buggy/outdated. Instead use the Binary install described below.
http://calibre-ebook.com/download_linux

Please be advised that calibre version 3 does not use cherrypy server.

bernie
gbm is offline   Reply With Quote