IOError: [Errno 13] Permission denied: '/home/frappe/patches.txt'

I am using ERPNext v7.2.21 and Frappe Framework v7.2.17.
I tried to update the version by using command “bench update”
The result was:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/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/bench/commands/update.py”, line 31, in update
patches.run(bench_path=‘.’)
File “/home/frappe/.bench/bench/patches/init.py”, line 27, in run
with open(target_patch_file, ‘w’) as f:
IOError: [Errno 13] Permission denied: ‘/home/frappe/patches.txt’

Try

~frappe-bench$ sudo bench update

I did the same now and the result was:

This update will cause a major version change in Frappe/ERPNext from 7 to 8.
This would take significant time to migrate and might break custom apps. Please run bench update --upgrade to confirm.

@ameerbabu
Yes… so what is your point?

running the full upgrade to vers8 from 7.3.31 production master i get this error :frowning:

Executing frappe.patches.v8_0.rename_page_role_to_has_role #2017-03-16 in li1370-250.members.linode.com (1bd3e0294da19198)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/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
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/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/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 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/frappe/frappe/patches/v8_0/rename_page_role_to_has_role.py”, line 9, in execute
frappe.rename_doc(‘DocType’, ‘Page Role’, ‘Has Role’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 668, in rename_doc
return rename_doc(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/rename_doc.py”, line 75, in rename_doc
new_doc.add_comment(‘Edit’, _(“renamed from {0} to {1}”).format(frappe.bold(old), frappe.bold(new)))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 977, in add_comment
out.insert(ignore_permissions=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 194, in insert
self._validate()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 400, in _validate
self._validate_mandatory()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 620, in _validate_mandatory
name=self.name))
frappe.exceptions.MandatoryError: [Version, _VER000007]: doclist_json

sorry wrong topic posted to

i ran this , but i got the following response:
“You should not run this command as root”

i wonder what is the problem now??

PermissionError: [Errno 13] Permission denied: ‘/home/azahra-erp/frappe-bench/sites/demo-4/patches.txt’