HAProxy community

External-check with chroot not working

Hi,

I am trying to get an external-check running together with chroot. For simpliness to show the issue I will just call /bin/true as check.

I tried the following:

without chroot:

backend bk_redis
    option external-check
    external-check command /bin/true
    server elastic01.example.com_7000 localhost:7000 check inter 1s
    server elastic02.example.com_7001 localhost:7001 check inter 1s

that one is working. Both servers are returned as available as expected.

Now my changes with chroot:
first, I copied /bin/true to /var/opt/rh/rh-haproxy18/lib/haproxy/true

then I changed the config:

global
    chroot      /var/opt/rh/rh-haproxy18/lib/haproxy

backend bk_redis
    option external-check
    external-check command /true
    server elastic01.example.com_7000 localhost:7000 check inter 1s
    server elastic02.example.com_7001 localhost:7001 check inter 1s

But here I get only this error:

[WARNING] 022/114401 (2119) : Server bk_redis/elastic01.internal.dtpublic.de_7000 is DOWN, reason: External check error, code: 255, check duration: 14ms. 1 active and 0
[ALERT] 022/114402 (2127) : Failed to exec process for external health check: No such file or directory. Aborting.
[ALERT] 022/114403 (2128) : Failed to exec process for external health check: No such file or directory. Aborting.
[ALERT] 022/114403 (2131) : Failed to exec process for external health check: No such file or directory. Aborting.

I am not so familar with chroot. Can you point out, where my mistake is?

Thanks, Andreas

Use the chroot command to test it yourself:

There is nothing special about haproxy’s chroot functionality.

Btw I still think you should drop stunnel and do everything in haproxy instead. This will fix all your issues and make your setup simpler.