Got error message in bench

After long time not installing in Ubuntu, I did for a client.
But everytime I run a bench command I got this error:

$ supervisorctl restart frappe:
error: <class 'PermissionError'>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560

and the traceback:

ERROR:
Traceback (most recent call last):
  File "/home/sysadmin/.local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/home/sysadmin/.local/lib/python3.8/site-packages/bench/cli.py", line 121, in cli
    raise e
  File "/home/sysadmin/.local/lib/python3.8/site-packages/bench/cli.py", line 111, in cli
    bench_command()
  File "/home/sysadmin/.local/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/sysadmin/.local/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/sysadmin/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/sysadmin/.local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sysadmin/.local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/sysadmin/.local/lib/python3.8/site-packages/bench/commands/make.py", line 176, in remove_app
    bench.uninstall(app_name)
  File "/home/sysadmin/.local/lib/python3.8/site-packages/bench/bench.py", line 126, in uninstall
    self.reload()
  File "/home/sysadmin/.local/lib/python3.8/site-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/sysadmin/.local/lib/python3.8/site-packages/bench/bench.py", line 142, in reload
    restart_supervisor_processes(bench_path=self.name, web_workers=web)
  File "/home/sysadmin/.local/lib/python3.8/site-packages/bench/utils/bench.py", line 267, in restart_supervisor_processes
    bench.run(f"supervisorctl restart {group}")
  File "/home/sysadmin/.local/lib/python3.8/site-packages/bench/bench.py", line 43, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/home/sysadmin/.local/lib/python3.8/site-packages/bench/utils/__init__.py", line 126, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

What is wrong?
And how to correct it?
Thank you

Hi

Are you running “supervisorctl” inside frappe-bench folder ?

And is bench running in Production mode ?

try to run the command with sudo

yes

yes

I tried without sudo.
When with sudo error msg: sudo: bench: command not found.

I didn’t directly run supervisorctl. It is part of the bench remove-app command. Actually if any bench command involves the supervisorctl, it happens.

If I run the supervisorctl restart frappe directly, the same error:

error: <class 'PermissionError'>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560

and if I run supervisorctl restart frappe: (with colon) directly with sudo, the error:

frappe: ERROR (no such group)

and if I run supervisorctl restart frappe (without colon) directly with sudo, the error:

frappe: ERROR (no such process)

Hi @rahy

The first thing you would need to see is if supervisorctl in running all the processes.

sudo supervisorctl status

Output should be like below with all running.

If from the above any of the process is not running try stopping all and then starting all.

supervisorctl start all

To remove any app… you need to first uninstall it and the remove-app like below

bench --site uninstall-app <app_name>

bench remove-app <app_name>

let me know

I run the status and get 1 FATAL:

frappe-bench-redis:frappe-bench-redis-cache                 FATAL     Exited too quickly (process log may have details)
frappe-bench-redis:frappe-bench-redis-queue                 RUNNING   pid 46042, uptime 1 day, 4:40:18
frappe-bench-redis:frappe-bench-redis-socketio              RUNNING   pid 46043, uptime 1 day, 4:40:18
frappe-bench-web:frappe-bench-frappe-web                    RUNNING   pid 46044, uptime 1 day, 4:40:18
frappe-bench-web:frappe-bench-node-socketio                 RUNNING   pid 46045, uptime 1 day, 4:40:18
frappe-bench-workers:frappe-bench-frappe-default-worker-0   RUNNING   pid 46047, uptime 1 day, 4:40:18
frappe-bench-workers:frappe-bench-frappe-long-worker-0      RUNNING   pid 46052, uptime 1 day, 4:40:18
frappe-bench-workers:frappe-bench-frappe-schedule           RUNNING   pid 50804, uptime 23:18:36
frappe-bench-workers:frappe-bench-frappe-short-worker-0     RUNNING   pid 46051, uptime 1 day, 4:40:18

but running supervisorctl stop all or supervisorctl start all gives the same error:

error: <class 'PermissionError'>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560

Try redoing

sudo bench setup production

This should reinstall supervisor

As I mentioned on my second post above, run bench with sudo create this error:

sudo: bench: command not found

could you try without the sudo ??

the bench says such command need superuser priviledges:

WARN: superuser privileges required for this command

But what service is actually frappe?
Because the command error when this command runs:

supervisorctl restart frappe:

Welll then you need sudoers, try below

sudo bench setup sudoers $(whoami)

Still

sudo: bench: command not found

I remember there are posts about this bench commadn not found.
I’ll try to look it up

Probably need to reinstall bench

Yes… my last resort :slight_smile:
Doing a client’s installation so I tried minimum effort to reinstall.
This is why I’m done doing Ubuntu. Only doing CentOS and AlmaLinux now :slight_smile:

Thank you anyway @centaur

Comparing with other bench instance in other server (on CentOS), I see that this command should be:

supervisorctl restart frappe-bench-workers: frappe-bench-web:

where frappe-bench is the name of the bench.
Running it also gives similar error.

So I tried to find the supervisor.conf in Ubuntu structure, and find that there should be a symlink /etc/supervisor/conf.d/supervisor.conf that point to the frappe-bench/config/supervisor.conf

So I create the symlink

 sudo ln -s `pwd`/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf

And run the

bench setup supervisor

Then when running the command again it goes through. It restart the workers.
And other bench commands involving this restart of supervisorctl seems running well now.

I don’t know if this is the correct solution or not or why this error happen.
But it seems it solve my problems… at least for now :slight_smile:

2 Likes