ERPNext installation bug

I get the following error while installing ERPNext on ubuntu 16.04

bench@elly-HP-ENVY-x360-Convertible:~/erpnext$ bench new-site erp.example.com
/usr/local/lib/python2.7/dist-packages/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
MySQL root password:
Traceback (most recent call last):
File “/usr/lib/python3.5/runpy.py”, line 184, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.5/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/commands/site.py”, line 32, in new_site
db_type=db_type)
File “/opt/bench/erpnext/apps/frappe/frappe/commands/site.py”, line 69, in _new_site
source_sql=source_sql, force=force, reinstall=reinstall, db_type=db_type)
File “/opt/bench/erpnext/apps/frappe/frappe/installer.py”, line 34, in install_db
setup_database(force, source_sql, verbose)
File “/opt/bench/erpnext/apps/frappe/frappe/database/init.py”, line 16, in setup_database
return frappe.database.mariadb.setup_db.setup_database(force, source_sql, verbose)
File “/opt/bench/erpnext/apps/frappe/frappe/database/mariadb/setup_db.py”, line 58, in setup_database
bootstrap_database(db_name, verbose, source_sql)
File “/opt/bench/erpnext/apps/frappe/frappe/database/mariadb/setup_db.py”, line 83, in bootstrap_database
if not check_database_settings():
File “/opt/bench/erpnext/apps/frappe/frappe/database/mariadb/setup_db.py”, line 103, in check_database_settings
versions = get_mariadb_versions()
File “/opt/bench/erpnext/apps/frappe/frappe/database/mariadb/setup_db.py”, line 24, in get_mariadb_versions
mariadb_variables = frappe._dict(frappe.db.sql(“”“show variables”“”))
File “/opt/bench/erpnext/apps/frappe/frappe/database/database.py”, line 122, in sql
self.connect()
File “/opt/bench/erpnext/apps/frappe/frappe/database/database.py”, line 75, in connect
self._conn = self.get_connection()
File “/opt/bench/erpnext/apps/frappe/frappe/database/mariadb/database.py”, line 96, in get_connection
conn.select_db(self.user)
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/pymysql/connections.py”, line 446, in select_db
self._read_ok_packet()
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/pymysql/connections.py”, line 394, in _read_ok_packet
pkt = self._read_packet()
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/pymysql/connections.py”, line 684, in _read_packet
packet.check_error()
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/pymysql/protocol.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “/opt/bench/erpnext/env/lib/python3.5/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1044, “Access denied for user ‘_22835929e7d52caf’@‘localhost’ to database ‘_22835929e7d52caf’”)

what is it am missing please?

You’ll need to check that the “erp.example.com”, “YourMYSQLpassword” etc matches your systems settings, but this should work

#IF this happens....
#ERROR 1045 (28000): Access denied for user '_22835929e7d52caf'@'localhost' (using password: YES)
DBname=$(cat ~/frappe-bench/sites/erp.example.com/site_config.json | awk '/db_name/ {print $2}' | sed "s/\"//g" | sed "s/,//g")
DBpass=$(cat ~/frappe-bench/sites/erp.example.com/site_config.json | awk '/db_password/ {print $2}' | sed "s/\"//g")
#
mysql -uroot -pYourMYSQLpassword -Bse "GRANT ALL PRIVILEGES ON *.* TO '$DBname'@'localhost' IDENTIFIED BY '$DBpass' WITH GRANT OPTION;"
mysql -uroot -pYourMYSQLpassword -Bse "GRANT ALL PRIVILEGES ON *.* TO '$DBname'@'127.0.0.1' IDENTIFIED BY '$DBpass' WITH GRANT OPTION;"
#
mysql -uroot -pYourMYSQLpassword -Bse "set password for '$DBname'@'localhost' = password('$DBpass');"
mysql -uroot -pYourMYSQLpassword -Bse "set password for '$DBname'@'127.0.0.1' = password('$DBpass');"
#delete the DB and re-run
bench new-site erp.example.com

Some more advice. When adding sites, if there is a failure, Bench does not rollback the files/database.

For example.

  • Assume you create site “erpnext.example.com”. And there is Failure #1.
  • You correct the problem.
  • You repeat again for site “erpnext.example.com”. This time there is Failure #2 for new reasons. Because there are “leftover” changes from your 1st attempt.

