Bench update --reset error

Hi

Anyone please help me to figure out where I went wrong. Its a production server.

While trying to update the bench, I was getting the following error,

[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.

I have done the following

[root@erp frappe-bench]# cd apps/frappe/
[root@erp frappe]# git pull --rebase
Current branch master is up to date.
[root@erp frappe]# cd ../..
[root@erp frappe-bench]# bench update

The same error was showing

[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.

Following the forum, tried the bench update --reset and its showing some thing different.

[root@erp frappe-bench]# bench update --reset
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 fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/master
HEAD is now at 4c55d73 Merge branch 'develop'
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/master
Checking out files: 100% (4695/4695), done.
HEAD is now at e7125c0 Merge branch 'develop'
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/frappe/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/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')

Seems like you did some changes in Frappe App. Commit it or stash it.
Run git stash from your app/frappe to remove changes.[quote=“fasilkaks, post:1, topic:23014”]
‘MySQL server has gone away’
[/quote]

restart MySQL sudo service mysql restart

Hi Sangram

Thanks for replying

I have already tried stash. Please find below

[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.

Hi

Please find below the additional steps done following the forum

[root@erp ~]# cd /home/frappe/frappe-bench/apps/erpnext/
[root@erp erpnext]# git pull
Already up-to-date.
[root@erp erpnext]# cd ../frappe/
[root@erp frappe]# git pull
Already up-to-date.
[root@erp frappe]# git pull --rebase
Current branch master is up to date.
[root@erp frappe]# git reset --hard
HEAD is now at 4c55d73 Merge branch 'develop'
[root@erp frappe]# cd ../erpnext/
[root@erp erpnext]# git reset --hard
HEAD is now at e7125c0 Merge branch 'develop'
[root@erp erpnext]# 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.

Any light on to this issue is highly appreciated!!! This is really critical

You’re not the only one. We have two other posts about this:

and

I think all we can do is wait until someone knows a solution. I think this is beyond the knowledge of the average.

EDIT: By the way: For now use bench update --reset. It will update properly, but you will have the problem on the next time again if you try it without --reset, thats the actual issue.

1 Like

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