Can't Upgrade ERPNext 9.1.1 to latest version

Hi members… I’m using erpnext 9.1.1 and frappe 9.1.2 in self hosted AWS. I found version ERPNext 9.1.1 even after trying bench update.


:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
remote: Counting objects: 345, done.
remote: Compressing objects: 100% (95/95), done.
remote: Total 345 (delta 203), reused 278 (delta 192), pack-reused 50
Receiving objects: 100% (345/345), 94.07 KiB | 0 bytes/s, done.
Resolving deltas: 100% (209/209), completed with 53 local objects.
From GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps
84c5719…de5f2fd master → origin/master
258f092…efb75f2 develop → origin/develop

  • [new branch] fix-migration → origin/fix-migration
  • [new branch] fixes → origin/fixes
    Updating 84c5719…de5f2fd
    error: unable to unlink old ‘playbooks/roles/bench/tasks/main.yml’ (Permission denied)
    error: unable to unlink old ‘playbooks/roles/bench/tasks/setup_erpnext.yml’ (Permission denied)
    error: unable to unlink old ‘playbooks/roles/common/tasks/main.yml’ (Permission denied)
    error: unable to unlink old ‘playbooks/roles/common/tasks/redhat_family.yml’ (Permission denied)
    error: unable to unlink old ‘playbooks/roles/mariadb/files/debian_mariadb_config.cnf’ (Permission denied)
    error: unable to unlink old ‘playbooks/roles/mariadb/files/mariadb_config.cnf’ (Permission denied)
    error: unable to create file playbooks/roles/nodejs/tasks/debian_family.yml (Permission denied)
    error: unable to unlink old ‘playbooks/roles/nodejs/tasks/main.yml’ (Permission denied)
    error: unable to create file playbooks/roles/nodejs/tasks/redhat_family.yml (Permission denied)
    fatal: cannot create directory at ‘playbooks/roles/packer’: Permission denied
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 11, in
    load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
    File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
    bench_command()
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/bench-repo/bench/commands/update.py”, line 34, in update
    update_bench()
    File “/home/frappe/bench-repo/bench/utils.py”, line 282, in update_bench
    with open(sudoers_file, ‘w’) as f:
    File “/home/frappe/bench-repo/bench/utils.py”, line 152, in exec_cmd
    raise CommandFailedError(cmd)
    bench.utils.CommandFailedError: git pull

Also tried the following command:

:~/frappe-bench$ bench update --reset
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Updating 84c5719…de5f2fd
error: Your local changes to the following files would be overwritten by merge:
.gitignore
README.md
bench/app.py
bench/commands/init.py
bench/commands/install.py
bench/commands/make.py
bench/commands/setup.py
bench/config/templates/Procfile
bench/utils.py
playbooks/README.md
playbooks/create_user.yml
playbooks/install.py
Please, commit your changes or stash them before you can merge.
Aborting
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in ca ll
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in inv oke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invo ke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invo ke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/commands/update.py”, line 34, in update
update_bench()
File “/home/frappe/bench-repo/bench/utils.py”, line 253, in update_bench
exec_cmd(“git pull”, cwd=cwd)
File “/home/frappe/bench-repo/bench/utils.py”, line 152, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull


Holding my minimum experience, request for support from experienced hands to update ERPNext to the latest version. Thanks in advance.

with regards,
Ameer Babu

Hi!
Every time i try to update i use the following command:
cd /home/frappe/frappe-bench/apps/frappe/
git status
git add --all
git stash
cd /home/frappe/frappe-bench/apps/erpnext/
git status
git pull
git add --all
git stash
cd /home/frappe/frappe-bench/
bench update --reset

1 Like

Hi Eduardo,
Thanks for your response.
I tried the same commands and the result was as follows:


:~/frappe-bench/apps/frappe$ git status
On branch dev
Your branch is ahead of ‘upstream/dev’ by 1 commit.
(use “git push” to publish your local commits)

nothing to commit, working directory clean


:~/frappe-bench/apps/frappe$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from ‘matching’ to ‘simple’. To squelch this message
and maintain the current behavior after the default changes, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

When push.default is set to ‘matching’, git will push local branches
to the remote branches that already exist with the same name.

In Git 2.0, Git will default to the more conservative ‘simple’
behavior, which only pushes the current branch to the corresponding
remote branch that ‘git pull’ uses to update the current branch.

