Fresh Install ERPNext on Ubuntu 16.04.4 LTS failed

Could someone please guide how to move forward on Installation

Hosting Service Provider
Scaleway Cloud

Environment

root@scw-3d1882:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

Error Trace

Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [765 k                                                                                        B]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [6                                                                                        23 kB]
Fetched 1,604 kB in 1s (1,304 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
libffi-dev is already the newest version (3.2.1-4).
python-setuptools is already the newest version (20.7.0-1).
git is already the newest version (1:2.7.4-0ubuntu1.3).
libssl-dev is already the newest version (1.0.2g-1ubuntu4.12).
python-dev is already the newest version (2.7.12-1~16.04).
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
The directory '/home/frappe/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/frappe/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already up-to-date: setuptools in /usr/local/lib/python2.7/dist-packages
Requirement already up-to-date: pip==9.0.3 in /usr/local/lib/python2.7/dist-packages
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The directory '/home/frappe/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/frappe/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: ansible in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: jinja2 in /usr/local/lib/python2.7/dist-packages (from ansible)
Requirement already satisfied: PyYAML in /usr/lib/python2.7/dist-packages (from ansible)
Requirement already satisfied: paramiko in /usr/local/lib/python2.7/dist-packages (from ansible)
Requirement already satisfied: cryptography in /usr/local/lib/python2.7/dist-packages (from ansible)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from ansible)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python2.7/dist-packages (from jinja2->ansible)
Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python2.7/dist-packages (from paramiko->ansible)
Requirement already satisfied: bcrypt>=3.1.3 in /usr/local/lib/python2.7/dist-packages (from paramiko->ansible)
Requirement already satisfied: pynacl>=1.0.1 in /usr/local/lib/python2.7/dist-packages (from paramiko->ansible)
Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /usr/local/lib/python2.7/dist-packages (from cryptography->ansible)
Requirement already satisfied: enum34; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from cryptography->ansible)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python2.7/dist-packages (from cryptography->ansible)
Requirement already satisfied: idna>=2.1 in /usr/local/lib/python2.7/dist-packages (from cryptography->ansible)
Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from cryptography->ansible)
Requirement already satisfied: ipaddress; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from cryptography->ansible)
Requirement already satisfied: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography->ansible)
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
 [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source

 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAY [localhost] *******************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [localhost]

TASK [Create user] *****************************************************************************************************************************************************
ok: [localhost]

TASK [Set home folder perms] *******************************************************************************************************************************************
changed: [localhost]

TASK [Set home folder perms] *******************************************************************************************************************************************
skipping: [localhost]

TASK [Set /tmp/.bench folder perms] ************************************************************************************************************************************
ok: [localhost]

TASK [Change default shell to bash] ************************************************************************************************************************************
changed: [localhost]

PLAY RECAP *************************************************************************************************************************************************************
localhost                  : ok=5    changed=2    unreachable=0    failed=0

Passwords saved at ~/passwords.txt
 [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source

 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAY [localhost] *******************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [localhost]

TASK [common : include_tasks] ******************************************************************************************************************************************
included: /tmp/.bench/playbooks/roles/common/tasks/debian_family.yml for localhost

TASK [common : Install prerequisites using apt-get] ********************************************************************************************************************
ok: [localhost] => (item=[u'dnsmasq', u'fontconfig', u'git', u'htop', u'libcrypto++-dev', u'libfreetype6-dev', u'liblcms2-dev', u'libssl-dev', u'libwebp-dev', u'libxext6', u'libxrender1', u'libxslt1-dev', u'libxslt1.1', u'libffi-dev', u'ntp', u'postfix', u'python-dev', u'python3-dev', u'python-tk', u'screen', u'vim', u'xfonts-75dpi', u'xfonts-base', u'zlib1g-dev', u'apt-transport-https', u'libsasl2-dev', u'libldap2-dev'])

TASK [common : include_tasks] ******************************************************************************************************************************************
skipping: [localhost]

TASK [common : include_tasks] ******************************************************************************************************************************************
included: /tmp/.bench/playbooks/roles/common/tasks/ubuntu.yml for localhost

TASK [common : install pillow prerequisites for Ubuntu < 14.04] ********************************************************************************************************
[DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of using `result|version_compare` instead use `result is version_compare`. This feature will be
removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
skipping: [localhost] => (item=[])

TASK [common : install pillow prerequisites for Ubuntu >= 14.04] *******************************************************************************************************
[DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of using `result|version_compare` instead use `result is version_compare`. This feature will be
removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
ok: [localhost] => (item=[u'libjpeg8-dev', u'libtiff5-dev', u'tcl8.6-dev', u'tk8.6-dev'])

TASK [common : include_tasks] ******************************************************************************************************************************************
skipping: [localhost]

TASK [locale : Check current locale] ***********************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "localectl", "delta": "0:00:00.054906", "end": "2018-04-26 04:31:02.006419", "msg": "non-zero return code", "rc": 1, "start": "2018-04-26 04:31:01.951513", "stderr": "Could not get properties: Connection timed out", "stderr_lines": ["Could not get properties: Connection timed out"], "stdout": "", "stdout_lines": []}
        to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *************************************************************************************************************************************************************
localhost                  : ok=5    changed=0    unreachable=0    failed=1

Traceback (most recent call last):
  File "install.py", line 417, in <module>
    install_bench(args)
  File "install.py", line 122, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 338, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=frappe']' returned non-zero exit status 2

PIP Version

root@scw-3d1882:~# pip --version
pip 9.0.3 from /usr/local/lib/python2.7/dist-packages (python 2.7)

Thanks

Hi.

Can you share the steps you performed and when exactly did the error occurred?

My Steps

usr: root
sudo apt-get update
sudo apt-get install python-minimal
sudo apt-get install build-essential python-setuptools
sudo adduser frappe
sudo usermod -aG sudo frappe
su - frappe

usr: frappe
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
sudo python install.py --production

Try this command

sudo python install.py --production --user frappe

infact that was not going to make any difference, still i ran the command but ended up with same error

Hi your error has to do with a network timeout

It seems scaleway is the problem Install Error on Ubuntu 16.04 - TASK [locale : Check current locale]

1 Like

I migrated from Scaleway for the same reason. In retrospect, I think the error was due to the default repo’s/sources the VMs were using after encountering this again with Linode. Try changing your sources to Ubuntu sources. Worked for me!

Does that mean that “apt-get update” was going to the wrong locations for information?

Can you share with us how you changed the sources?

I would have a difficult time figuring that out for myself and I think it would be good information to have.

Thank you in advance.

BKM

Sorry could not get what you are trying to convey.

Could you please point exact correction in my steps.

usr: root
sudo apt-get update
sudo apt-get install python-minimal
sudo apt-get install build-essential python-setuptools
sudo adduser frappe
sudo usermod -aG sudo frappe
su - frappe

usr: frappe
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
sudo python install.py --production

Your sources are in /etc/apt/sources.list

  1. Verify you your sources are by your hosting provider with sudo nano /etc/apt/sources.list. You can tell if by most of the sources have your hosting providers name…

If you have deb http://yourhost.com/ubuntu/ xenial main

Instead of something like:

deb http://archive.ubuntu.com/ubuntu/ xenial main

  1. Restore your (Ubuntu 16.x) sources list you can simply paste the following into /etc/apt/sources.list:

    deb Index of /ubuntu xenial main restricted universe multiverse
    deb-src Index of /ubuntu xenial main restricted universe multiverse
    deb Index of /ubuntu xenial-updates main restricted universe multiverse
    deb-src Index of /ubuntu xenial-updates main restricted universe multiverse
    deb Index of /ubuntu xenial-backports main restricted universe multiverse
    deb-src Index of /ubuntu xenial-backports main restricted universe multiverse
    deb Index of /ubuntu xenial-security main restricted universe multiverse
    deb-src Index of /ubuntu xenial-security main restricted universe multiverse
    deb Index of /ubuntu xenial partner
    deb-src Index of /ubuntu xenial partner

Source: Ubuntu 16.04 messed sources.list - Ask Ubuntu

  1. Run sudo apt-get update

  2. Retry ERPNext installation

Note @jignesh_shah : You won’t find this in the Bench Setup guide because it is not part of ERPNext setup, but preparing the server (default environment) for ERPNext installation. Do this before installing bench.

Thanks for the detail.

Did the above steps on fresh server , got the below error. Any guidance on this would help a lot.

TASK [locale : Check current locale] ***********************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "localectl", "delta": "0:00:00.038960", "end": "2018-04-30 12:22:11.873867", "msg": "non-zero return code", "rc": 1, "start": "2018-04-30 12:22:11.834907", "stderr": "Could not get properties: Connection timed out", "stderr_lines": ["Could not get properties: Connection timed out"], "stdout": "", "stdout_lines": []}
        to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *************************************************************************************************************************************************************
localhost                  : ok=5    changed=2    unreachable=0    failed=1

Traceback (most recent call last):
  File "install.py", line 417, in <module>
    install_bench(args)
  File "install.py", line 122, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 338, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=frappe']' returned non-zero exit status 2

Note : By the way the sources were as below

deb http://archive.ubuntu.com/ubuntu xenial main universe
deb-src http://archive.ubuntu.com/ubuntu xenial-updates main universe
deb http://archive.ubuntu.com/ubuntu xenial-security main universe

still i replaced with your list.

I usually use the following
usr: root
sudo apt-get update
sudo apt-get install python-minimal
sudo apt-get install build-essential python-setuptools
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
sudo python install.py --production --user frappe

but today I have error too
TASK [Set home folder perms] ****************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OSError: [Errno 2] No such file or directory: ‘/home/frappe/frappe-bench/node_modules/.bin/…/rimraf/bin.js’
fatal: [localhost]: FAILED! => {“changed”: false, “module_stderr”: “Traceback (most recent call last):\n File "/tmp/ansible_oauNs3/ansible_module_file.py", line 473, in \n main()\n File "/tmp/ansible_oauNs3/ansible_module_file.py", line 350, in main\n changed |= recursive_set_attributes(module, to_bytes(file_args[‘path’], errors=‘surrogate_or_strict’), follow, file_args)\n File "/tmp/ansible_oauNs3/ansible_module_file.py", line 172, in recursive_set_attributes\n changed |= module.set_fs_attributes_if_different(tmp_file_args, changed, expand=False)\n File "/tmp/ansible_oauNs3/ansible_modlib.zip/ansible/module_utils/basic.py", line 1507, in set_fs_attributes_if_different\n File "/tmp/ansible_oauNs3/ansible_modlib.zip/ansible/module_utils/basic.py", line 1164, in set_owner_if_different\n File "/tmp/ansible_oauNs3/ansible_modlib.zip/ansible/module_utils/basic.py", line 1059, in user_and_group\nOSError: [Errno 2] No such file or directory: ‘/home/frappe/frappe-bench/node_modules/.bin/…/rimraf/bin.js’\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE”, “rc”: 1}
to retry, use: --limit @/tmp/.bench/playbooks/create_user.retry

On a new server, after the sudo apt-get update command

run

sudo apt-get upgrade
sudo apt-get dist-upgrade

I really think this is OS related.

Also install Bench as a non-root user. This is a best practice emphasised by the Community. Create the frappe user manually and use that for your installation.

I think it’s something wrong in install.py
/node_modules is under /frappe folder
while script search for in /frappe-bench (/home/frappe/frappe-bench/node_modules/.bin)

"
/node_modules is under /frappe folder
while script search for in /frappe-bench (/home/frappe/frappe-bench/node_modules/.bin)
"

@hnaga by mistake perhaps you ran ‘bench update’ in /home/frappe and not /home/frappe/frappe-bench as expected - that is why you have node_modules in /home/frappe !?

The convention is bench commands must be run from frappe-bench by user with sudo privileges.

This is what the script did.
I don’t know why node_modules is under frappe not frappe-bench
do you have any idea?

may be installing npm?

Thanks for such a complete explanation. That is exactly what I needed to see. I think I could get around the issue now if it were related to incorrect sources.

Bravo!

BKM

1 Like

"
This is what the script did.
I don’t know why node_modules is under frappe not frappe-bench
do you have any idea?
"

What I am suggesting is this: What the install script did is based and what you did where and only you know that :wink:

not with you @clarkej
The script is not should install all dependencies then install ERPNext
I don’t have options to install node_modules under frappe or under frappe-bench

I used this script may be 10 times and usually have errors and should find a way to fix manually ,

and Now if you run the scrip on a fresh VPS you willl get
fatal: [localhost]: FAILED! => {“changed”: false, “cmd”: “npm install -g yarn”, “msg”: “[Errno 2] No such file or directory”, “rc”: 2}