Try ERPNext Buy Support Partners Foundation Foundation Members

[Solved] HELP! ERPNext Instance Breaks on Ubuntu 16.04 LTS update

I opened received a notification about updates on Ubuntu 16.04 LTS and i applied the update and now my ERPNext instance can no longer be accessed. this is what i get when i attempt bench restart:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 570, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2687, in load_entry_point
return ep.load()
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2341, in load
return self.resolve()
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2347, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/home/frappe/.bench/bench/cli.py”, line 3, in
from bench.utils import is_root, PatchError, drop_privileges, get_env_cmd, get_cmd_output, get_frappe
File “/home/frappe/.bench/bench/utils.py”, line 1, in
import os, sys, shutil, subprocess, logging, itertools, requests, json, platform, select, pwd, grp, multiprocessing, hashlib
File “/usr/lib/python2.7/dist-packages/requests/init.py”, line 53, in
from .packages.urllib3.contrib import pyopenssl
File “/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py”, line 54, in
import OpenSSL.SSL
File “/usr/lib/python2.7/dist-packages/OpenSSL/init.py”, line 8, in
from OpenSSL import rand, crypto, SSL
File “/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py”, line 118, in
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: ‘module’ object has no attribute ‘SSL_ST_INIT’

i tried to reinstall production but i get the same error breaking the installation process. I need help please!

pip uninstall pyopenssl
pip install pyopenssl

or

pip install -U pyopenssl

via StackOverflow

2 Likes

@strixaluco

Thanks for your reply. I ran the code and successfully uninstalled/reinstalled openssl. I am now able to start Bench and Nginx. However, instance is still down. I get the “sorry, we’ll be back soon error on my page”

Check logs at ~/frappe-bench/logs

Checked all the logs and i can’t find any error.

What does sudo supervisorctl status show?

Here’s the result:

ubuntu@ip-172-31-18-228:/home/frappe/frappe-bench$ sudo supervisorctl status
frappe-bench-redis:frappe-bench-redis-cache RUNNING pid 1571, uptime 1:13:52
frappe-bench-redis:frappe-bench-redis-queue RUNNING pid 1528, uptime 1:13:52
frappe-bench-redis:frappe-bench-redis-socketio RUNNING pid 1574, uptime 1:13:52
frappe-bench-web:frappe-bench-frappe-web FATAL Exited too quickly (process log may have details)
frappe-bench-web:frappe-bench-node-socketio RUNNING pid 11683, uptime 0:18:57
frappe-bench-workers:frappe-bench-frappe-default-worker-0 RUNNING pid 7049, uptime 0:00:01
frappe-bench-workers:frappe-bench-frappe-long-worker-0 STARTING
frappe-bench-workers:frappe-bench-frappe-schedule STARTING
frappe-bench-workers:frappe-bench-frappe-short-worker-0 STARTING

here’s the bench web error log:

[2017-09-07 16:57:39 +0000] [1614] [INFO] Starting gunicorn 19.7.1
[2017-09-07 16:57:39 +0000] [1614] [INFO] Listening at: http://127.0.0.1:8000 (1614)
[2017-09-07 16:57:39 +0000] [1614] [INFO] Using worker: sync
[2017-09-07 16:57:39 +0000] [1788] [INFO] Booting worker with pid: 1788
[2017-09-07 16:57:43 +0000] [1614] [INFO] Handling signal: term
[2017-09-07 16:57:43 +0000] [1788] [INFO] Worker exiting (pid: 1788)
[2017-09-07 16:57:43 +0000] [1614] [INFO] Shutting down: Master
[2017-09-07 16:57:50 +0000] [1867] [INFO] Starting gunicorn 19.7.1
[2017-09-07 16:57:50 +0000] [1867] [INFO] Listening at: http://127.0.0.1:8000 (1867)
[2017-09-07 16:57:50 +0000] [1867] [INFO] Using worker: sync
[2017-09-07 16:57:50 +0000] [1877] [INFO] Booting worker with pid: 1877
[2017-09-08 06:58:50 +0000] [1867] [INFO] Handling signal: term
[2017-09-08 06:58:50 +0000] [1877] [INFO] Worker exiting (pid: 1877)
[2017-09-08 06:58:50 +0000] [1867] [INFO] Shutting down: Master
Traceback (most recent call last):
File “/home/frappe/frappe-bench/env/bin/gunicorn”, line 7, in
from gunicorn.app.wsgiapp import run
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/gunicorn/app/ws$
from gunicorn.app.base import Application