See ‘git help config’ and search for ‘push.default’ for further information.
(the ‘simple’ mode was introduced in Git 1.7.11. Use the similar mode
‘current’ instead of ‘simple’ if you sometimes use older versions of Git)

repository access denied. access via a deployment key is read-only.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


:~/frappe-bench/apps/frappe$ git config --global push.def ault matching


:~/frappe-bench/apps/frappe$ git add --all


:~/frappe-bench/apps/frappe$ git stash
No local changes to save


:~/frappe-bench/apps/erpnext$ git status
On branch dev
Your branch is up-to-date with ‘upstream/dev’.

nothing to commit, working directory clean


:~/frappe-bench/apps/erpnext$ git pull
Already up-to-date.


:~/frappe-bench/apps/erpnext$ git add --all


:~/frappe-bench/apps/erpnext$ git stash
No local changes to save


:~/frappe-bench$ bench update --reset
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Updating 84c5719…de5f2fd
error: Your local changes to the following files would be overwritten by merge:
.gitignore
README.md
bench/app.py
bench/commands/init.py
bench/commands/install.py
bench/commands/make.py
bench/commands/setup.py
bench/config/templates/Procfile
bench/utils.py
playbooks/README.md
playbooks/create_user.yml
playbooks/install.py
Please, commit your changes or stash them before you can merge.
Aborting
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/commands/update.py”, line 34, in update
update_bench()
File “/home/frappe/bench-repo/bench/utils.py”, line 253, in update_bench
exec_cmd(“git pull”, cwd=cwd)
File “/home/frappe/bench-repo/bench/utils.py”, line 152, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull


How could I restore this error?
Thanking you…

Seems to be problems with file permissions on your system

@codingCoffee

1 Like

I agree with @netchampfaris

Which user are you using to run the bench update command?

1 Like

Did you installed you erpnext as root?
if you did try the same commands usind sudo su

To work your permissions try the following
sudo chown -R frappe:frappe /home/frappe/frappe-bench

1 Like

Hi Eduardo,

I tried as per your message and the result was:

:/home/frappe/frappe-bench# bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Updating 84c5719…de5f2fd
error: Your local changes to the following files would be overwritten by merge:
.gitignore
README.md
bench/app.py
bench/commands/init.py
bench/commands/install.py
bench/commands/make.py
bench/commands/setup.py
bench/config/templates/Procfile
bench/utils.py
playbooks/README.md
playbooks/create_user.yml
playbooks/install.py
Please, commit your changes or stash them before you can merge.
Aborting
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/commands/update.py”, line 34, in update
update_bench()
File “/home/frappe/bench-repo/bench/utils.py”, line 253, in update_bench
exec_cmd(“git pull”, cwd=cwd)
File “/home/frappe/bench-repo/bench/utils.py”, line 152, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull

HI Wale,

I am using “sudo -H -u frappe bash” before “bench update”.
I tried by switch user as frappe and root too. Still the result is same error.

Hi @ameerbabu,

it seems that you are on a strange branch “dev”. The branch should be “master” or “develop”. Try this

$ cd /home/frappe/frappe-bench/apps/frappe
$ git checkout master
$ git reset --hard
$ git pull
$ cd /home/frappe/frappe-bench/apps/erpnext
$ git checkout master
$ git reset --hard
$ git pull
$ cd ../..
$ bench update

This should pull the latest master version. You may also try to run

$ git remote -v

and check the output to make sure that you are linked to upstream GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript and /erpnext respetively (run in the apps/frappe and erpnext folder).

Hope this helps.

3 Likes

Hi Lasalesi,

Thanks for your response.
The result was as follows:
frappe@ip:~/frappe-bench/apps/frappe$ git checkout master
Switched to branch ‘master’
Your branch is up-to-date with ‘upstream/master’.

frappe@ip:~/frappe-bench/apps/frappe$ git reset --hard
HEAD is now at bf67b2b Merge remote-tracking branch 'zz/master'

frappe@ip:~/frappe-bench/apps/frappe$ git pull
Already up-to-date.

frappe@ip:~/frappe-bench/apps/erpnext$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'upstream/master'.

frappe@ip:~/frappe-bench/apps/erpnext$ git reset --hard
HEAD is now at afdd7a6 Merge branch 'develop'

frappe@ip:~/frappe-bench/apps/erpnext$ git pull
Already up-to-date.

