**UPDATE**Move /tmp/.bench error in Centos 7 & Debian 8 with install.py

Ok. I started trying to get the install.py script to run properly on CentOS 7 yesterday and first ran into NGINX errors that were resolved by setting selinux to Permissive BEFORE running the install.py script. You can find more on that at this link:


UPDATE 1/18/2017 This same issue started happening with Debian v8 servers today. A fresh dump further down thread.


Once I was able to get past the selinux issues, the install.py ran into another problem when trying to move /tmp/,bench. So I am posting that error here and hopefully someone will have some idea how I can get past this point in the install:


TASK [Check if /tmp/.bench exists] *****************************************************************************
ok: [localhost]
TASK [Check if bench_repo_path exists] *************************************************************************
ok: [localhost]
TASK [move /tmp/.bench if it exists] ***************************************************************************
fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: [“cp”, “-R”, “/tmp/.bench”, “/home/root/.bench”], "delta
": “0:00:00.005924”, “end”: “2018-01-16 16:18:23.592925”, “failed”: true, “rc”: 1, “start”: “2018-01-16 16:18:23
.587001”, “stderr”: “cp: cannot create directory ‘/home/root/.bench’: No such file or directory”, “stderr_lines”
: [“cp: cannot create directory ‘/home/root/.bench’: No such file or directory”], “stdout”: “”, “stdout_lines”:
}
to retry, use: --limit @/tmp/.bench/playbooks/production/install.retry
PLAY RECAP *****************************************************************************************************
localhost : ok=63 changed=45 unreachable=0 failed=1
Traceback (most recent call last):
File “install.py”, line 388, in
install_bench(args)
File “install.py”, line 114, in install_bench
run_playbook(‘production/install.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 326, in run_playbook
success = subprocess.check_call(args, cwd=os.path.join(cwd, ‘playbooks’))
File “/usr/lib64/python2.7/subprocess.py”, line 542, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘production/install.yml’, ‘-e’, ‘@/t
mp/extra_vars.json’, ‘–become’, ‘–become-user=erp_jmi’]’ returned non-zero exit status 2
[erp_jmi@cetnos7-test ~]$


Any ideas? It looks like it is running into trouble trying to create a new directory, but again the script is being run as “sudo” so it should not have trouble doing anything it wants.

I do however see this line;

to retry, use: --limit @/tmp/.bench/playbooks/production/install.retry

Does this indicate another valid switch called --limit that can be added to the install.py script start (like --production and --user)? I have never heard of it before. If it is valid, where can I find info about it?

BKM

Hi again

The /home/root directory looks decidedly iffy to me.

Normally the script will install to /home/frappe/frappe-bench

Are you running it with the correct user ?

When I am in the console, I am logged into the server as erp_jmi user. Then when I run the install script it looks like this:

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

So this should mean tht I am in fact using the right user login when I run it. You do seem to have something there though. It doesn’t really look like it should be trying to use the root directory.

BKM

There is an issue with the install script on Centos 7. For some reason the ansible scripts don’t realize that the user has sudo rights or something and instead falls back to placing everything in the /home/root directory instead of /home/[erp user]. Disabling selinux does not seem to have an effect. I work around this issue in my instructions

https://jwrober.github.io/erpnext_admin_guide/i-u-b/install

That being said, I could have sworn I had another conversation on this very subject when writing the install instructions for the guide and got an issue opened for it, but I can’t seem to find it now. :frowning:

1 Like

Agreed. However, it is important to still set selinux to “Permissive” in order to get it to allow the install of NGINX to complete.

BKM

Here is the same kind of “Move /temp/.bench” error but from a Debian 8 server install. Not quite identical but very close to the CentOS 7 type error.

I have done this on 4 different bare metal Debian 8 servers and this is the resulting error list:


TASK [Check if /tmp/.bench exists] **********************************************************
ok: [localhost]
TASK [Check if bench_repo_path exists] ******************************************************
ok: [localhost]
TASK [move /tmp/.bench if it exists] ********************************************************
fatal: [localhost]: FAILED! => {“failed”: true, “msg”: “Failed to change ownership of the tem
porary files Ansible needs to create despite connecting as root. Unprivileged become user wo
uld be unable to read the file.”}
to retry, use: --limit @/tmp/.bench/playbooks/production/install.retry
PLAY RECAP **********************************************************************************
localhost : ok=61 changed=40 unreachable=0 failed=1
Traceback (most recent call last):
File “install.py”, line 388, in
install_bench(args)
File “install.py”, line 114, in install_bench
run_playbook(‘production/install.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 326, in run_playbook
success = subprocess.check_call(args, cwd=os.path.join(cwd, ‘playbooks’))
File “/usr/lib/python2.7/subprocess.py”, line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘production/insta
ll.yml’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’, ‘–become-user=erp_jmi’]’ returned non-ze
ro exit status 2
erp_jmi@deb8-erp10:~$


The error seems to be very similar (although not identical) to the error happening on CentOS 7 servers so the fault introduced in the install.py must be the same.

This install worked only 72 hours ago on these same severs, and now it is broken.

BKM