I am also running into this issue using 5.1.22 and 5.1.24 with the same symptoms.
Turning on debug logging doesn’t yield much–it just hangs for a minute and then retries, outputting the same logging statements. There are no error messages.
On the client side, it hangs forever waiting to get a list of services from the server.
This is on an Amazon Linux AMI, also headless. I did not have this problem on 5.0.53 (which was installed previously).