frappe@ip:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Updating 84c5719..de5f2fd
error: Your local changes to the following files would be overwritten by merge:
        .gitignore
        README.md
        bench/app.py
        bench/commands/__init__.py
        bench/commands/install.py
        bench/commands/make.py
        bench/commands/setup.py
        bench/config/templates/Procfile
        bench/utils.py
        playbooks/README.md
        playbooks/create_user.yml
        playbooks/install.py
Please, commit your changes or stash them before you can merge.
Aborting
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 34, in update
    update_bench()
  File "/home/frappe/bench-repo/bench/utils.py", line 253, in update_bench
    exec_cmd("git pull", cwd=cwd)
  File "/home/frappe/bench-repo/bench/utils.py", line 152, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull

frappe@ip:~/frappe-bench/apps/frappe$ git remote -v
origin  https://github.com/frappe/frappe.git (fetch)
origin  https://github.com/frappe/frappe.git (push)
upstream        https://github.com/frappe/frappe (fetch)
upstream        https://github.com/frappe/frappe (push)

frappe@ip:~/frappe-bench/apps/erpnext$ git remote -v
origin  https://github.com/frappe/erpnext.git (fetch)
origin  https://github.com/frappe/erpnext.git (push)
upstream        https://github.com/frappe/erpnext (fetch)
upstream        https://github.com/frappe/erpnext (push)

frappe@ip:~/frappe-bench/apps/frappe$ git remote -v
origin  https://github.com/frappe/frappe.git (fetch)
origin  https://github.com/frappe/frappe.git (push)
upstream        https://github.com/frappe/frappe.git (fetch)
upstream        https://github.com/frappe/frappe.git (push)

frappe@ip:~/frappe-bench/apps/frappe$ cd ../erpnext/

frappe@ip:~/frappe-bench/apps/erpnext$ git remote -v
origin  https://github.com/frappe/erpnext.git (fetch)
origin  https://github.com/frappe/erpnext.git (push)
upstream        https://github.com/frappe/erpnext.git (fetch)
upstream        https://github.com/frappe/erpnext.git (push)

frappe@ip:~/frappe-bench/apps/erpnext$ git checkout master
Already on ‘master’
Your branch is up-to-date with ‘upstream/master’.

