ERPNext Conference 2019* ERPNext.com Blog

Can't restore backup from older erpnext version

update_problem
bug
erpnext
backup

#1

I have installed erpnext system on my server, the latest version 12.0.3. I have a backup sql file from version 11.
I have tried the method of bench restore, but it doesn’t work. I have tried the method on this page. I get the following error.

bench --site site1.local migrate
Migrating site1.local
Traceback (most recent call last):
File “/usr/lib/python3.5/runpy.py”, line 184, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.5/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 234, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 45, in migrate
frappe.get_attr(fn)()
File “/home/frappe/frappe-bench/apps/frappe/frappe/patches/v11_0/sync_user_permission_doctype_before_migrate.py”, line 6, in execute
frappe.reload_doc(‘core’, ‘doctype’, ‘user_permission’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 799, in reload_doc
return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 174, in reload_doc
return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 27, in import_files
reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 32, in import_file
ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 66, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 141, in import_doc
doc.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 258, in insert
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 917, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 786, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1055, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1040, in runner
add_to_return_value(self, f(self, method, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/automation/doctype/milestone_tracker/milestone_tracker.py”, line 34, in evaluate_milestone
dict(document_type = doc.doctype, disabled=0)):
File “/home/frappe/frappe-bench/apps/frappe/frappe/cache_manager.py”, line 107, in get_doctype_map
items = frappe.get_all(doctype, filters=filters, order_by = order_by)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1291, in get_all
return get_list(doctype, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1264, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 94, in execute
result = self.build_and_run()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 108, in build_and_run
args = self.prepare_args()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 131, in prepare_args
self.build_conditions()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 312, in build_conditions
self.build_filter_conditions(self.filters, self.conditions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 333, in build_filter_conditions
conditions.append(self.prepare_filter_condition(f))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 340, in prepare_filter_condition
f = get_filter(self.doctype, f)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/data.py”, line 892, in get_filter
meta = frappe.get_meta(f.doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 759, in get_meta
return frappe.model.meta.get_meta(doctype, cached=cached)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 37, in get_meta
meta = Meta(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 84, in init
super(Meta, self).init(“DocType”, doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 104, in init
self.load_from_db()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 89, in load_from_db
super(Meta, self).load_from_db()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 147, in load_from_db
frappe.throw(
("{0} {1} not found").format(
(self.doctype), self.name), frappe.DoesNotExistError)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 360, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 346, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 315, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: DocType Milestone Tracker not found

Also, I can’t restart my bench. After I try bench start, I get the following error -
bench start
13:34:08 system | redis_cache.1 started (pid=29495)
13:34:08 system | worker_long.1 started (pid=29496)
13:34:08 redis_cache.1 | 29501:M 01 Aug 13:34:08.629 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:34:08 redis_cache.1 | 29501:M 01 Aug 13:34:08.632 # Creating Server TCP listening socket 127.0.0.1:13000: bind: Address already in use
13:34:08 system | worker_short.1 started (pid=29497)
13:34:08 system | redis_cache.1 stopped (rc=1)
13:34:08 system | web.1 started (pid=29504)
13:34:08 system | redis_queue.1 started (pid=29503)
13:34:08 redis_queue.1 | 29513:M 01 Aug 13:34:08.646 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:34:08 redis_queue.1 | 29513:M 01 Aug 13:34:08.647 # Creating Server TCP listening socket 127.0.0.1:11000: bind: Address already in use
13:34:08 system | redis_queue.1 stopped (rc=1)
13:34:08 system | redis_socketio.1 started (pid=29505)
13:34:08 redis_socketio.1 | 29518:M 01 Aug 13:34:08.661 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:34:08 redis_socketio.1 | 29518:M 01 Aug 13:34:08.662 # Creating Server TCP listening socket 127.0.0.1:12000: bind: Address already in use
13:34:08 system | worker_default.1 started (pid=29512)
13:34:08 system | redis_socketio.1 stopped (rc=1)
13:34:08 system | schedule.1 started (pid=29517)
13:34:08 system | watch.1 started (pid=29522)
13:34:08 system | socketio.1 started (pid=29520)
13:34:08 system | sending SIGTERM to worker_long.1 (pid 29496)
13:34:08 system | sending SIGTERM to web.1 (pid 29504)
13:34:08 system | sending SIGTERM to worker_short.1 (pid 29497)
13:34:08 system | sending SIGTERM to worker_default.1 (pid 29512)
13:34:08 system | sending SIGTERM to watch.1 (pid 29522)
13:34:08 system | sending SIGTERM to schedule.1 (pid 29517)
13:34:08 system | sending SIGTERM to socketio.1 (pid 29520)
13:34:08 system | worker_short.1 stopped (rc=-15)
13:34:08 system | web.1 stopped (rc=-15)
13:34:08 system | worker_long.1 stopped (rc=-15)
13:34:08 system | worker_default.1 stopped (rc=-15)
13:34:08 system | socketio.1 stopped (rc=-15)
13:34:08 system | watch.1 stopped (rc=-15)
13:34:08 system | schedule.1 stopped (rc=-15)

I have been stuck on this issue for days now, PLEASE HELP.

Thanks,
Parth.


#2

Your supervisorctl subsystem seems to have stopped.
Try

sudo supervisorctl stop all;
wait 20;
sudo supervisorctl start all;


#3

I tried that, doesn’t work. My main problem is restoring the backup of my site. I re installed my server and reinstalled erpnext. A fresh erpnext I can get now. But i can’t restore my backup.


#4

In my summary (Resolved) Restore V12 from V10 backups

I posted this

On the new server (in a new tab, while bench was started in a previous tab)
$ bench --site erp.mysite migrate

Make sure you do a bench start, then in a new tab run the migrate command.