Getting a "couldn't connect to server" error on getblockchaininfo When I give the following command I get an error after a LONG lag (maybe 15-20 minutes):

~: bitcoin-cli getblockchaininfo
error: couldn't connect to server


Why?
Are you doing that remotely? if so please make sure that your port is open.

sudo ufw allow 8333


Also can you provide us with the last a few lines of debug.log file.