frappe@ip:~/frappe-bench/apps/erpnext$ git reset --hard
HEAD is now at 02fd6f5 Update leave_application.py (#13575)

frappe@ip:~/frappe-bench/apps/erpnext$ git pull
Already up-to-date.

frappe@ip:~/frappe-bench/apps/erpnext$ cd …/frappe/

frappe@ip:~/frappe-bench/apps/frappe$ git checkout master
.gitignore: needs merge
README.md: needs merge
setup.py: needs merge
error: you need to resolve your current index first
frappe@ip-172-31-23-92:~/frappe-bench/apps/frappe$ git reset --hard
HEAD is now at bf67b2b Merge remote-tracking branch 'zz/master'
frappe@ip-172-31-23-92:~/frappe-bench/apps/frappe$ git pull
Auto-merging setup.py
CONFLICT (content): Merge conflict in setup.py
Removing license.txt
Removing frappe/tests/ui/test_list.js
Removing frappe/tests/ui/test_lib.js
Removing frappe/tests/ui/setup_wizard.js
Auto-merging frappe/tests/test_exporter_fixtures.py
Removing frappe/templates/styles/monochrome.css
Removing frappe/templates/styles/modern.css
Removing frappe/templates/styles/classic.css
Removing frappe/templates/autodoc/docs_home.html
Removing frappe/public/js/lib/taggle/taggle.min.js
Removing frappe/public/js/lib/taggle/taggle.min.css
Removing frappe/public/js/lib/d3.min.js
Removing frappe/public/js/lib/cal-heatmap.js
Removing frappe/public/js/lib/c3.min.js
Removing frappe/public/js/lib/Chart.min.js
Auto-merging frappe/public/js/legacy/client_script_helpers.js
Removing frappe/public/js/frappe/ui/charts.js
Removing frappe/public/js/frappe/misc/tests/test_number_format.js
Auto-merging frappe/public/js/frappe/form/form_sidebar.js
Removing frappe/public/js/frappe/form/control.js
Removing frappe/public/js/frappe/checkbox_editor.js
Removing frappe/public/css/cal-heatmap.css
Removing frappe/public/css/c3.min.css
Auto-merging frappe/integrations/doctype/webhook/webhook.json
Removing frappe/docs/user/en/guides/desk/making_charts_in_c3js.md
Removing frappe/docs/license.html
Removing frappe/docs/install.md
Removing frappe/docs/index.txt
Removing frappe/docs/index.html
Removing frappe/docs/contents.py
Removing frappe/docs/contents.html
Removing frappe/desk/page/setup_wizard/setup_wizard_page.html
Removing frappe/desk/page/setup_wizard/setup_wizard_message.html
Removing frappe/desk/page/setup_wizard/setup_wizard.css
Removing frappe/desk/page/modules/modules_sidebar_item.html
Removing frappe/desk/page/modules/modules_sidebar.html
Removing frappe/core/page/user_permissions/user_permissions.py
Removing frappe/core/page/user_permissions/user_permissions.json
Removing frappe/core/page/user_permissions/user_permissions.js
Removing frappe/core/page/user_permissions/__init__.py
Removing frappe/core/page/user_permissions/README.md
Removing frappe/core/page/data_import_tool/data_import_tool_columns.html
Removing frappe/core/page/data_import_tool/data_import_tool.json
Removing frappe/core/page/data_import_tool/data_import_tool.js
Removing frappe/core/page/data_import_tool/data_import_tool.css
Removing frappe/core/page/data_import_tool/data_import_main.html
Removing frappe/core/page/data_import_tool/__init__.py
Auto-merging frappe/core/doctype/data_import/test_data_import.py
Auto-merging frappe/core/doctype/data_import/importer.py
Auto-merging frappe/core/doctype/data_import/exporter.py
Auto-merging frappe/core/doctype/data_import/data_import.py
Removing frappe/core/doctype/authentication_log/authentication_log.py
Removing frappe/core/doctype/authentication_log/authentication_log.js
Removing frappe/core/doctype/authentication_log/__init__.py
Auto-merging frappe/core/doctype/activity_log/test_activity_log.py
Auto-merging frappe/core/doctype/activity_log/feed.py
Auto-merging frappe/core/doctype/activity_log/activity_log_list.js
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Auto-merging .gitignore
CONFLICT (content): Merge conflict in .gitignore
Automatic merge failed; fix conflicts and then commit the result.

frappe@ip:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Updating 84c5719..de5f2fd
error: Your local changes to the following files would be overwritten by merge:
        .gitignore
        README.md
        bench/app.py
        bench/commands/__init__.py
        bench/commands/install.py
        bench/commands/make.py
        bench/commands/setup.py
        bench/config/templates/Procfile
        bench/utils.py
        playbooks/README.md
        playbooks/create_user.yml
        playbooks/install.py
Please, commit your changes or stash them before you can merge.
Aborting
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 34, in update
    update_bench()
  File "/home/frappe/bench-repo/bench/utils.py", line 253, in update_bench
    exec_cmd("git pull", cwd=cwd)
  File "/home/frappe/bench-repo/bench/utils.py", line 152, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull

I corrected the error in upstream url. But still I get git pull error.

Hi,
Looks like the issue is with the bench repo, go to bench repo folder and do a git checkout.
Thanks

Have you made changes to the server-side software?
I assume not. Therefore:

do:
1.frappe@ip:~/frappe-bench$ bench switch-to-master
2.frappe@ip:~/frappe-bench$ git reset --hard
3. frappe@ip:~/frappe-bench/apps/frappe$ git reset --hard
4.frappe@ip:~/frappe-bench/apps/erpnext$ git reset --hard
5.frappe@ip:~/frappe-bench$ git reset --hard

switches all apps including bench to master branch. You might need to do git stash in each of the folders in the apps to disregard server-side changes. Once this is done, do the magical step:

5.frappe@ip:~/frappe-bench$ bench update --reset

if you get permission issues, switch to a sudo user and navigate to the same folder and do the update.

Dear fineco and Ranjith…

Thanks for your advice. I’ll try this and let you know the result.

1 Like

Hi all…
I failed to restore the corrupted files.

So I created a fresh instance in AWS EC2, installed ERPNext and Frappe.
Downloaded the sites from old instance and trying to restore it to the sites in new instance.

What do you mean by you downloaded the sites? A restore only be made if you have the backup files and backup database. (not merely copying the site folder.)

check this link for a complete backup and restore guide.

Yeh Finco… you’re correct. I’d downloaded the db backup and restored it to new instance. Thanks for your support and guidance.

Pleasure… succeeded??

Thank you all… for support and help…:heart_eyes: