[SOLUTION] failed: [localhost] (item=['redis-server']) during bench install ERPNext Production Environment where IPv6 is disabled

Error and Log output:

failed: [localhost] (item=['redis-server']) => {
    "ansible_loop_var": "item",
    "cache_update_time": 1575555172,
    "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 packages were automatically installed and are no longer required:\n  linux-headers-4.15.0-47 linux-headers-4.15.0-47-generic\n  linux-image-4.15.0-47-generic linux-modules-4.15.0-47-generic\nUse 'sudo apt autoremove' to remove them.\nThe following additional packages will be installed:\n  libjemalloc1 redis-tools\nSuggested packages:\n  ruby-redis\nThe following NEW packages will be installed:\n  libjemalloc1 redis-server redis-tools\n0 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.\nNeed to get 634 kB of archives.\nAfter this operation, 3012 kB of additional disk space will be used.\nGet:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libjemalloc1 amd64 3.6.0-11 [82.4 kB]\nGet:2 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 redis-tools amd64 5:4.0.9-1ubuntu0.2 [516 kB]\nGet:3 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 redis-server amd64 5:4.0.9-1ubuntu0.2 [35.4 kB]\nFetched 634 kB in 1s (496 kB/s)\nSelecting previously unselected package libjemalloc1.\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 ... 142196 files and directories currently installed.)\r\nPreparing to unpack .../libjemalloc1_3.6.0-11_amd64.deb ...\r\nUnpacking libjemalloc1 (3.6.0-11) ...\r\nSelecting previously unselected package redis-tools.\r\nPreparing to unpack .../redis-tools_5%3a4.0.9-1ubuntu0.2_amd64.deb ...\r\nUnpacking redis-tools (5:4.0.9-1ubuntu0.2) ...\r\nSelecting previously unselected package redis-server.\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 libjemalloc1 (3.6.0-11) ...\r\nSetting up redis-tools (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 Thu 2019-12-05 14:17:35 UTC; 45ms ago\r\n     Docs: http://redis.io/documentation,\r\n           man:redis-server(1)\r\n  Process: 24054 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)\r\n\r\nDec 05 14:17:35 cloud2.sevenmentor.com systemd[1]: \u001b[0;1;31m\u001b[0;1;39m\u001b[0;1;31mFailed to start Advanced key-value store.\u001b[0m\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 libc-bin (2.27-3ubuntu1) ...\r\nProcessing triggers for systemd (237-3ubuntu10.33) ...\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 packages were automatically installed and are no longer required:",
        "  linux-headers-4.15.0-47 linux-headers-4.15.0-47-generic",
        "  linux-image-4.15.0-47-generic linux-modules-4.15.0-47-generic",
        "Use 'sudo apt autoremove' to remove them.",
        "The following additional packages will be installed:",
        "  libjemalloc1 redis-tools",
        "Suggested packages:",
        "  ruby-redis",
        "The following NEW packages will be installed:",
        "  libjemalloc1 redis-server redis-tools",
        "0 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.",
        "Need to get 634 kB of archives.",
        "After this operation, 3012 kB of additional disk space will be used.",
        "Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libjemalloc1 amd64 3.6.0-11 [82.4 kB]",
        "Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 redis-tools amd64 5:4.0.9-1ubuntu0.2 [516 kB]",
        "Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 redis-server amd64 5:4.0.9-1ubuntu0.2 [35.4 kB]",
        "Fetched 634 kB in 1s (496 kB/s)",
        "Selecting previously unselected package libjemalloc1.",
        "(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 ... 142196 files and directories currently installed.)",
        "Preparing to unpack .../libjemalloc1_3.6.0-11_amd64.deb ...",
        "Unpacking libjemalloc1 (3.6.0-11) ...",
        "Selecting previously unselected package redis-tools.",
        "Preparing to unpack .../redis-tools_5%3a4.0.9-1ubuntu0.2_amd64.deb ...",
        "Unpacking redis-tools (5:4.0.9-1ubuntu0.2) ...",
        "Selecting previously unselected package redis-server.",
        "Preparing to unpack .../redis-server_5%3a4.0.9-1ubuntu0.2_amd64.deb ...",
        "Unpacking redis-server (5:4.0.9-1ubuntu0.2) ...",
        "Setting up libjemalloc1 (3.6.0-11) ...",
        "Setting up redis-tools (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 Thu 2019-12-05 14:17:35 UTC; 45ms ago",
        "     Docs: http://redis.io/documentation,",
        "           man:redis-server(1)",
        "  Process: 24054 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)",
        "",
        "Dec 05 14:17:35 cloud2.sevenmentor.com systemd[1]: \u001b[0;1;31m\u001b[0;1;39m\u001b[0;1;31mFailed to start Advanced key-value store.\u001b[0m",
        "dpkg: error processing package redis-server (--configure):",
        " installed redis-server package post-installation script subprocess returned error exit status 1",
        "Processing triggers for libc-bin (2.27-3ubuntu1) ...",
        "Processing triggers for systemd (237-3ubuntu10.33) ...",
        "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=47   changed=34   unreachable=0    failed=1    skipped=33   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=frappe']' returned non-zero exit status 2
service redis-server status
● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: ena
   Active: activating (start) since Thu 2019-12-05 14:22:07 UTC; 1min 12s ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
  Process: 24512 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, stat
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/redis-server.service
tail -f /var/log/redis/redis-server.log
32203:C 05 Dec 19:13:31.409 # Configuration loaded
32212:M 05 Dec 19:13:31.414 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
32240:C 05 Dec 19:15:01.898 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
32240:C 05 Dec 19:15:01.898 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=32240, just started
32240:C 05 Dec 19:15:01.898 # Configuration loaded
32249:M 05 Dec 19:15:01.901 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
32279:C 05 Dec 19:16:32.422 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
32279:C 05 Dec 19:16:32.423 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=32279, just started
32279:C 05 Dec 19:16:32.423 # Configuration loaded
32290:M 05 Dec 19:16:32.427 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address

SOLUTION
Make sure if your server have IPv6 disabled by default, if yes, then you need to make following change and restart install.py

# Commands for Ubuntu 18.04 LTS OS
nano /etc/redis/redis.conf
#search for line starts with bind 127.0.0.1 ::1
bind 127.0.0.1 ::1
# change it to
bind 127.0.0.1 
# Then
systemctl restart redis-server
# Once redis server starts normally, you may resume installation of ERPNext
sudo python install.py --production #if production environment
sudo python install.py --development #if development environment
1 Like