RHEL Installation fails: No such file or directory: '/elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp

Configured RHEL and installed Docker following the steps from https://www.elastic.co/guide/en/cloud-enterprise/current/ece-configure-hosts-rhel-centos.html

Performed steps for installing offline https://www.elastic.co/guide/en/cloud-enterprise/current/ece-installing-offline.html

Docker images are loaded on the host server:
docker image ls

REPOSITORY                                                    TAG                 IMAGE ID            CREATED             SIZE
docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise   2.5.0               37ee782d6465        4 weeks ago         1.32 GB
docker.elastic.co/cloud-assets/apm                            7.6.2-0             8ceb1f996eb3        5 weeks ago         468 MB
docker.elastic.co/cloud-assets/elasticsearch                  7.6.2-0             8e28b2e76658        5 weeks ago         1.17 GB
docker.elastic.co/cloud-assets/kibana                         7.6.2-0             d343e188c4fa        5 weeks ago         1.34 GB
docker.elastic.co/app-search/app-search                       7.6.2               9a0b03ad2530        5 weeks ago         543 MB
docker.elastic.co/cloud-assets/elasticsearch                  6.8.8-0             b9072b317c39        6 weeks ago         1.37 GB
docker.elastic.co/cloud-assets/kibana                         6.8.8-0             03527458ee29        6 weeks ago         1.12 GB

When I run the shell script to perform the Elastic installation, under a non-root account, I continue to get the following No such file or directory error message:

./elastic-cloud-enterprise.sh install --debug

-- Debug Info --
NODE_TYPE - initial
RUNNER_ROLES -
ALLOCATOR_TAGS -
HOST_DOCKER_HOST - /var/run/docker.sock
HOST_PREREQ_FAILED - False
ELASTIC_CLOUD_PLATFORM - aws
ECE_TIMEOUT_FACTOR - 1.0
ELASTIC_UID - 1005
HOST_KERNEL_PARAMETERS - {'net.ipv4.ip_local_port_range': '32768\t60999'}
CLOUD_FEATURE_FLAG_DEDICATEDNODETYPES - true
HOST_STORAGE_ROOT_VOLUME_PATH - /mnt/data
ECE_DOCKER_REPOSITORY - cloud-enterprise
DOCKER_REGISTRY - docker.elastic.co
RUNNER_HOST_IP - 10.245.202.229
RUNNER_AVAILABILITY_ZONE - ece-zone-1
ELASTIC_GID - 1006
CLOUD_ENTERPRISE_VERSION - 2.5.0
RUNNER_REGION - ece-region
INSTANCE_TYPES_TO_ENABLE -
MEMORY_SETTINGS - {}
HOST_STORAGE_DEVICE_PATH - /dev/mapper/rootvg-root
RUNNER_ENVIRONMENT_METADATA_JSON - {}
RUNNER_CAPACITY - 23905
RUNNER_ROLES_TOKEN -
NODE_TYPE - initial
RUNNER_ID - 10.245.202.229
CONFIG_FILE -
PROXY_TAGS -
FORCE_INSTALL - False
HOST_STORAGE_PATH - /mnt/data/elastic

-- Verifying Prerequisites --
Checking runner container does not exist... PASSED
Checking host storage root volume path is not root... PASSED
Checking host storage path is accessible... PASSED
Checking host storage path contents matches whitelist... PASSED
Checking Docker version... PASSED
Checking Docker file system... PASSED
Checking Docker network settings... PASSED
 - The installation can proceed with ICC enabled; however, we recommend turning off ICC (icc=false).
Checking Docker storage driver... PASSED
 - The installation with overlay2 can proceed; however, we recommend using overlay
Checking whether 'setuser' works inside a Docker container... PASSED
Checking memory settings... PASSED
 - Option `--memory-settings` not used. Default memory settings might be insufficient for production use!
Checking runner ip connectivity... PASSED
Checking OS IPv4 IP forward setting... PASSED
Checking OS max map count setting... PASSED
Checking OS kernel version... PASSED
 - OS kernel version is 3.10.0-1062.18.1.el7.x86_64 but we recommend 4.4.
Checking minimum required memory... PASSED
Checking OS kernel cgroup.memory... PASSED
 - OS setting 'cgroup.memory' should be set to cgroup.memory=nokmem
