Problem in Update --patch

Updating DocTypes for frappe : [========================================]
Updating DocTypes for erpnext : [========================================]
Updating customizations for Address
Generating Website Theme Files…
Compiling Python Files…
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.local/lib/python3.6/site-packages/bench/cli.py”, line 41, in cli
bench_command()
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.local/lib/python3.6/site-packages/bench/commands/update.py”, line 25, in update
update(pull=pull, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, force=force, reset=reset)
File “/home/frappe/.local/lib/python3.6/site-packages/bench/utils.py”, line 213, in update
restart_supervisor_processes(bench_path=bench_path)
File “/home/frappe/.local/lib/python3.6/site-packages/bench/utils.py”, line 519, in restart_supervisor_processes
supervisor_status = subprocess.check_output([‘sudo’, ‘supervisorctl’, ‘status’], cwd=bench_path)
File “/usr/lib/python3.6/subprocess.py”, line 356, in check_output
**kwargs).stdout
File “/usr/lib/python3.6/subprocess.py”, line 438, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘[‘sudo’, ‘supervisorctl’, ‘status’]’ returned non-zero exit status 4.

I see this error when trying to run bench update --patch and bench restart

What do you get when you run this:

frappe@frappe-bench:~/frappe-bench$ sudo supervisorctl status all

An orphan process perhaps prevents the restart from succeeding, so you may need to kill it manually. After sudo supervisorctl stop all expect to see this:

frappe@ubuntu:~/frappe-bench$ sudo supervisorctl status all
frappe-bench-redis:frappe-bench-redis-cache                 STOPPED   May 31 07:43 AM
frappe-bench-redis:frappe-bench-redis-queue                 STOPPED   May 31 07:43 AM
frappe-bench-redis:frappe-bench-redis-socketio              STOPPED   May 31 07:43 AM
frappe-bench-web:frappe-bench-frappe-web                    STOPPED   May 31 07:43 AM
frappe-bench-web:frappe-bench-node-socketio                 STOPPED   May 31 07:43 AM
frappe-bench-workers:frappe-bench-frappe-default-worker-0   STOPPED   May 31 07:43 AM
frappe-bench-workers:frappe-bench-frappe-long-worker-0      STOPPED   May 31 07:43 AM
frappe-bench-workers:frappe-bench-frappe-schedule           STOPPED   May 31 07:43 AM
frappe-bench-workers:frappe-bench-frappe-short-worker-0     STOPPED   May 31 07:43 AM

Then what processes does this report, something like this say:

frappe@ubuntu:~/frappe-bench$ sudo netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:51945           0.0.0.0:*               LISTEN      1294/rpc.mountd 
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      1710/mysqld     
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      3016/redis-server 1
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1275/rpcbind    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3176/nginx -g daemo
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      968/dnsmasq     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1282/sshd       
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      2327/master     
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      3176/nginx -g daemo
tcp        0      0 0.0.0.0:53308           0.0.0.0:*               LISTEN      1294/rpc.mountd 
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:45156           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:44071           0.0.0.0:*               LISTEN      1294/rpc.mountd 
tcp6       0      0 :::41357                :::*                    LISTEN      -               
tcp6       0      0 :::39918                :::*                    LISTEN      1294/rpc.mountd 
tcp6       0      0 :::111                  :::*                    LISTEN      1275/rpcbind    
tcp6       0      0 :::53                   :::*                    LISTEN      968/dnsmasq     
tcp6       0      0 :::22                   :::*                    LISTEN      1282/sshd       
tcp6       0      0 :::42903                :::*                    LISTEN      1294/rpc.mountd 
tcp6       0      0 :::25                   :::*                    LISTEN      2327/master     
tcp6       0      0 :::32799                :::*                    LISTEN      1294/rpc.mountd 
tcp6       0      0 :::2049                 :::*                    LISTEN      -            

The above is from my distro:

frappe@ubuntu:~/frappe-bench$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.6 LTS
Release:	16.04
Codename:	xenial

To run bench start may give you clues too.

Maybe rerun the update a few more times…

frappe@hro:~/frappe-bench$ sudo supervisorctl status all
unix:///var/run/supervisor.sock refused connection
frappe@hro:~/frappe-bench$

This helps -

A web search on this will land you lots to try.

Let us know what you determine or learn in your case thanks!