I am running the latest bleeding version of KStars and Ekos.
Ekos is unable to connect to phd2 because looks like INDI profile does not save the port of phd2.
I enter port number 4400 and save the profile, but then I open profile for editing again, I see port as 0.
Obviously Ekos is unable to connect to phd2 with port 0 and thus connect fails.
I had this problem a few months ago. It turned out it was because of a very old bug that Jasem fixed ages ago. But since the bug affected your kstars data directory, the issue got saved on your computer. I can tell you how I fixed it on my computer. I had to make a slight edit to my userdb.sqlite database. I used a program called dbbrowser to edit it. The issue was that the column name in the userdb.sqlite database was guiderpost instead of guiderport. It was just a typo. You should be able to fix it without too much trouble.