Chroot: cannot change root directory to : No such file or directory in the logs while restart tyk API Gateway

Hi,

I am unable to bring up tyk API gateway on CentOS Linux release 7.9.2009 (Core). when i restart it i get the below issue. In the logs i see

chroot: cannot change root directory to : No such file or directory
chroot: cannot change root directory to : No such file or directory
# service tyk-gateway restart
tyk-gateway started
# service tyk-gateway status
**tyk-gateway is not running**
#
# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
# rpm -qa | grep tyk
tyk-gateway-4.0.1-1.x86_64
#
# service redis status
Redirecting to /bin/systemctl status redis.service
● redis.service - Redis persistent key-value database
   Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/redis.service.d
           └─limit.conf
   Active: active (running) since Sat 2022-04-30 00:01:55 IST; 9min ago
 Main PID: 1365 (redis-server)
   CGroup: /system.slice/redis.service
           └─1365 /usr/bin/redis-server 127.0.0.1:6379

Apr 30 00:01:55 tykapigateway systemd[1]: Starting Redis persistent key-value database...
Apr 30 00:01:55 tykapigateway systemd[1]: Started Redis persistent key-value database.
#
#cat /var/log/tyk-gateway.stderr
chroot: cannot change root directory to : No such file or directory
chroot: cannot change root directory to : No such file or directory
chroot: cannot change root directory to : No such file or directory
chroot: cannot change root directory to : No such file or directory
chroot: cannot change root directory to : No such file or directory
chroot: cannot change root directory to : No such file or directory
cat /opt/tyk-gateway/tyk.conf
{
  "listen_port": 8080,
  "node_secret": "352d20ee67be67f6340b4c0605b044b7",
  "secret": "352d20ee67be67f6340b4c0605b044b7",
  "template_path": "/opt/tyk-gateway/templates",
  "use_db_app_configs": true,
  "db_app_conf_options": {
    "connection_string": "",
    "node_is_segmented": false,
    "tags": []
  },
  "disable_dashboard_zeroconf": false,
  "app_path": "/opt/tyk-gateway/apps",
  "middleware_path": "/opt/tyk-gateway/middleware",
  "storage": {
    "type": "redis",
    "host": "localhost",
    "port": 6379,
    "username": "",
    "password": "",
    "database": 0,
    "optimisation_max_idle": 2000,
    "optimisation_max_active": 4000
  },
  "enable_analytics": true,
  "analytics_config": {
    "type": "",
    "ignored_ips": [],
    "enable_detailed_recording": true,
    "enable_geo_ip": false,
    "geo_ip_db_path": "",
    "normalise_urls": {
      "enabled": true,
      "normalise_uuids": true,
      "normalise_numbers": true,
      "custom_patterns": []
    }
  },
  "health_check": {
    "enable_health_checks": false,
    "health_check_value_timeouts": 60
  },
  "dns_cache": {
    "enabled": false,
    "ttl": 3600
  },
  "allow_master_keys": false,
  "policies": {
    "policy_source": "service",
    "policy_connection_string": "",
    "policy_record_name": "tyk_policies",
    "allow_explicit_policy_id": true
  },
  "hash_keys": true,
  "suppress_redis_signal_reload": false,
  "use_redis_log": true,
  "close_connections": false,
  "enable_non_transactional_rate_limiter": true,
  "enable_sentinel_rate_limiter": false,
  "experimental_process_org_off_thread": false,
  "local_session_cache": {
    "disable_cached_session_state": false
  },
  "http_server_options": {
    "enable_http2": true,
    "enable_websockets": true
  },
  "uptime_tests": {
    "disable": false,
    "config": {
      "enable_uptime_analytics": true,
      "failure_trigger_sample_size": 2,
      "time_wait": 10,
      "checker_pool_size": 50
    }
  },
  "hostname": "",
  "enable_custom_domains": true,
  "proxy_enable_http2": true,
  "enable_jsvm": true,
  "oauth_redirect_uri_separator": ";",
  "coprocess_options": {
    "enable_coprocess": false,
    "coprocess_grpc_server": "",
    "python_path_prefix": "/opt/tyk-gateway"
  },
  "pid_file_location": "./tyk-gateway.pid",
  "allow_insecure_configs": true,
  "public_key_path": "",
  "close_idle_connections": false,
  "allow_remote_config": false,
  "enable_bundle_downloader": true,
  "bundle_base_url": "",
  "global_session_lifetime": 100,
  "force_global_session_lifetime": false,
  "max_idle_connections_per_host": 500,
  "jwt_ssl_insecure_skip_verify": false
}

