Try ERPNext Buy Support Partners Foundation

Easy Install Failed on Ubuntu 18.04 LTS

Hi everyone, I have tried twice to install the ERPNext via script as per the directions on Github. https://github.com/frappe/bench It didn’t work, but I have the logs for the install attempt here.

I can’t seem to upload the logfile but here is the last part of the file:

TASK [psutil : Install psutil] ************************************************* task path: /tmp/.bench/playbooks/roles/psutil/tasks/main.yml:2 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p " echo /root/.ansible/tmp/ansible-tmp-1580658702.6955245-55360771482435 " && echo ansible-tmp-1580658702.6955245-55360771482435=" echo /root/.ansible/tmp/ansible-tmp-1580658702.6955245-55360771482435 `" ) && sleep 0’
Using module file /usr/local/lib/python3.6/dist-packages/ansible/modules/packaging/language/pip.py
<127.0.0.1> PUT /home/jimmyhoffa/.ansible/tmp/ansible-local-6472c0gimr0y/tmpve3gc1a6 TO /root/.ansible/tmp/ansible-tmp-1580658702.6955245-55360771482435/AnsiballZ_pip.py
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1580658702.6955245-55360771482435/ /root/.ansible/tmp/ansible-tmp-1580658702.6955245-55360771482435/AnsiballZ_pip.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1580658702.6955245-55360771482435/AnsiballZ_pip.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1580658702.6955245-55360771482435/ > /dev/null 2>&1 && sleep 0’
fatal: [localhost]: FAILED! => {
“changed”: false,
“cmd”: [
“/usr/local/bin/pip3”,
“install”,
“-U”,
“psutil”
],
“invocation”: {
“module_args”: {
“chdir”: null,
“editable”: false,
“executable”: null,
“extra_args”: null,
“name”: [
“psutil”
],
“requirements”: null,
“state”: “latest”,
“umask”: null,
“use_mirrors”: true,
“version”: null,
“virtualenv”: null,
“virtualenv_command”: “virtualenv”,
“virtualenv_python”: null,
“virtualenv_site_packages”: false
}
},
“msg”: “stdout: Collecting psutil\n Downloading psutil-5.6.7.tar.gz (448 kB)\nBuilding wheels for collected packages: psutil\n Building wheel for psutil (setup.py): started\n Building wheel for psutil (setup.py): finished with status ‘done’\n Created wheel for psutil: filename=psutil-5.6.7-cp36-cp36m-linux_x86_64.whl size=281520 sha256=e5b52819c9ff805a4ed5a5aabbf710f8627f5577f887140fd9b850f1f9c9effb\n Stored in directory: /tmp/pip-ephem-wheel-cache-t4h6cg_t/wheels/b2/b3/a3/551db06cebc9141c437c6b58aa751d3670471494e9f6d1428d\nSuccessfully built psutil\nInstalling collected packages: psutil\n Attempting uninstall: psutil\n Found existing installation: psutil 5.4.2\n\n:stderr: WARNING: The directory ‘/home/jimmyhoffa/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.\nERROR: Cannot uninstall ‘psutil’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.\n”
}

RUNNING HANDLER [mariadb : restart mysql] **************************************
task path: /tmp/.bench/playbooks/roles/mariadb/handlers/main.yml:2

PLAY RECAP *********************************************************************
localhost : ok=43 changed=15 unreachable=0 failed=1 skipped=35 rescued=0 ignored=0

