I experienced a similar issue it might be related. Please view my post below which I resolved myself.
After fixing the issue with postgres, I received another error message which looks similar to yours.
When I initialised maas 2.9(snap) I had to show the postgres port number 5432, please see example below.