Try sudo supervisorctl restart gunicorn

ubuntu@ip-172-31-18-228:/home/frappe/frappe-bench$ sudo supervisorctl restart gunicorn
gunicorn: ERROR (no such process)
gunicorn: ERROR (no such process)
ubuntu@ip-172-31-18-228:/home/frappe/frappe-bench$ cd
ubuntu@ip-172-31-18-228:~$ sudo supervisorctl restart gunicorn
gunicorn: ERROR (no such process)
gunicorn: ERROR (no such process)

I ran it from bench and root directories and got the same result

Yeah, sorry, I missed the part that gunicorn didn’t even start successfully.

Just to clear the situation out, after reinstalling pyopenssl you ran bench update, right?

i did and this is the error i got:

ubuntu@ip-172-31-18-228:/home/frappe/frappe-bench$ sudo bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Traceback (most recent call last):
File “./env/bin/pip”, line 7, in
from pip import main
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/init.py”, line 21, in
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/init.py”, line 62, in
from .packages.urllib3.exceptions import DependencyWarning
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/init.py”, line 29, in
import urllib3
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/urllib3/init.py”, line 8, in
from .connectionpool import (
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/urllib3/connectionpool.py”, line 29, in
from .connection import (
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/urllib3/connection.py”, line 2, in
import datetime
ImportError: No module named datetime
Please install these dependencies using the command:
sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
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 62, in update
_update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force, reset=reset)
File “/home/frappe/.bench/bench/commands/update.py”, line 76, in _update
before_update(bench_path=bench_path, requirements=requirements)
File “/home/frappe/.bench/bench/utils.py”, line 706, in before_update
validate_pillow_dependencies(bench_path, requirements)
File “/home/frappe/.bench/bench/utils.py”, line 714, in validate_pillow_dependencies
exec_cmd("{pip} install Pillow".format(pip=pip))
File “/home/frappe/.bench/bench/utils.py”, line 140, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install Pillow

The assumption based on the above is that Pillow is not installed. I then run the pillow install command and this is what i get:

ubuntu@ip-172-31-18-228:~$ sudo -H pip install Pillow
Requirement already satisfied: Pillow in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: olefile in /usr/local/lib/python2.7/dist-packages (from Pillow)

Try this solution:

Nope!!! Didn’t work. I guess at this point it will be wise to advise noobs like me who don’t have deep knowledge of coding to stay away from the latest Ubuntu 16.04 LTS update until the ERPNext developer team encounter this issue and issue a fix or workaround.

UPDATE:

Ignore my post above, it worked!!! Now i don’t know which exact steps restored my site so i’ll advise anyone who reads the post after facing this error to attempt all the steps i followed as indicated in this post as i cannot say if its the last solution or a combination of solutions that did the trick!

@strixaluco thanks so much for taking the time to work each step with me. Your help is very much appreciated.

1 Like

Have you tried this one as well?

No problems. Basically you could’ve figured out the same by yourself, searching the forum or StackOverflow — all solutions are here :wink:
Glad it works now.

I faced similar issue and following worked for me

pip install -U pyopenssl

1 Like

I got the same problem and tried all above solutions provided, but seems it’s not working.

INFO:bench.utils:./env/bin/pip install Pillow
Traceback (most recent call last):
File “./env/bin/pip”, line 6, in
from pip._internal import main
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_internal/init.py”, line 19, in
from pip._vendor.urllib3.exceptions import DependencyWarning
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/urllib3/init.py”, line 8, in
from .connectionpool import (
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/urllib3/connectionpool.py”, line 29, in
from .connection import (
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.py”, line 2, in
import datetime
ImportError: No module named datetime
Please install these dependencies using the command:
sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
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 60, in update
_update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
File “/home/frappe/bench-repo/bench/commands/update.py”, line 70, in _update
before_update(bench_path=bench_path, requirements=requirements)
File “/home/frappe/bench-repo/bench/utils.py”, line 759, in before_update
validate_pillow_dependencies(bench_path, requirements)
File “/home/frappe/bench-repo/bench/utils.py”, line 767, in validate_pillow_dependencies
exec_cmd("{pip} install Pillow".format(pip=pip))
File “/home/frappe/bench-repo/bench/utils.py”, line 159, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install Pillow