Bench update --reset error

goto frappe app directory cd app/frappe
run git stash to stash changes. Again try bench update from frappe-bench

Thanks Ci2016 and Sangram

I have tried all the ways possible

git stash applied in both apps folders (erpnext and frappe)

git stash
git reset --hard
git pull --rebase

Even after this commands it was showing the same error

Have you still facing this issue? Please run git status from app/frappe
and share the result.

Hi Sangram

please find the out put below

[root@erp frappe]# git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       frappe/core/doctype/communication/email.py.orig
#       frappe/email/queue.py.orig
#       frappe/public/css/common.css.orig
#       frappe/public/js/frappe/list/doclistview.js.orig
#       frappe/templates/emails/print_link.html.orig
#       frappe/templates/print_formats/pdf_header_footer.html.orig
#       frappe/templates/print_formats/standard_macros.html.orig
#       frappe/utils/pdf.py.orig
nothing added to commit but untracked files present (use "git add" to track)

All this are changes in a frappe. Now just run git stash from same directory i.e. app/frappe
and the try bench update from frappe-bench

Sangram

Ran the commands mentioned. Results below

[root@erp frappe]# pwd
/home/frappe/frappe-bench/apps/frappe
[root@erp frappe]# git stash
No local changes to save
[root@erp frappe]# cd ../..
[root@erp frappe-bench]# bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages


Cannot proceed with update: You have local changes in app "frappe" that are not committed.

Here are your choices:

1. Merge the frappe app manually with "git pull" / "git pull --rebase" and fix conflicts.
1. Temporarily remove your changes with "git stash" or discard them completely
        with "bench update --reset" or for individual repositries "git reset --hard"
2. If your changes are helpful for others, send in a pull request via GitHub and
        wait for them to be merged in the core.

you have to add these untracked files and then stash it.
Now do one thing, run git add --all then git stash and try bench update again.

Sangram,

[root@erp frappe]# git add --all
[root@erp frappe]# git stash
Saved working directory and index state WIP on master: 1c08475 Merge branch 'develop'
HEAD is now at 1c08475 Merge branch 'develop'
[root@erp frappe]# cd ../..
[root@erp frappe-bench]# bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages


Cannot proceed with update: You have local changes in app "erpnext" that are not committed.

Here are your choices:

1. Merge the erpnext app manually with "git pull" / "git pull --rebase" and fix conflicts.
1. Temporarily remove your changes with "git stash" or discard them completely
        with "bench update --reset" or for individual repositries "git reset --hard"
2. If your changes are helpful for others, send in a pull request via GitHub and
        wait for them to be merged in the core.

Do we have a manual way to do this?

Sir, do same in app/erpnext and then update.

Sangram,

Please find the output below

[root@erp frappe-bench]# cd apps/erpnext/
[root@erp erpnext]# git add --all
[root@erp erpnext]# git stash
Saved working directory and index state WIP on master: e7125c0 Merge branch 'develop'
HEAD is now at e7125c0 Merge branch 'develop'
[root@erp erpnext]# cd ../frappe/
[root@erp frappe]# git add --all
[root@erp frappe]# git stash
No local changes to save
[root@erp frappe]# cd ../..
[root@erp frappe-bench]# bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
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
Already up-to-date.
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git pull  upstream master
error: cannot open .git/FETCH_HEAD: Permission denied

Traceback (most recent call last):
  File "/usr/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

seems like a permission issue.

login thorugh frappe user - sudo su frappe
then bench update from frappe-bench

or refer this link - link

.

Sangram,

[root@erp ~]# su - frappe
    Last login: Wed Apr 26 10:24:36 AST 2017 on pts/0
    [frappe@erp ~]$ cd frappe-bench/
    [frappe@erp frappe-bench]$ bench update
    INFO:bench.utils:updating bench
    INFO:bench.utils:git pull
    Already up-to-date.
    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
    Already up-to-date.
    INFO:bench.utils:find . -name "*.pyc" -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull  upstream master
    error: cannot open .git/FETCH_HEAD: Permission denied

    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
[frappe@erp erpnext]$ git reset --hard
HEAD is now at e7125c0 Merge branch 'develop'
[frappe@erp erpnext]$ git pull
remote: Counting objects: 12, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (12/12), done.
From https://github.com/frappe/erpnext
   e7125c0..f7d81c7  master     -> upstream/master
   c27d9f7..f7d81c7  develop    -> upstream/develop
 * [new tag]         v8.0.18    -> v8.0.18
