CentOS 7 /home/root installation error

There are a number of posts on this, but there does not seem to be any resolution.

I am running the installation script as the erpnext user, which is in the wheel group and so has sudo rights.

[erpnext@centos-server ~]$ sudo python install.py --production --site erpnext-prd.robertson.local --user erpnext --bench-name erpnext-prd --verbose 2>&1 | tee erpnext-install.log

It fails here

TASK [move /tmp/.bench if it exists] *******************************************
task path: /tmp/.bench/playbooks/develop/includes/setup_bench.yml:12
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /tmp/ansible-tmp-1511885989.72-130172443975095 `" && echo ansible-tmp-1511885989.72-130172443975095="` echo /tmp/ansible-tmp-1511885989.72-130172443975095 `" ) && sleep 0'
<127.0.0.1> PUT /tmp/tmpHLGZXF TO /tmp/ansible-tmp-1511885989.72-130172443975095/command.py
<127.0.0.1> EXEC /bin/sh -c 'setfacl -m u:erpnext:r-x /tmp/ansible-tmp-1511885989.72-130172443975095/ /tmp/ansible-tmp-1511885989.72-130172443975095/command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n -u erpnext /bin/sh -c '"'"'echo BECOME-SUCCESS-bjxfkuzfijpjyexhebptgjbpzxxgcfgl; /bin/python /tmp/ansible-tmp-1511885989.72-130172443975095/command.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /tmp/ansible-tmp-1511885989.72-130172443975095/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": true,
    "cmd": [
        "cp",
        "-R",
        "/tmp/.bench",
        "/home/root/.bench"
    ],
    "delta": "0:00:00.026888",
    "end": "2017-11-28 10:19:49.861506",
    "failed": true,
    "invocation": {
        "module_args": {
            "_raw_params": "cp -R /tmp/.bench /home/root/.bench",
            "_uses_shell": false,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "warn": true
        }
    },
    "rc": 1,
    "start": "2017-11-28 10:19:49.834618",
    "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=54   changed=5    unreachable=0    failed=1

What is interesting is if I remove the --user erpnext from the command line, then it defaults to frappe user, creates the /home/frappe directory and I get the same error message.

If I create the /home/root directory with

sudo install -m 705 -o erpnext -g erpnext -d /home/root

and then run the original install command line with --user erpnext in it. Then everything is installed into the /home/root directory and not in /home/erpnext as I would expect. I am thinking this is a bug in the easy install script. Any other thoughts?

I means it works, but not how I would expect it to. A admin would just need to remember that it is in /home/root and not /home/erpnext in this example.

I don’t think anyone has tried installing with any other user rather than frappe

I guess the home folder may be hard-coded at some points. Feel free to fix this script and send a pull.

On Debian 8 the install scripts runs flawlessly with that same command line. It has some serious issues on CentOS. I put in a pull for update to Maria DB v10.2 stable last night. I will poke around and see what I can figure out on this one.

1 Like

This has nothing to do with the --user flag presented to install.py. Even if you do not use the flag, the error is still there. There is an issue with Ansible I think where it is having trouble determining how to derive this variable {{ frappe_user }} on CentOS. It starts early on during the install process when Ansible runs playbooks/develop/create_user.yml. I am unsure how to fix this. It defaults to root when you use the --user flag and it defaults to frappe when you don’t. And in any case, everything still goes to /home/root.

1 Like

@saurabh6790 can you please help

1 Like

Any luck?

I am also getting the same error. I noticed that I am getting the following message while doing install.py:

[WARNING]: Host file not found: /etc/ansible/hosts
[WARNING]: provided hosts list is empty, only localhost is available

It then fails a lot later with:

“cp: cannot create directory ‘/home/root/.bench’: No such file or directory”

As James_Robertson pointed out, it does not sees to be changed by --user flag. Please help.