Bench update error after upgraded V13 --> V14

Dear All,
I’m using V13 and just upgraded to V14 last week.
After upgrade I can access to system for using but when I run Bench Update to get the latest update, the system show error. It seem relate to Python:


Is there anyone having this problem.
Thanks
Dharma

Hi,

May we know why the update command is being issued by root? Is that how it has been done in the past?

I used root for V13 and no problem, You mean we should use frappe user, right?

I do not know that having the root user has anything to do with the error,. If you can try as a non root user and see if the message happens. If it does, try bench update --reset.

Thanks for your reply, still the same error for frappe user and error still happen when I use bench update --reset command:

Review the steps taken to perform the upgrade. Share them here if you like.

I follow the guide from this post to upgrade: How I upgraded from v13 to v14 and Ubuntu 20.04 LTS to 22.04 LTS

It’s seems like either basename or git commands may be missing from your setup. Try typing basename in the command line to see what happens.

It show like below:
image
Thanks

Try executing the following code in the ~/frappe-bench/apps/frappe directory to see what happens:

basename $(git symbolic-ref -q HEAD)

Also, do you have a folder in the ~/frappe-bench/apps directory that is not a git repository?

Do not upgrade as the root user! There are only a couple of times you need to use sudo. If you use root when installing/updating/upgrading, it will not go well.

1 Like

Yes @snv ~/frappe-bench/apps is not a git repository.

Also, do you have a folder in the ~/frappe-bench/apps directory that is not a git repository?

I was referring to the folders inside apps directory, not the apps directory itself.

@snv, I have checked as you advised and found some folder such as “chat” and “erpnext” shown this error :“fatal: detected dubious ownership in repository at ‘/home/frappe/frappe-bench/apps/erpnext’…”.
Then I run this command as system recommended: “git config --global --add safe.directory /home/frappe/frappe-bench/apps/erpnext”
Now I run again update command: bench update --reset --no-backup and system shown a different error:


Setting up requirements…
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
Installing 5 applications…
Installing frappe
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/frappe
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
WARNING: Ignoring invalid distribution -rappe (/home/frappe/frappe-bench/env/lib/python3.10/site-packages)
$ yarn install
yarn install v1.22.19
warning …/…/package.json: No license field
[1/5] Validating package.json…
[2/5] Resolving packages…
[3/5] Fetching packages…
[4/5] Linking dependencies…
warning " > @frappe/esbuild-plugin-postcss2@0.1.3" has unmet peer dependency “less@^4.x”.
warning " > @frappe/esbuild-plugin-postcss2@0.1.3" has unmet peer dependency “stylus@^0.x”.
warning Workspaces can only be enabled in private projects.
error An unexpected error occurred: “EPERM: operation not permitted, chmod ‘/home/frappe/frappe-bench/apps/frappe/node_modules/@frappe/esbuild-plugin-postcss2/node_modules/.bin/autoprefixer’”.
info If you think this is a bug, please open a bug report with the information provided in “/home/frappe/frappe-bench/apps/frappe/yarn-error.log”.
info Visit yarn install | Yarn for documentation about this command.
ERROR:
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 127, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 1128, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1053, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 754, in invoke
return __callback(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/commands/update.py”, line 59, in update
update(
File “/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py”, line 425, in update
bench.setup.requirements()
File “/usr/local/lib/python3.10/dist-packages/bench/utils/render.py”, line 105, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/bench.py”, line 441, in requirements
app = App(path_to_app, bench=self.bench, to_clone=False).install(
File “/usr/local/lib/python3.10/dist-packages/bench/utils/render.py”, line 126, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/app.py”, line 230, in install
install_app(
File “/usr/local/lib/python3.10/dist-packages/bench/app.py”, line 569, in install_app
bench.run(“yarn install”, cwd=app_path)
File “/usr/local/lib/python3.10/dist-packages/bench/bench.py”, line 47, in run
return exec_cmd(cmd, cwd=cwd or self.cwd)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 155, in exec_cmd
raise CommandFailedError
bench.exceptions.CommandFailedError

I think I already fixed this issue, after check repository and fixed ownership error I found in my system have two user frappe and erpnext so grant access right to only one user erpnext by this command: sudo chown -R erpnext:erpnext *
And now I run again bench update, everything is ok now.


Thanks a lot for your support and advised me @smino @snv

1 Like