Please guide. Thanks in Advance.

Best Regards,

Kaushal

Hi,

When i hit http://192.168.0.164:8080/ I face “Not Found”

# ps aux | grep tyk
root      1820  0.1  0.3 1155420 37824 ?       Ssl  21:53   0:03 /opt/tyk-gateway/tyk --conf /opt/tyk-gateway/tyk.conf
root      2222  0.0  0.0 112812   980 pts/0    S+   22:21   0:00 grep --color=auto tyk
# ps aux | grep redis
redis     2208  0.2  0.0 143060  5892 ?        Ssl  22:13   0:01 /usr/bin/redis-server 127.0.0.1:6379
root      2224  0.0  0.0 112812   980 pts/0    S+   22:21   0:00 grep --color=auto redis
#
cat /opt/tyk-gateway/tyk.conf
{
  "listen_port": 8080,
  "secret": "352d20ee67be67f6340b4c0605b044b7",
  "template_path": "/opt/tyk-gateway/templates",
  "use_db_app_configs": false,
  "app_path": "/opt/tyk-gateway/apps",
  "middleware_path": "/opt/tyk-gateway/middleware",
  "storage": {
    "type": "redis",
    "host": "127.0.0.1",
    "port": 6379,
    "username": "",
    "password": "",
    "database": 0,
    "optimisation_max_idle": 2000,
    "optimisation_max_active": 4000
  },
  "enable_analytics": false,
  "analytics_config": {
    "type": "",
    "ignored_ips": [],
    "normalise_urls": {
      "enabled": true,
      "normalise_uuids": true,
      "normalise_numbers": true,
      "custom_patterns": []
    }
  },
  "health_check": {
    "enable_health_checks": false,
    "health_check_value_timeouts": 60
  },
  "dns_cache": {
    "enabled": false,
    "ttl": 3600
  },
  "allow_master_keys": false,
  "policies": {
    "policy_source": "file",
    "policy_record_name": "policies/policies.json"
  },
  "hash_keys": true,
  "suppress_redis_signal_reload": false,
  "close_connections": false,
  "enable_non_transactional_rate_limiter": true,
  "enable_sentinel_rate_limiter": false,
  "local_session_cache": {
    "disable_cached_session_state": false
  },
  "uptime_tests": {
    "disable": false,
    "config": {
      "enable_uptime_analytics": false,
      "failure_trigger_sample_size": 2,
      "time_wait": 10,
      "checker_pool_size": 50
    }
  },
  "http_server_options": {
    "enable_http2": true,
    "enable_websockets": true
  },
  "hostname": "",
  "enable_custom_domains": true,
  "proxy_enable_http2": true,
  "enable_jsvm": true,
  "oauth_redirect_uri_separator": ";",
  "coprocess_options": {
    "enable_coprocess": false,
    "coprocess_grpc_server": "",
    "python_path_prefix": "/opt/tyk-gateway"
  },
  "pid_file_location": "./tyk-gateway.pid",
  "allow_insecure_configs": true,
  "public_key_path": "",
  "close_idle_connections": false,
  "allow_remote_config": false,
  "enable_bundle_downloader": true,
  "bundle_base_url": "",
  "global_session_lifetime": 100,
  "force_global_session_lifetime": false,
  "max_idle_connections_per_host": 500,
  "jwt_ssl_insecure_skip_verify": false
}

Please guide. Thanks in Advance.

Best Regards,

Kaushal

Hello @kaushalshriyan and welcome to the community. I assume you resolved the chroot: cannot change root directory to : No such file or directory error and Tyk is not working as expected. If not then please let us know the directory you installed Tyk.

As for the Not Found result, that is the default response of the gateway’s <url/ip>:<port> when you query it. You can confirm the gateway is up and running with the liveness health check

Hello,

I 'm facing the same issue, could you please share the solution ?

Regards

@df_dfrachid Could you share the output of the following commands on your affected system to help us to diagnose the issue

  1. output of systemctl cat tyk-gateway
  2. output of ls -al /opt/tyk-gateway/
  3. output of rpm -qa | grep tyk