Install script run at 15:49 on 2020-02-02
`

This is a recurring issue with the install script. I’ve encountered this issue before but can’t quite remember how it was resolved. But I know it’s an issue with user permissions.

I have tried following these steps here:

I’m letting it execute now. I have added erpnext as a new user to the system, added it to the sudoers list, and it just failed.

~$ sudo -H python3 install.py --production --site localhost --user erpnext --mysql-root-password 12345 --admin-password 12345 --bench-name testbench
[sudo] password for erpnext:
Logs are saved under /tmp/logs/easy-install__2020-02-10__21-55.log
Checking System Compatibility…
ubuntu 18 is compatible!
curl already installed!
wget already installed!
git already installed!
pip3 already installed!
ERROR: launchpadlib 1.10.6 requires testresources, which is not installed.
[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’
Input MySQL and Frappe Administrator passwords:
Passwords saved at ~/passwords.txt
[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’
[WARNING]: Could not find aptitude. Using apt-get instead
[WARNING]: Consider using the get_url or uri module rather than running
‘curl’. If you need to use command because get_url or uri is insufficient you
can add ‘warn: false’ to this command task or set ‘command_warnings=False’ in
ansible.cfg to get rid of this message.
Traceback (most recent call last):
File “install.py”, line 414, in
install_bench(args)
File “install.py”, line 230, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 351, in run_playbook
success = subprocess.check_call(args, cwd=os.path.join(cwd, ‘playbooks’), stdout=log_stream, stderr=sys.stderr)
File “/usr/lib/python3.6/subprocess.py”, line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’, ‘–become-user=erpnext’]’ returned non-zero exit status 2.

It looks like the same issue popped up here previously.
Install Failed - Ubuntu 18.04https://discuss.erpnext.com/t/install-failed-ubuntu-18-04/56898/6

Are you installing on Ubuntu 18.04? Also, convention dictates that your site should be yourdomain.com and the default site If not specified is site1.local so you should follow that convention in naming your site.

If you are still facing difficulty installing after a few hours I’ll spin up a test server and try to replicate your issue.

For your first ever install, it is probably best to drop all of the switches except – production and --user

Let the install script handle everything else in it’s own way. You can always change the other stuff after you get a successful install. Let’s just get it to work first.

The playbook changes frequently and can sometimes be a bit fragile. Use the least invasive method possible and ask as little of the script as you can get away with. This will serve you better and reduce the risk of errors. You will be prompted on the screen for the passwords during the running of the script.

Also, you can drop the -H when using Ubuntu 18.04 and up.

BKM

Your clue is in the error message

Run the command on the terminal and see why it is not starting
(I got this by unpacking the error message above)

ansible-playbook -c local site.yml -vvvv -e @/tmp/extra_vars.json –become –become-user=erpnext

So many errors (mostly in ansible) throw up that same error so it doesn’t necessarily say a lot about what was actually wrong with the install

The install steps are actually wrappers for the actual command. It may not be capturing all output from stderror. So we sometimes do not see the errors. It does however know that the command itself failed.

That is why, if you unpack the command and run it yourself, you will see the actual error that results from the failure of the command.

the output of running the site.yml playbook with the extra_vars is saved in the logs. that should capture stdout as well as stderr. As for the outputs of the commands run in the playbook, they too are a part of the same log file.

I tried running that single command and it returned an error:

erpnext@erpnext2-OptiPlex-360:~$ ansible-playbook -c local site.yml -vvvv -e @/tmp/extra_vars.json –become –become-user=erpnext
ansible-playbook 2.8.5
  config file = None
  configured module search path = ['/home/erpnext/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]
No config file found; using defaults
ERROR! the playbook: site.yml could not be found

Yes, 18.04.04 LTS. I’m not sure what to name the site, I don’t know if I can hook it to the corporate domain as I don’t know the details for it; I would prefer to use site1.local for now.

The plain-vanilla install script is having the same error/hiccup:

erpnext@erpnext2-OptiPlex-360:~$ sudo python3 install.py --production --user erpnext
[sudo] password for erpnext: 
Logs are saved under /tmp/logs/easy-install__2020-02-12__16-04.log
Checking System Compatibility...
ubuntu 18 is compatible!
curl already installed!
wget already installed!
git already installed!
pip3 already installed!
 [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'
Input MySQL and Frappe Administrator passwords:
Passwords saved at ~/passwords.txt
 [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'
 [WARNING]: Could not find aptitude. Using apt-get instead
Traceback (most recent call last):
  File "install.py", line 414, in <module>
    install_bench(args)
  File "install.py", line 230, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 351, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'), stdout=log_stream, stderr=sys.stderr)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=erpnext']' returned non-zero exit status 2.

Is this because site.yml doesn’t exist? If so, how do I specify the site? I don’t really care what the name is.

Should I upload the install logs? It seems that this site doesn’t allow me to upload a .log filetype…

The file is in bench-repo/playbooks/site.yml

OK, I was able to navigate to ~/.bench/playbooks and found site.yml; from there I tried to execute the command again and it exited with a different error:

~/.bench/playbooks$ ansible-playbook -c local site.yml -vvvv -e @/tmp/extra_vars.json –become –become-user=erpnext
ansible-playbook 2.8.5
  config file = None
  configured module search path = ['/home/erpnext2/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]
No config file found; using defaults
ERROR! the playbook: –become could not be found

Also, I have a second computer with a hard drive that has a working version of ERPNext on it, the thing is that this is the HD I pulled out of my test computer, and when I switched it to the other chassis I could run the server locally but the ethernet drivers apparently broke, so I have no ability to put it on the network. I can see that I did not use the script to install this, but went through and installed all the Python3 modules and MariaDB stuff manually. I’m not sure if I should work to clone the disk, switch the disk into the machine it was in and see if it magically fixes the Ethernet driver issue, or just keep plugging on this fresh install. If worse comes to worse, I could execute the same sequence of commands I used to get the original server up as I can still see the entire history in that Bash prompt and do the same sequence of steps. Seems like a rather inelegant solution, though.

I think you have to use the formats correctly.
-become (single ‘-’ )
–become-user (double ‘-’ )

I tried the method and got the same error.

This is just a cut-and-paste of the failed command; does this mean that the .py script has the same syntax error? I changed the double hyphen to a single hyphen and it failed, but in a different way. Before changing the hyphens I got this result:

erpnext2@erpnext2-OptiPlex-360:~/.bench/playbooks$ ansible-playbook -c local site.yml -vvvv -e @/tmp/extra_vars.json –become –become-user=erpnext
ansible-playbook 2.8.5
  config file = None
  configured module search path = ['/home/erpnext2/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]
No config file found; using defaults
ERROR! the playbook: –become could not be found

Then, after the change you suggested I got this more lengthy result:

erpnext2@erpnext2-OptiPlex-360:~/.bench/playbooks$ ansible-playbook -c local site.yml -vvvv -e @/tmp/extra_vars.json -become -become-user=erpnext
ansible-playbook 2.8.5
  config file = None
  configured module search path = ['/home/erpnext2/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]
No config file found; using defaults
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [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'

statically imported: /home/erpnext2/.bench/playbooks/roles/mariadb/tasks/centos.yml
statically imported: /home/erpnext2/.bench/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml
statically imported: /home/erpnext2/.bench/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.6/dist-packages/ansible/plugins/callback/default.py

PLAYBOOK: site.yml *****************************************************************************************************************************************************************************
Positional arguments: site.yml
verbosity: 4
connection: local
timeout: 10
become: True
become_method: sudo
tags: ('all',)
inventory: ('/etc/ansible/hosts',)
extra_vars: ('@/tmp/extra_vars.json', 'come', 'come-user=erpnext')
forks: 5
2 plays in site.yml

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

TASK [Gathering Facts] *************************************************************************************************************************************************************************
task path: /home/erpnext2/.bench/playbooks/site.yml:4
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: erpnext2
<127.0.0.1> EXEC /bin/sh -c 'echo ~erpnext2 && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/erpnext2/.ansible/tmp/ansible-tmp-1581609245.9631436-16810903869955 `" && echo ansible-tmp-1581609245.9631436-16810903869955="` echo /home/erpnext2/.ansible/tmp/ansible-tmp-1581609245.9631436-16810903869955 `" ) && sleep 0'
Using module file /usr/local/lib/python3.6/dist-packages/ansible/modules/system/setup.py
<127.0.0.1> PUT /home/erpnext2/.ansible/tmp/ansible-local-19912_7le1gca/tmpfe876cdp TO /home/erpnext2/.ansible/tmp/ansible-tmp-1581609245.9631436-16810903869955/AnsiballZ_setup.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/erpnext2/.ansible/tmp/ansible-tmp-1581609245.9631436-16810903869955/ /home/erpnext2/.ansible/tmp/ansible-tmp-1581609245.9631436-16810903869955/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n  -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-pldcatqatcuzndwamgmujyiultokilzu ; /usr/bin/python3 /home/erpnext2/.ansible/tmp/ansible-tmp-1581609245.9631436-16810903869955/AnsiballZ_setup.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/erpnext2/.ansible/tmp/ansible-tmp-1581609245.9631436-16810903869955/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "ansible_facts": {},
    "changed": false,
    "failed_modules": {
        "setup": {
            "failed": true,
            "module_stderr": "sudo: a password is required\n",
            "module_stdout": "",
            "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
            "rc": 1
        }
    },
    "msg": "The following modules failed to execute: setup\n"
}

PLAY RECAP *************************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0