Checking OS minimum ephemeral port... PASSED
Checking OS max open file descriptors per process... PASSED
Checking OS max open file descriptors system-wide... PASSED
Checking OS file system and Docker storage driver compatibility... PASSED
Checking OS file system storage driver permissions...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Errors have caused Elastic Cloud Enterprise installation to fail
[Errno 2] No such file or directory: '/elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp'
Traceback (most recent call last):
  File "/elastic_cloud_apps/bootstrap-initiator/initiator.py", line 83, in <module>
    prerequisite.verify_prerequisites(prerequisites, bootstrap_properties)
  File "/elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/base.py", line 63, in verify_prerequisites
    result, msg = p.is_met(bootstrap_properties)
  File "/elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/os_settings.py", line 275, in is_met
    uid = getpwuid(stat(tmp_dir).st_uid).pw_name
FileNotFoundError: [Errno 2] No such file or directory: '/elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp'

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

That's odd, it's failing on the last of these 4 lines:

        tmp_dir = "/elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp"
        call(["rm", "-rf", tmp_dir], stderr=DEVNULL, stdout=DEVNULL)
        call(["setuser", ece_user, "mkdir", "-p", tmp_dir], stderr=DEVNULL, stdout=DEVNULL)
        uid = getpwuid(stat(tmp_dir).st_uid).pw_name

So for some reason setuser YOUR_USER mkdir -p /elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp has (silently) failed.

I'd probably try something like docker run -it elastic-cloud-enterprise bash

and then see what happens when you run the setuser ... mkdir ...?

I don't have setuser command on this particular image, but I did manually create the /elastic_cloud_apps/... directories and verified the permissions are owned by the non-root user performing the install. The same error is displayed after manually creating the folder structure

Looking a little more at your comment, since I don't have setuser command on my RHEL image, is there a way to refactor that call? When I search the install script, I don't see those lines in my version of the script.

Sorry - setuser should have been called within the docker -it ... bash session, ie you shouldn't need it in your RHEL

What steps exactly did you take?

Running the setuser command in the docker image provided a user not found message for the user in my image.

Here are the steps I took:

[sppdevadmin@azurebasefeb2019 ~]$ docker run -it docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:2.5.0 bash
[root@d6bf9cc8ef89 /]# ls
anaconda-post.log  bin  elastic_cloud_apps  home  lib64  mnt  proc  run   service        srv  tmp  var
app                dev  etc                 lib   media  opt  root  sbin  snapshot-tool  sys  usr
[root@d6bf9cc8ef89 /]# whoamit
bash: whoamit: command not found
[root@d6bf9cc8ef89 /]# whoami
root
[root@d6bf9cc8ef89 /]# ls elastic_cloud_apps/
adminconsole          beats-runner         client-observer  director             jolokia           route-server        shell              zookeeper
allocator             blueprint            cloud-ui         docker-socket-proxy  metricbeat        run_tests.py        stunnel
allocator-metricbeat  bootstrap            cloud-ui-runner  filebeat             metricbeat-6.3.2  runner              test
beats                 bootstrap-initiator  constructor      filebeat-6.3.2       proxy             services-forwarder  upgrade
beats-6.3.2           client-forwarder     curator          haproxy              proxyv2           services.jar        upgrade-initiator
[root@d6bf9cc8ef89 /]# setuser sppdevadmin mkdir -p /elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp
setuser: user sppdevadmin not found

Hey sorry for the delay

Ah I think you should do

docker run --env UID=`id -u` \
      --env GID=`id -g` \
   -it docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:2.5.0 bash

usermod -u 1005 elastic
groupmod - g 1006 elastic
setuser elastic mkdir -p /elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp

Successfully ran the commands you provided,

[root@7f80107a671e /]# groupmod -g 1006 elastic
[root@7f80107a671e /]# setuser elastic mkdir -p /elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp
[root@7f80107a671e /]# ls /elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp/
README.md

Logged out of the bash session and ran the elastic setup script again, same error message.
FileNotFoundError: [Errno 2] No such file or directory: '/elastic_cloud_apps/bootstrap-initiator/bootstrap_initiator/prerequisite/tmp'