So. Before creating a new site:

  1. Make sure you can successfully login to MariaDB with user=root, and your root password.
  2. Make sure your new Site doesn’t already have a directory in …/frappe-bench/sites/". If it does, delete that directory.
  3. Check your MariaDB server. Make sure you clean (delete) any databases that are leftover from previous attempts.
  4. Check your MariaDB server. Make sure you clean (delete) any users leftover from previous attempts.
  5. Try creating your site again.

This ensures a clean start, with no leftover artifacts.

Hello,
Apologize to put my issue to op’s thread but this is the latest thread of installation failure.
I am trying a new VPS on Contabo and with fresh install I am getting this error.


TASK [redis : Install apt packages] ******************************************************************
task path: /tmp/.bench/playbooks/roles/redis/tasks/main.yml:9
[DEPRECATION WARNING]: Invoking "apt" only once while using a loop via squash_actions is deprecated. 
Instead of using a loop to supply multiple items and specifying `pkg: "{{ item }}"`, please use `pkg:
 ['redis-server']` and remove the loop. This feature will be removed in version 2.11. Deprecation 
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
<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-1571578968.2562587-112793184894394 `" && echo ansible-tmp-1571578968.2562587-112793184894394="` echo /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394 `" ) && sleep 0'                                
Using module file /usr/local/lib/python3.6/dist-packages/ansible/modules/packaging/os/apt.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-3193tlwiyuy_/tmp1e4dvqec TO /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/AnsiballZ_apt.py                                             
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/ /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/AnsiballZ_apt.py && sleep 0'    
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/AnsiballZ_apt.py && sleep 0'                                                                
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/ > /dev/null 2>&1 && sleep 0'                                                                       
failed: [localhost] (item=['redis-server']) => {
    "ansible_loop_var": "item",
    "cache_update_time": 1571578706,
    "cache_updated": false,
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_unauthenticated": false,
            "autoclean": false,
            "autoremove": false,
            "cache_valid_time": 0,
            "deb": null,
            "default_release": null,
            "dpkg_options": "force-confdef,force-confold",
            "force": true,
            "force_apt_get": false,
            "install_recommends": null,
            "name": [
                "redis-server"
            ],
            "only_upgrade": false,
            "package": [
                "redis-server"
            ],
            "policy_rc_d": null,
            "purge": false,
            "state": "present",
            "update_cache": null,
            "upgrade": null
        }
    },
    "item": [
        "redis-server"
    ],
    "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"   --force-yes   install 'redis-server'' failed: W: --force-yes is deprecated, use one of the options starting with --allow instead.\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n",   
    "rc": 100,
    "stderr": "W: --force-yes is deprecated, use one of the options starting with --allow instead.\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n",                                             
    "stderr_lines": [
        "W: --force-yes is deprecated, use one of the options starting with --allow instead.",
        "E: Sub-process /usr/bin/dpkg returned an error code (1)"
    ],
    "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following NEW packages will be installed:\n  redis-server\n0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.\nNeed to get 0 B/35.4 kB of archives.\nAfter this operation, 172 kB of additional disk space will be used.\nSelecting previously unselected package redis-server.\r\n(Reading database ... \r(Reading database ... 5%\r(Reading database ... 10%\r(Reading database ... 15%\r(Reading database ... 20%\r(Reading database ... 25%\r(Reading database ... 30%\r(Reading database ... 35%\r(Reading database ... 40%\r(Reading database ... 45%\r(Reading database ... 50%\r(Reading database ... 55%\r(Reading database ... 60%\r(Reading database ... 65%\r(Reading database ... 70%\r(Reading database ... 75%\r(Reading database ... 80%\r(Reading database ... 85%\r(Reading database ... 90%\r(Reading database ... 95%\r(Reading database ... 100%\r(Reading database ... 83538 files and directories currently installed.)\r\nPreparing to unpack .../redis-server_5%3a4.0.9-1ubuntu0.2_amd64.deb ...\r\nUnpacking redis-server (5:4.0.9-1ubuntu0.2) ...\r\nSetting up redis-server (5:4.0.9-1ubuntu0.2) ...\r\nJob for redis-server.service failed because a timeout was exceeded.\r\nSee \"systemctl status redis-server.service\" and \"journalctl -xe\" for details.\r\ninvoke-rc.d: initscript redis-server, action \"start\" failed.\r\n* redis-server.service - Advanced key-value store\r\n   Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: enabled)\r\n   Active: activating (auto-restart) (Result: timeout) since Sun 2019-10-20 15:44:22 CEST; 18ms ago\r\n     Docs: http://redis.io/documentation,\r\n           man:redis-server(1)\r\n  Process: 5965 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)\r\n\r\nOct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.\r\nOct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 1.\r\nOct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: Stopped Advanced key-value store.\r\nOct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: Starting Advanced key-value store...\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: \u001b[0;1;39m\u001b[0;1;31m\u001b[0;1;39mredis-server.service: Failed with result 'protocol'.\u001b[0m\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: \u001b[0;1;31m\u001b[0;1;39m\u001b[0;1;31mFailed to start Advanced key-value store.\u001b[0m\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 2.\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: Stopped Advanced key-value store.\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: Starting Advanced key-value store...\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory\r\ndpkg: error processing package redis-server (--configure):\r\n installed redis-server package post-installation script subprocess returned error exit status 1\r\nProcessing triggers for systemd (237-3ubuntu10.31) ...\r\nProcessing triggers for man-db (2.8.3-2ubuntu0.1) ...\r\nProcessing triggers for ureadahead (0.100.0-21) ...\r\nErrors were encountered while processing:\r\n redis-server\r\n",                                         
    "stdout_lines": [
        "Reading package lists...",
        "Building dependency tree...",
        "Reading state information...",
        "The following NEW packages will be installed:",
        "  redis-server",
        "0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.",
        "Need to get 0 B/35.4 kB of archives.",
        "After this operation, 172 kB of additional disk space will be used.",
        "Selecting previously unselected package redis-server.",
        "(Reading database ... ",
        "(Reading database ... 5%",
        "(Reading database ... 10%",
        "(Reading database ... 15%",
        "(Reading database ... 20%",
        "(Reading database ... 25%",
        "(Reading database ... 30%",
        "(Reading database ... 35%",
        "(Reading database ... 40%",
        "(Reading database ... 45%",
        "(Reading database ... 50%",
        "(Reading database ... 55%",
        "(Reading database ... 60%",
        "(Reading database ... 65%",
        "(Reading database ... 70%",
        "(Reading database ... 75%",
        "(Reading database ... 80%",
        "(Reading database ... 85%",
        "(Reading database ... 90%",
        "(Reading database ... 95%",
        "(Reading database ... 100%",
        "(Reading database ... 83538 files and directories currently installed.)",
        "Preparing to unpack .../redis-server_5%3a4.0.9-1ubuntu0.2_amd64.deb ...",
        "Unpacking redis-server (5:4.0.9-1ubuntu0.2) ...",
        "Setting up redis-server (5:4.0.9-1ubuntu0.2) ...",
        "Job for redis-server.service failed because a timeout was exceeded.",
        "See \"systemctl status redis-server.service\" and \"journalctl -xe\" for details.",
        "invoke-rc.d: initscript redis-server, action \"start\" failed.",
        "* redis-server.service - Advanced key-value store",
        "   Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: enabled)",                                                                                                   
        "   Active: activating (auto-restart) (Result: timeout) since Sun 2019-10-20 15:44:22 CEST; 18ms ago",                                                                                              
        "     Docs: http://redis.io/documentation,",
        "           man:redis-server(1)",
        "  Process: 5965 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)",                                                                                            
        "",
        "Oct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.",                                                                    
        "Oct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 1.",                                                                    
        "Oct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: Stopped Advanced key-value store.",
        "Oct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: Starting Advanced key-value store...",                                                                                                     
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory",                  
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: \u001b[0;1;39m\u001b[0;1;31m\u001b[0;1;39mredis-server.service: Failed with result 'protocol'.\u001b[0m",                                  
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: \u001b[0;1;31m\u001b[0;1;39m\u001b[0;1;31mFailed to start Advanced key-value store.\u001b[0m",                                             
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.",                                                                    
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 2.",                                                                    
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: Stopped Advanced key-value store.",
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: Starting Advanced key-value store...",                                                                                                     
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory",                  
        "dpkg: error processing package redis-server (--configure):",
        " installed redis-server package post-installation script subprocess returned error exit status 1",                                                                                                 
        "Processing triggers for systemd (237-3ubuntu10.31) ...",
        "Processing triggers for man-db (2.8.3-2ubuntu0.1) ...",
        "Processing triggers for ureadahead (0.100.0-21) ...",
        "Errors were encountered while processing:",
        " redis-server"
    ]
}

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

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

Traceback (most recent call last):
  File "install.py", line 413, in <module>
    install_bench(args)
  File "install.py", line 135, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 327, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 190, 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

TASK [redis : Install apt packages] ******************************************************************
task path: /tmp/.bench/playbooks/roles/redis/tasks/main.yml:9
[DEPRECATION WARNING]: Invoking "apt" only once while using a loop via squash_actions is deprecated. 
Instead of using a loop to supply multiple items and specifying `pkg: "{{ item }}"`, please use `pkg:
 ['redis-server']` and remove the loop. This feature will be removed in version 2.11. Deprecation 
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
<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-1571578968.2562587-112793184894394 `" && echo ansible-tmp-1571578968.2562587-112793184894394="` echo /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394 `" ) && sleep 0'                                
Using module file /usr/local/lib/python3.6/dist-packages/ansible/modules/packaging/os/apt.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-3193tlwiyuy_/tmp1e4dvqec TO /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/AnsiballZ_apt.py                                             
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/ /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/AnsiballZ_apt.py && sleep 0'    
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/AnsiballZ_apt.py && sleep 0'                                                                
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1571578968.2562587-112793184894394/ > /dev/null 2>&1 && sleep 0'                                                                       
failed: [localhost] (item=['redis-server']) => {
    "ansible_loop_var": "item",
    "cache_update_time": 1571578706,
    "cache_updated": false,
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_unauthenticated": false,
            "autoclean": false,
            "autoremove": false,
            "cache_valid_time": 0,
            "deb": null,
            "default_release": null,
            "dpkg_options": "force-confdef,force-confold",
            "force": true,
            "force_apt_get": false,
            "install_recommends": null,
            "name": [
                "redis-server"
            ],
            "only_upgrade": false,
            "package": [
                "redis-server"
            ],
            "policy_rc_d": null,
            "purge": false,
            "state": "present",
            "update_cache": null,
            "upgrade": null
        }
    },
    "item": [
        "redis-server"
    ],
    "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"   --force-yes   install 'redis-server'' failed: W: --force-yes is deprecated, use one of the options starting with --allow instead.\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n",   
    "rc": 100,
    "stderr": "W: --force-yes is deprecated, use one of the options starting with --allow instead.\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n",                                             
    "stderr_lines": [
        "W: --force-yes is deprecated, use one of the options starting with --allow instead.",
        "E: Sub-process /usr/bin/dpkg returned an error code (1)"
    ],
    "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following NEW packages will be installed:\n  redis-server\n0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.\nNeed to get 0 B/35.4 kB of archives.\nAfter this operation, 172 kB of additional disk space will be used.\nSelecting previously unselected package redis-server.\r\n(Reading database ... \r(Reading database ... 5%\r(Reading database ... 10%\r(Reading database ... 15%\r(Reading database ... 20%\r(Reading database ... 25%\r(Reading database ... 30%\r(Reading database ... 35%\r(Reading database ... 40%\r(Reading database ... 45%\r(Reading database ... 50%\r(Reading database ... 55%\r(Reading database ... 60%\r(Reading database ... 65%\r(Reading database ... 70%\r(Reading database ... 75%\r(Reading database ... 80%\r(Reading database ... 85%\r(Reading database ... 90%\r(Reading database ... 95%\r(Reading database ... 100%\r(Reading database ... 83538 files and directories currently installed.)\r\nPreparing to unpack .../redis-server_5%3a4.0.9-1ubuntu0.2_amd64.deb ...\r\nUnpacking redis-server (5:4.0.9-1ubuntu0.2) ...\r\nSetting up redis-server (5:4.0.9-1ubuntu0.2) ...\r\nJob for redis-server.service failed because a timeout was exceeded.\r\nSee \"systemctl status redis-server.service\" and \"journalctl -xe\" for details.\r\ninvoke-rc.d: initscript redis-server, action \"start\" failed.\r\n* redis-server.service - Advanced key-value store\r\n   Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: enabled)\r\n   Active: activating (auto-restart) (Result: timeout) since Sun 2019-10-20 15:44:22 CEST; 18ms ago\r\n     Docs: http://redis.io/documentation,\r\n           man:redis-server(1)\r\n  Process: 5965 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)\r\n\r\nOct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.\r\nOct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 1.\r\nOct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: Stopped Advanced key-value store.\r\nOct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: Starting Advanced key-value store...\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: \u001b[0;1;39m\u001b[0;1;31m\u001b[0;1;39mredis-server.service: Failed with result 'protocol'.\u001b[0m\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: \u001b[0;1;31m\u001b[0;1;39m\u001b[0;1;31mFailed to start Advanced key-value store.\u001b[0m\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 2.\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: Stopped Advanced key-value store.\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: Starting Advanced key-value store...\r\nOct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory\r\ndpkg: error processing package redis-server (--configure):\r\n installed redis-server package post-installation script subprocess returned error exit status 1\r\nProcessing triggers for systemd (237-3ubuntu10.31) ...\r\nProcessing triggers for man-db (2.8.3-2ubuntu0.1) ...\r\nProcessing triggers for ureadahead (0.100.0-21) ...\r\nErrors were encountered while processing:\r\n redis-server\r\n",                                         
    "stdout_lines": [
        "Reading package lists...",
        "Building dependency tree...",
        "Reading state information...",
        "The following NEW packages will be installed:",
        "  redis-server",
        "0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.",
        "Need to get 0 B/35.4 kB of archives.",
        "After this operation, 172 kB of additional disk space will be used.",
        "Selecting previously unselected package redis-server.",
        "(Reading database ... ",
        "(Reading database ... 5%",
        "(Reading database ... 10%",
        "(Reading database ... 15%",
        "(Reading database ... 20%",
        "(Reading database ... 25%",
        "(Reading database ... 30%",
        "(Reading database ... 35%",
        "(Reading database ... 40%",
        "(Reading database ... 45%",
        "(Reading database ... 50%",
        "(Reading database ... 55%",
        "(Reading database ... 60%",
        "(Reading database ... 65%",
        "(Reading database ... 70%",
        "(Reading database ... 75%",
        "(Reading database ... 80%",
        "(Reading database ... 85%",
        "(Reading database ... 90%",
        "(Reading database ... 95%",
        "(Reading database ... 100%",
        "(Reading database ... 83538 files and directories currently installed.)",
        "Preparing to unpack .../redis-server_5%3a4.0.9-1ubuntu0.2_amd64.deb ...",
        "Unpacking redis-server (5:4.0.9-1ubuntu0.2) ...",
        "Setting up redis-server (5:4.0.9-1ubuntu0.2) ...",
        "Job for redis-server.service failed because a timeout was exceeded.",
        "See \"systemctl status redis-server.service\" and \"journalctl -xe\" for details.",
        "invoke-rc.d: initscript redis-server, action \"start\" failed.",
        "* redis-server.service - Advanced key-value store",
        "   Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: enabled)",                                                                                                   
        "   Active: activating (auto-restart) (Result: timeout) since Sun 2019-10-20 15:44:22 CEST; 18ms ago",                                                                                              
        "     Docs: http://redis.io/documentation,",
        "           man:redis-server(1)",
        "  Process: 5965 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)",                                                                                            
        "",
        "Oct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.",                                                                    
        "Oct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 1.",                                                                    
        "Oct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: Stopped Advanced key-value store.",
        "Oct 20 15:44:22 vmi307466.contaboserver.net systemd[1]: Starting Advanced key-value store...",                                                                                                     
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory",                  
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: \u001b[0;1;39m\u001b[0;1;31m\u001b[0;1;39mredis-server.service: Failed with result 'protocol'.\u001b[0m",                                  
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: \u001b[0;1;31m\u001b[0;1;39m\u001b[0;1;31mFailed to start Advanced key-value store.\u001b[0m",                                             
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.",                                                                    
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 2.",                                                                    
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: Stopped Advanced key-value store.",
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: Starting Advanced key-value store...",                                                                                                     
        "Oct 20 15:44:23 vmi307466.contaboserver.net systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory",                  
        "dpkg: error processing package redis-server (--configure):",
        " installed redis-server package post-installation script subprocess returned error exit status 1",                                                                                                 
        "Processing triggers for systemd (237-3ubuntu10.31) ...",
        "Processing triggers for man-db (2.8.3-2ubuntu0.1) ...",
        "Processing triggers for ureadahead (0.100.0-21) ...",
        "Errors were encountered while processing:",
        " redis-server"
    ]
}

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

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

Traceback (most recent call last):
  File "install.py", line 413, in <module>
    install_bench(args)
  File "install.py", line 135, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 327, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 190, 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

I tried to look for it but nothing seems to help. I removed redis-server manually and started the script again but still the same. I also tried to install redis-server manually but that is also failing with this issue.

apt install redis-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
redis-server is already the newest version (5:4.0.9-1ubuntu0.2).
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up redis-server (5:4.0.9-1ubuntu0.2) ...

Job for redis-server.service failed because a timeout was exceeded.
See "systemctl status redis-server.service" and "journalctl -xe" for details.
invoke-rc.d: initscript redis-server, action "start" failed.
● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: timeout) since Sun 2019-10-20 15:48:54 CEST; 11ms ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
dpkg: error processing package redis-server (--configure):
 installed redis-server package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 redis-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

UPDATE: I tried to install on a local Server with Fresh Ubuntu 18.04LTS and it failed with another error.

TASK [bench : python3 bench init for production] *****************************************************
task path: /tmp/.bench/playbooks/roles/bench/tasks/main.yml:37
<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 /var/tmp/ansible-tmp-1571586019.743733-246363542914825 `" && echo ansible-tmp-1571586019.743733-246363542914825="` echo /var/tmp/ansible-tmp-1571586019.743733-246363542914825 `" ) && sleep 0'                                                       
Using module file /usr/local/lib/python3.6/dist-packages/ansible/modules/commands/command.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-9499ueo5p_lt/tmpay8wsrk1 TO /var/tmp/ansible-tmp-1571586019.743733-246363542914825/AnsiballZ_command.py                                                    
<127.0.0.1> EXEC /bin/sh -c 'setfacl -m u:farmaciaerp:r-x /var/tmp/ansible-tmp-1571586019.743733-246363542914825/ /var/tmp/ansible-tmp-1571586019.743733-246363542914825/AnsiballZ_command.py && sleep 0'   
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n  -u farmaciaerp /bin/sh -c '"'"'echo BECOME-SUCCESS-jfapixrqvjenynxicxwyvkmdirzoyldi ; /usr/bin/python3 /var/tmp/ansible-tmp-1571586019.743733-246363542914825/AnsiballZ_command.py'"'"' && sleep 0'                                                                   
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1571586019.743733-246363542914825/ > /dev/null 2>&1 && sleep 0'                                                                                  
fatal: [localhost]: FAILED! => {
    "changed": true,
    "cmd": [
        "bench",
        "init",
        "/home/farmaciaerp/frappe-bench",
        "--frappe-path",
        "https://github.com/frappe/frappe",
        "--frappe-branch",
        "version-11",
        "--python",
        "python3"
    ],
    "delta": "0:09:03.575992",
    "end": "2019-10-20 15:49:23.410762",
    "invocation": {
        "module_args": {
            "_raw_params": "bench init /home/farmaciaerp/frappe-bench --frappe-path https://github.com/frappe/frappe --frappe-branch version-11 --python python3",                                          
            "_uses_shell": false,
            "argv": null,
            "chdir": null,
            "creates": "/home/farmaciaerp/frappe-bench",
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2019-10-20 15:40:19.834770",
    "stderr": "INFO:bench.utils:virtualenv -q env -p /usr/bin/python3\nINFO:bench.utils:env/bin/pip -q install --upgrade pip\nINFO:bench.utils:env/bin/pip -q install wheel\nINFO:bench.utils:env/bin/pip -q install six\nINFO:bench.utils:env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit\nINFO:bench.app:getting app frappe\nINFO:bench.utils:git clone https://github.com/frappe/frappe --branch version-11  --origin upstream\nCloning into 'frappe'...\nerror: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.\nfatal: The remote end hung up unexpectedly\nfatal: early EOF\nfatal: index-pack failed\nTraceback (most recent call last):\n  File \"/usr/local/bin/bench\", line 11, in <module>\n    load_entry_point('bench', 'console_scripts', 'bench')()\n  File \"/home/farmaciaerp/.bench/bench/cli.py\", line 40, in cli\n    bench_command()\n  File \"/usr/lib/python3/dist-packages/click/core.py\", line 722, in __call__\n    return self.main(*args, **kwargs)\n  File \"/usr/lib/python3/dist-packages/click/core.py\", line 697, in main\n    rv = self.invoke(ctx)\n  File \"/usr/lib/python3/dist-packages/click/core.py\", line 1066, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n  File \"/usr/lib/python3/dist-packages/click/core.py\", line 895, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n  File \"/usr/lib/python3/dist-packages/click/core.py\", line 535, in invoke\n    return callback(*args, **kwargs)\n  File \"/home/farmaciaerp/.bench/bench/commands/make.py\", line 31, in init\n    python \t\t = python)\n  File \"/home/farmaciaerp/.bench/bench/utils.py\", line 75, in init\n    get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, verbose=verbose)\n  File \"/home/farmaciaerp/.bench/bench/app.py\", line 125, in get_app\n    cwd=os.path.join(bench_path, 'apps'))\n  File \"/home/farmaciaerp/.bench/bench/utils.py\", line 161, in exec_cmd\n    raise CommandFailedError(cmd)\nbench.utils.CommandFailedError: git clone https://github.com/frappe/frappe --branch version-11  --origin upstream",
    "stderr_lines": [
        "INFO:bench.utils:virtualenv -q env -p /usr/bin/python3",
        "INFO:bench.utils:env/bin/pip -q install --upgrade pip",
        "INFO:bench.utils:env/bin/pip -q install wheel",
        "INFO:bench.utils:env/bin/pip -q install six",
        "INFO:bench.utils:env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit",                                                                                            
        "INFO:bench.app:getting app frappe",
        "INFO:bench.utils:git clone https://github.com/frappe/frappe --branch version-11  --origin upstream",                                                                                               
        "Cloning into 'frappe'...",
        "error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.",                                                                                             
        "fatal: The remote end hung up unexpectedly",
        "fatal: early EOF",
        "fatal: index-pack failed",
        "Traceback (most recent call last):",
        "  File \"/usr/local/bin/bench\", line 11, in <module>",
        "    load_entry_point('bench', 'console_scripts', 'bench')()",
        "  File \"/home/farmaciaerp/.bench/bench/cli.py\", line 40, in cli",
        "    bench_command()",
        "  File \"/usr/lib/python3/dist-packages/click/core.py\", line 722, in __call__",
        "    return self.main(*args, **kwargs)",
        "  File \"/usr/lib/python3/dist-packages/click/core.py\", line 697, in main",
        "    rv = self.invoke(ctx)",
        "  File \"/usr/lib/python3/dist-packages/click/core.py\", line 1066, in invoke",
        "    return _process_result(sub_ctx.command.invoke(sub_ctx))",
        "  File \"/usr/lib/python3/dist-packages/click/core.py\", line 895, in invoke",
        "    return ctx.invoke(self.callback, **ctx.params)",
        "  File \"/usr/lib/python3/dist-packages/click/core.py\", line 535, in invoke",
        "    return callback(*args, **kwargs)",
        "  File \"/home/farmaciaerp/.bench/bench/commands/make.py\", line 31, in init",
        "    python \t\t = python)",
        "  File \"/home/farmaciaerp/.bench/bench/utils.py\", line 75, in init",
        "    get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, verbose=verbose)",                                                                                        
        "  File \"/home/farmaciaerp/.bench/bench/app.py\", line 125, in get_app",
        "    cwd=os.path.join(bench_path, 'apps'))",
        "  File \"/home/farmaciaerp/.bench/bench/utils.py\", line 161, in exec_cmd",
        "    raise CommandFailedError(cmd)",
        "bench.utils.CommandFailedError: git clone https://github.com/frappe/frappe --branch version-11  --origin upstream"                                                                                 
    ],
    "stdout": "Already using interpreter /usr/bin/python3",
    "stdout_lines": [
        "Already using interpreter /usr/bin/python3"
    ]
}

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

Traceback (most recent call last):
  File "install.py", line 413, in <module>
    install_bench(args)
  File "install.py", line 135, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 327, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 190, 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=farmaciaerp']' returned non-zero exit status 2

I am using
python install.py --production --version 11 --python python2.7 --user [user-name]

What worked is
python install.py --production --version 11 --user [user-name] but we need to use python2.7, how can we use 2.7?

I think it is about IPV6 setting on the server. Some servers disable IPv6 support and easy install fails when installing redis. You may tweak redis configuraion a little bit but then most probably nginx will throw some other errors.

sudo nano /etc/redis/redis.conf
Change
bind 127.0.0.1 ::1
to
bind 127.0.0.1

Then
sudo mkdir /var/run/redis
sudo chown redis /var/run/redis

This will eliminate redis-server pid file creation error and some other errors.

PS: I contacted to the support and they enabled the ipv6 support in the server. Then easy install completed.

1 Like
  • Connect to your server via SSH
  • Execute the following command with root rights:
    enable_ipv6
  • Reboot your server
1 Like