janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
13k stars 1.39k forks source link

calibre-web just deleted my whole library - in excess of 3k books #432

Closed mnott closed 6 years ago

mnott commented 6 years ago

I've just had a major issue with calibre-web. I'll attach the log below. Long story short, I added a book to the library using Calibre (not Calibre-Web), and that did not work; I then looked up the book in Calibre-Web (which goes to the same database), located the book - which had only metadata, went to edit, and then hit delete.

It erased every single book and the library database.

Here's the syslog from the linux server running calibre-web.

Jan 10 19:35:13 library python[1259]: WARNING:tornado.access:404 GET /cover/ (192.168.1.223) 3.16ms Jan 10 19:35:50 library python[1259]: [2018-01-10 19:35:50,188] ERROR in app: Exception on /delete/3892/ [GET] Jan 10 19:35:50 library python[1259]: Traceback (most recent call last): Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1982, in wsgi_app Jan 10 19:35:50 library python[1259]: response = self.full_dispatch_request() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1614, in full_dispatch_request Jan 10 19:35:50 library python[1259]: rv = self.handle_user_exception(e) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1517, in handle_user_exception Jan 10 19:35:50 library python[1259]: reraise(exc_type, exc_value, tb) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1612, in full_dispatch_request Jan 10 19:35:50 library python[1259]: rv = self.dispatch_request() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1598, in dispatch_request Jan 10 19:35:50 library python[1259]: return self.view_functionsrule.endpoint Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask_login/utils.py", line 261, in decorated_view Jan 10 19:35:50 library python[1259]: return func(*args, kwargs) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/cps/web.py", line 1497, in delete_book Jan 10 19:35:50 library python[1259]: modify_database_object([u''], book.authors, db.Authors, db.session, 'author') Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/cps/web.py", line 589, in modify_database_object Jan 10 19:35:50 library python[1259]: if len(del_element.books) == 0: Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/attributes.py", line 242, in get Jan 10 19:35:50 library python[1259]: return self.impl.get(instancestate(instance), dict) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/attributes.py", line 603, in get Jan 10 19:35:50 library python[1259]: value = self.callable_(state, passive) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/strategies.py", line 623, in _load_for_state Jan 10 19:35:50 library python[1259]: return self._emit_lazyload(session, state, ident_key, passive) Jan 10 19:35:50 library python[1259]: File "", line 1, in Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/strategies.py", line 747, in _emit_lazyload Jan 10 19:35:50 library python[1259]: result = q(session).params(params).all() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/ext/baked.py", line 434, in all Jan 10 19:35:50 library python[1259]: return list(self) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/ext/baked.py", line 336, in iter Jan 10 19:35:50 library python[1259]: self.session._autoflush() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 1438, in _autoflush Jan 10 19:35:50 library python[1259]: util.raise_from_cause(e) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/util/compat.py", line 203, in raise_from_cause Jan 10 19:35:50 library python[1259]: reraise(type(exception), exception, tb=exc_tb, cause=cause) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 1428, in _autoflush Jan 10 19:35:50 library python[1259]: self.flush() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 2237, in flush Jan 10 19:35:50 library python[1259]: self._flush(objects) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 2363, in _flush Jan 10 19:35:50 library python[1259]: transaction.rollback(_capture_exception=True) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/util/langhelpers.py", line 66, in exit Jan 10 19:35:50 library python[1259]: compat.reraise(exc_type, exc_value, exc_tb) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 2327, in _flush Jan 10 19:35:50 library python[1259]: flush_context.execute() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/unitofwork.py", line 391, in execute Jan 10 19:35:50 library python[1259]: rec.execute(self) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/unitofwork.py", line 507, in execute Jan 10 19:35:50 library python[1259]: self.dependency_processor.process_saves(uow, states) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/dependency.py", line 1081, in process_saves Jan 10 19:35:50 library python[1259]: secondary_update, secondary_delete) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/dependency.py", line 1094, in _run_crud Jan 10 19:35:50 library python[1259]: result = connection.execute(statement, secondary_delete) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/engine/base.py", line 948, in execute Jan 10 19:35:50 library python[1259]: return meth(self, multiparams, params) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection Jan 10 19:35:50 library python[1259]: return connection._execute_clauseelement(self, multiparams, params) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement Jan 10 19:35:50 library python[1259]: compiled_sql, distilled_params Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/engine/base.py", line 1200, in _execute_context Jan 10 19:35:50 library python[1259]: context) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception Jan 10 19:35:50 library python[1259]: exc_info Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/util/compat.py", line 203, in raise_from_cause Jan 10 19:35:50 library python[1259]: reraise(type(exception), exception, tb=exc_tb, cause=cause) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/engine/base.py", line 1193, in _execute_context Jan 10 19:35:50 library python[1259]: context) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/engine/default.py", line 507, in do_execute Jan 10 19:35:50 library python[1259]: cursor.execute(statement, parameters) Jan 10 19:35:50 library python[1259]: OperationalError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (sqlite3.OperationalError) attempt to write a readonly database [SQL: u'DELETE FROM books_authors_link WHERE books_authors_link.book = ? AND books_authors_link.author = ?'] [parameters: (3892, 1585)] (Background on this error at: http://sqlalche.me/e/e3q8) Jan 10 19:35:50 library python[1259]: ERROR:tornado.access:500 GET /delete/3892/ (192.168.1.223) 27812.87ms Jan 10 19:35:50 library python[1259]: [2018-01-10 19:35:50,250] ERROR in app: Exception on /delete/3892/ [GET] Jan 10 19:35:50 library python[1259]: Traceback (most recent call last): Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1982, in wsgi_app Jan 10 19:35:50 library python[1259]: response = self.full_dispatch_request() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1614, in full_dispatch_request Jan 10 19:35:50 library python[1259]: rv = self.handle_user_exception(e) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1517, in handle_user_exception Jan 10 19:35:50 library python[1259]: reraise(exc_type, exc_value, tb) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1612, in full_dispatch_request Jan 10 19:35:50 library python[1259]: rv = self.dispatch_request() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1598, in dispatch_request Jan 10 19:35:50 library python[1259]: return self.view_functionsrule.endpoint Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask_login/utils.py", line 261, in decorated_view Jan 10 19:35:50 library python[1259]: return func(args, kwargs) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/cps/web.py", line 1483, in delete_book Jan 10 19:35:50 library python[1259]: book = db.session.query(db.Books).filter(db.Books.id == book_id).first() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2778, in first Jan 10 19:35:50 library python[1259]: ret = list(self[0:1]) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2570, in getitem Jan 10 19:35:50 library python[1259]: return list(res) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2878, in iter Jan 10 19:35:50 library python[1259]: return self._execute_and_instances(context) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2899, in _execute_and_instances Jan 10 19:35:50 library python[1259]: close_with_result=True) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2908, in _get_bind_args Jan 10 19:35:50 library python[1259]: kw Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2890, in _connection_from_session Jan 10 19:35:50 library python[1259]: conn = self.session.connection(kw) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 1029, in connection Jan 10 19:35:50 library python[1259]: execution_options=execution_options) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 1034, in _connection_for_bind Jan 10 19:35:50 library python[1259]: engine, execution_options) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 382, in _connection_for_bind Jan 10 19:35:50 library python[1259]: self._assert_active() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 276, in _assert_active Jan 10 19:35:50 library python[1259]: % self._rollback_exception Jan 10 19:35:50 library python[1259]: InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (sqlite3.OperationalError) attempt to write a readonly database [SQL: u'DELETE FROM books_authors_link WHERE books_authors_link.book = ? AND books_authors_link.author = ?'] [parameters: (3892, 1585)] (Background on this error at: http://sqlalche.me/e/e3q8) Jan 10 19:35:50 library python[1259]: ERROR:tornado.access:500 GET /delete/3892/ (192.168.1.223) 27.07ms Jan 10 19:35:50 library python[1259]: [2018-01-10 19:35:50,269] ERROR in app: Exception on /delete/3892/ [GET] Jan 10 19:35:50 library python[1259]: Traceback (most recent call last): Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1982, in wsgi_app Jan 10 19:35:50 library python[1259]: response = self.full_dispatch_request() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1614, in full_dispatch_request Jan 10 19:35:50 library python[1259]: rv = self.handle_user_exception(e) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1517, in handle_user_exception Jan 10 19:35:50 library python[1259]: reraise(exc_type, exc_value, tb) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1612, in full_dispatch_request Jan 10 19:35:50 library python[1259]: rv = self.dispatch_request() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1598, in dispatch_request Jan 10 19:35:50 library python[1259]: return self.view_functions[rule.endpoint](req.view_args) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask_login/utils.py", line 261, in decorated_view Jan 10 19:35:50 library python[1259]: return func(args, kwargs) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/cps/web.py", line 1483, in delete_book Jan 10 19:35:50 library python[1259]: book = db.session.query(db.Books).filter(db.Books.id == book_id).first() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2778, in first Jan 10 19:35:50 library python[1259]: ret = list(self[0:1]) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2570, in getitem Jan 10 19:35:50 library python[1259]: return list(res) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2878, in iter Jan 10 19:35:50 library python[1259]: return self._execute_and_instances(context) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2899, in _execute_and_instances Jan 10 19:35:50 library python[1259]: close_with_result=True) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2908, in _get_bind_args Jan 10 19:35:50 library python[1259]: kw Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2890, in _connection_from_session Jan 10 19:35:50 library python[1259]: conn = self.session.connection(kw) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 1029, in connection Jan 10 19:35:50 library python[1259]: execution_options=execution_options) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 1034, in _connection_for_bind Jan 10 19:35:50 library python[1259]: engine, execution_options) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 382, in _connection_for_bind Jan 10 19:35:50 library python[1259]: self._assert_active() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 276, in _assert_active Jan 10 19:35:50 library python[1259]: % self._rollback_exception Jan 10 19:35:50 library python[1259]: InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (sqlite3.OperationalError) attempt to write a readonly database [SQL: u'DELETE FROM books_authors_link WHERE books_authors_link.book = ? AND books_authors_link.author = ?'] [parameters: (3892, 1585)] (Background on this error at: http://sqlalche.me/e/e3q8) Jan 10 19:35:50 library python[1259]: ERROR:tornado.access:500 GET /delete/3892/ (192.168.1.223) 8.50ms Jan 10 19:35:50 library python[1259]: [2018-01-10 19:35:50,282] ERROR in app: Exception on / [GET] Jan 10 19:35:50 library python[1259]: Traceback (most recent call last): Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1982, in wsgi_app Jan 10 19:35:50 library python[1259]: response = self.full_dispatch_request() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1614, in full_dispatch_request Jan 10 19:35:50 library python[1259]: rv = self.handle_user_exception(e) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1517, in handle_user_exception Jan 10 19:35:50 library python[1259]: reraise(exc_type, exc_value, tb) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1612, in full_dispatch_request Jan 10 19:35:50 library python[1259]: rv = self.dispatch_request() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask/app.py", line 1598, in dispatch_request Jan 10 19:35:50 library python[1259]: return self.view_functions[rule.endpoint](req.view_args) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/cps/web.py", line 393, in decorated_view Jan 10 19:35:50 library python[1259]: return login_required(func)(*args, *kwargs) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/flask_login/utils.py", line 261, in decorated_view Jan 10 19:35:50 library python[1259]: return func(args, kwargs) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/cps/web.py", line 1095, in index Jan 10 19:35:50 library python[1259]: entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.timestamp.desc()) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/cps/web.py", line 543, in fill_indexpage Jan 10 19:35:50 library python[1259]: .filter(db_filter).filter(common_filters()).all())) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2726, in all Jan 10 19:35:50 library python[1259]: return list(self) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2878, in iter Jan 10 19:35:50 library python[1259]: return self._execute_and_instances(context) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2899, in _execute_and_instances Jan 10 19:35:50 library python[1259]: close_with_result=True) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2908, in _get_bind_args Jan 10 19:35:50 library python[1259]: kw Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/query.py", line 2890, in _connection_from_session Jan 10 19:35:50 library python[1259]: conn = self.session.connection(**kw) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 1029, in connection Jan 10 19:35:50 library python[1259]: execution_options=execution_options) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 1034, in _connection_for_bind Jan 10 19:35:50 library python[1259]: engine, execution_options) Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 382, in _connection_for_bind Jan 10 19:35:50 library python[1259]: self._assert_active() Jan 10 19:35:50 library python[1259]: File "/opt/calibre-web/vendor/sqlalchemy/orm/session.py", line 276, in _assert_active Jan 10 19:35:50 library python[1259]: % self._rollback_exception Jan 10 19:35:50 library python[1259]: InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (sqlite3.OperationalError) attempt to write a readonly database [SQL: u'DELETE FROM books_authors_link WHERE books_authors_link.book = ? AND books_authors_link.author = ?'] [parameters: (3892, 1585)] (Background on this error at: http://sqlalche.me/e/e3q8) Jan 10 19:35:50 library python[1259]: ERROR:tornado.access:500 GET / (192.168.1.223) 10.76ms Jan 10 19:38:42 library systemd[1]: Created slice User Slice of root. Jan 10 19:38:42 library systemd[1]: Started Session 59 of user root. Jan 10 19:38:42 library systemd[1]: Starting User Manager for UID 0... Jan 10 19:38:42 library systemd[3026]: Reached target Timers. Jan 10 19:38:42 library systemd[3026]: Reached target Paths. Jan 10 19:38:42 library systemd[3026]: Reached target Sockets. Jan 10 19:38:42 library systemd[3026]: Reached target Basic System. Jan 10 19:38:42 library systemd[3026]: Reached target Default. Jan 10 19:38:42 library systemd[3026]: Startup finished in 31ms. Jan 10 19:38:42 library systemd[1]: Started User Manager for UID 0. Jan 10 19:38:47 library systemd[3026]: Stopped target Default. Jan 10 19:38:47 library systemd[3026]: Stopped target Basic System. Jan 10 19:38:47 library systemd[3026]: Stopped target Sockets. Jan 10 19:38:47 library systemd[3026]: Reached target Shutdown. Jan 10 19:38:47 library systemd[3026]: Starting Exit the Session... Jan 10 19:38:47 library systemd[3026]: Stopped target Paths. Jan 10 19:38:47 library systemd[3026]: Stopped target Timers. Jan 10 19:38:47 library systemd[1]: Stopping User Manager for UID 0... Jan 10 19:38:47 library systemd[3026]: Received SIGRTMIN+24 from PID 3121 (kill). Jan 10 19:38:47 library systemd[1]: Stopped User Manager for UID 0. Jan 10 19:38:47 library systemd[1]: Removed slice User Slice of root. Jan 10 19:38:54 library kernel: [86580.044190] e1000: enp0s3 NIC Link is Down Jan 10 19:39:00 library kernel: [86586.056536] e1000: enp0s3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX Jan 10 19:42:37 library systemd[1]: Time has been changed Jan 10 19:42:45 library systemd[1]: Created slice User Slice of root. Jan 10 19:42:45 library systemd[1]: Starting User Manager for UID 0... Jan 10 19:42:45 library systemd[1]: Started Session 60 of user root. Jan 10 19:42:45 library systemd[3131]: Reached target Paths. Jan 10 19:42:45 library systemd[3131]: Reached target Sockets. Jan 10 19:42:45 library systemd[3131]: Reached target Timers. Jan 10 19:42:45 library systemd[3131]: Reached target Basic System. Jan 10 19:42:45 library systemd[3131]: Reached target Default. Jan 10 19:42:45 library systemd[3131]: Startup finished in 32ms. Jan 10 19:42:45 library systemd[1]: Started User Manager for UID 0. Jan 10 19:43:18 library systemd[1]: Stopping cps.service... Jan 10 19:43:18 library systemd[1]: Stopped cps.service.

OzzieIsaacs commented 6 years ago

Hope you have a backup... From what I see in the trackback and the code, I think the book had an empty book path, this isn‘t checked, and therefore the root folder (the location of the metadata.db) was deleted. I‘ll add some more checks to the delete routine

mnott commented 6 years ago

Oh wow that was a quick fix! Thanks for that. What I saw was that when adding the book to calibre on my macbook (drag and drop), and then copy / moving it to my target library on my linux server using calibre, what appeared over there was a file like .afpDeleted71084.... So somehow there was an issue with that book.

And then the code deleted all my library, which I had just worked through all the metadata yesterday...

At least I now know that my tape backup doesn't have my library server on its daily routine - and hence better spend one night doing it again, than spending a lot more time later.

Thanks anyway for the quick fix!

OzzieIsaacs commented 6 years ago

Find better implementation: delete book by book, check folder empty and than delete the folder in the last step