Bench update --reset error

Restart mysql

Sangram,

I have tried restarting mysql (before and now) following your first post

It still gives the same error

Please find the latest steps done

[frappe@localhost frappe-bench]$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
remote: Counting objects: 57, done.
remote: Compressing objects: 100% (43/43), done.
error: insufficient permission for adding an object to repository database .git/objects
fatal: failed to write object
fatal: unpack-objects failed
remote: Counting objects: 57, done.
remote: Compressing objects: 100% (43/43), done.
error: insufficient permission for adding an object to repository database .git/objects
fatal: failed to write object
fatal: unpack-objects failed
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull  upstream master
remote: Counting objects: 21, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 21 (delta 15), reused 12 (delta 12), pack-reused 0
error: insufficient permission for adding an object to repository database .git/objects
fatal: failed to write object
fatal: unpack-objects failed
Traceback (most recent call last):
  File "/bin/bench", line 9, in <module>
    load_entry_point('bench==4.0.0', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 62, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force, reset=reset)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 78, in _update
    pull_all_apps(bench_path=bench_path, reset=reset)
  File "/home/frappe/bench-repo/bench/app.py", line 170, in pull_all_apps
    remote=remote, branch=get_current_branch(app, bench_path=bench_path)), cwd=app_dir)
  File "/home/frappe/bench-repo/bench/utils.py", line 130, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull  upstream master

changed the permission of the .git folder to frappe:frappe

[root@localhost sites]# chown -R frappe:frappe /home/frappe/frappe-bench/apps/frappe/.git

Finally ran the bench update and see the same error again

[root@localhost sites]# su - frappe 
Last login: Wed Apr 26 14:03:22 AST 2017 on pts/0
[frappe@localhost ~]$ cd /home/frappe/frappe-bench/
[frappe@localhost frappe-bench]$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
remote: Counting objects: 57, done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 57 (delta 30), reused 14 (delta 14), pack-reused 0
Unpacking objects: 100% (57/57), done.
From https://github.com/frappe/frappe
   1c08475..44832f0  master     -> upstream/master
   1c08475..b6c36a6  develop    -> upstream/develop
 * [new tag]         v8.0.26    -> v8.0.26
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/frappe
 * branch            master     -> FETCH_HEAD
Updating 1c08475..44832f0
Fast-forward
 frappe/__init__.py                                     | 2 +-
 frappe/core/page/user_permissions/user_permissions.py  | 8 ++++++--
 frappe/public/js/frappe/form/footer/timeline_item.html | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git pull  upstream master
remote: Counting objects: 23, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 23 (delta 6), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (23/23), done.
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Updating f7d81c7..f26dcbc
Fast-forward
 erpnext/__init__.py                                               |  2 +-
 erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py | 10 +++++++++-
 erpnext/selling/doctype/sales_order/sales_order_dashboard.py      |  7 +++++++
 erpnext/stock/doctype/batch/batch.py                              | 20 +++++++++++---------
 4 files changed, 28 insertions(+), 11 deletions(-)
INFO:bench.utils:find . -name "*.pyc" -delete
Updating Python libraries...
INFO:bench.utils:./env/bin/pip install --upgrade pip
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/bench-repo/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
Backing up sites...
Patching sites...
Migrating erp.cubixys.com
Executing frappe.patches.v8_0.update_records_in_global_search in erp.cubixys.com (884f6bb404)
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python2.7/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 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 210, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 89, in execute_patch
    frappe.db.rollback()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 737, in rollback
    self.sql("rollback")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 149, in sql
    self._cursor.execute(query)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')

The command ‘bench update’ was run as root user also and thrown the same error

hi @fasilkaks
please check this

Thanks

1 Like

DEAR Sagar

You are a life savior

The solution is here…

edit /etc/my.cnf.d/server.cnf
add a line under [mysqld]
max_allowed_packet=500M
now restart the MySQL service once you are done.

Now go back to /home/frappe/frappe-bench and run bench update

Sagar, let me thank you again a million times :slight_smile::slight_smile::slight_smile::slight_smile::slight_smile::slight_smile::slight_smile:

2 Likes