Updating e7125c0..f7d81c7
Fast-forward
 erpnext/__init__.py                                                            |   2 +-
 erpnext/accounts/doctype/bank_guarantee/__init__.py                            |   0
 erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js                      |  30 +++++++
 erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json                    | 448 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py                      |  10 +++
 erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py                 |  12 +++
 erpnext/accounts/report/balance_sheet/balance_sheet.js                         |   6 ++
 erpnext/accounts/report/balance_sheet/balance_sheet.py                         |  33 +++++--
 erpnext/accounts/report/cash_flow/cash_flow.py                                 |   2 +-
 erpnext/accounts/report/financial_statements.py                                |  17 ++--
 erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py |   9 +-
 erpnext/config/accounts.py                                                     |   5 ++
 erpnext/config/crm.py                                                          |  12 +++
 erpnext/crm/report/campaign_efficiency/__init__.py                             |   0
 erpnext/crm/report/campaign_efficiency/campaign_efficiency.js                  |  19 ++++
 erpnext/crm/report/campaign_efficiency/campaign_efficiency.json                |  30 +++++++
 erpnext/crm/report/campaign_efficiency/campaign_efficiency.py                  |  89 +++++++++++++++++++
 erpnext/crm/report/lead_owner_efficiency/__init__.py                           |   0
 erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js              |  17 ++++
 erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.json            |  30 +++++++
 erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py              |  26 ++++++
 erpnext/docs/assets/img/accounts/bank-guarantee.png                            | Bin 0 -> 214869 bytes
 erpnext/docs/assets/img/accounts/exempted-item.png                             | Bin 0 -> 43627 bytes
 erpnext/docs/assets/img/accounts/item-wise-tax.png                             | Bin 0 -> 46089 bytes
 erpnext/docs/assets/img/accounts/tax-calulation.png                            | Bin 0 -> 92190 bytes
 erpnext/docs/assets/img/accounts/tax-master.png                                | Bin 0 -> 72034 bytes
 erpnext/docs/assets/old_images/erpnext/item-wise-tax-calc.png                  | Bin 28950 -> 0 bytes
 erpnext/docs/assets/old_images/erpnext/item-wise-tax-master.png                | Bin 10609 -> 0 bytes
 erpnext/docs/assets/old_images/erpnext/item-wise-tax.png                       | Bin 11337 -> 0 bytes
 erpnext/docs/user/manual/en/accounts/bank-guarantee.md                         |   9 ++
 erpnext/docs/user/manual/en/accounts/index.txt                                 |   1 +
 erpnext/docs/user/manual/en/accounts/item-wise-taxation.md                     |  30 ++++---
 erpnext/docs/user/manual/en/setting-up/settings/module-settings.md             |   2 +-
 erpnext/patches/v8_0/update_status_as_paid_for_completed_expense_claim.py      |   4 +-
 34 files changed, 810 insertions(+), 33 deletions(-)
 create mode 100644 erpnext/accounts/doctype/bank_guarantee/__init__.py
 create mode 100644 erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
 create mode 100644 erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
 create mode 100644 erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
 create mode 100644 erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
 create mode 100644 erpnext/crm/report/campaign_efficiency/__init__.py
 create mode 100644 erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
 create mode 100644 erpnext/crm/report/campaign_efficiency/campaign_efficiency.json
 create mode 100644 erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
 create mode 100644 erpnext/crm/report/lead_owner_efficiency/__init__.py
 create mode 100644 erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js
 create mode 100644 erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.json
 create mode 100644 erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py
 create mode 100644 erpnext/docs/assets/img/accounts/bank-guarantee.png
 create mode 100644 erpnext/docs/assets/img/accounts/exempted-item.png
 create mode 100644 erpnext/docs/assets/img/accounts/item-wise-tax.png
 create mode 100644 erpnext/docs/assets/img/accounts/tax-calulation.png
 create mode 100644 erpnext/docs/assets/img/accounts/tax-master.png
 delete mode 100644 erpnext/docs/assets/old_images/erpnext/item-wise-tax-calc.png
 delete mode 100644 erpnext/docs/assets/old_images/erpnext/item-wise-tax-master.png
 delete mode 100644 erpnext/docs/assets/old_images/erpnext/item-wise-tax.png
 create mode 100644 erpnext/docs/user/manual/en/accounts/bank-guarantee.md
[frappe@erp erpnext]$ cd ../frappe/
[frappe@erp frappe]$ git reset --hard
HEAD is now at 1c08475 Merge branch 'develop'
[frappe@erp frappe]$ git pull
Already up-to-date.

[frappe@erp frappe-bench]$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
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
Already up-to-date.
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
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')

Please note that I could not do the below steps as I dont have .bench folder

    go to folder /home/frappe/.bench
    and run the following command:

    git reset --hard
    git pull

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