Thread: pg_hba.conf broken after cluster upgrade
Hello
I just upgraded my postgresql server from 8.4 to 9.2 on ubuntu linux 12.04. I installed the new version then used pg_upgrade to upgrade and replicate the cluster from the old server to the new.
Everything appears to have worked well except that I am left with a problem with my pg_hba.conf file. For some strange reason it only accepts a single line. So by default I had just:
local all postgres ident
All attempts to add any additional lines to this file, such as
host all all 127.0.0.1/32 md5
lead to the following error on startup:
2013-10-16 16:43:41 GMT LOG: authentication option not in name=value format: local
2013-10-16 16:43:41 GMT CONTEXT: line 1 of configuration file "/etc/postgresql/9.2/main/pg_hba.conf"
2013-10-16 16:43:41 GMT FATAL: could not load pg_hba.conf
Note that either the host line or the local line on their own are fine. But any attempt to have more than one line (in any order) leads to this error.
Any idea what on earth can I have done and how can I fix it?
Bob
On 10/16/2013 09:46 AM, Bob Jolliffe wrote: > Hello > > I just upgraded my postgresql server from 8.4 to 9.2 on ubuntu linux > 12.04. I installed the new version then used pg_upgrade to upgrade and > replicate the cluster from the old server to the new. > > Everything appears to have worked well except that I am left with a > problem with my pg_hba.conf file. For some strange reason it only > accepts a single line. So by default I had just: > > local all postgres ident > > All attempts to add any additional lines to this file, such as > > host all all 127.0.0.1/32 <http://127.0.0.1/32> md5 > > lead to the following error on startup: > > 2013-10-16 16:43:41 GMT LOG: authentication option not in name=value > format: local > 2013-10-16 16:43:41 GMT CONTEXT: line 1 of configuration file > "/etc/postgresql/9.2/main/pg_hba.conf" > 2013-10-16 16:43:41 GMT FATAL: could not load pg_hba.conf > > Note that either the host line or the local line on their own are fine. > But any attempt to have more than one line (in any order) leads to > this error. > > Any idea what on earth can I have done and how can I fix it? Can you show a cut and paste of the pg_hba.conf starting before the local line and extending below the next line? > > Bob -- Adrian Klaver adrian.klaver@gmail.com
On 10/16/2013 04:20 PM, Bob Jolliffe wrote: CCing the list so more eyes can see thid. > Hi Adrian > > Sure. Here are 6 versions of complete pg_hba.conf files: > > 1. This works (note the auth method is peer not ident. my first post > had an error). Complete one line pg_hba.conf file: > > local all postgres peer > > 2. This also works. Another one liner > > host all all 127.0.0.1/32 <http://127.0.0.1/32> md5 > > 3. This doesn't work > > local all postgres peer > host all all 127.0.0.1/32 <http://127.0.0.1/32> md5 > > 4. Neither does this > > host all all 127.0.0.1/32 <http://127.0.0.1/32> md5 > local all postgres peer > > 5. This works > > host all all 127.0.0.1/32 <http://127.0.0.1/32> md5 > # local all postgres peer > > 6. But this doesn't work > > # host all all 127.0.0.1/32 <http://127.0.0.1/32> md5 > local all postgres peer > > Failing with the error: > 2013-10-16 22:46:55 GMT LOG: configuration file > "/etc/postgresql/9.2/main/pg_hba.conf" contains no entries > > It seems clear to me now looking at 5 and 6 that there seems to be a > problem parsing the newline which would also be consistent with the > earlier 4. I've verified with hexl-mode in emacs that there are no > funny hidden characters and the lines are terminated by a single 0x0a > character. > > Can't figure out how it can be possible. The other files eg. > postgresql.conf are obviously being read fine. I have never seen this <http://127.0.0.1/32> in a pg_hba,conf. Of course I don't get out much:) Not sure of its purpose. It seems to be in the place of the IP mask. > > Bob -- Adrian Klaver adrian.klaver@gmail.com
On 10/16/2013 4:56 PM, Adrian Klaver wrote: > I have never seen this <http://127.0.0.1/32> in a pg_hba,conf. Of > course I don't get out much:) Not sure of its purpose. It seems to be > in the place of the IP mask. i think thats an email program artifact, trying to treat an IP as a URL -- john r pierce 37N 122W somewhere on the middle of the left coast
On 10/16/2013 05:03 PM, John R Pierce wrote: > On 10/16/2013 4:56 PM, Adrian Klaver wrote: >> I have never seen this <http://127.0.0.1/32> in a pg_hba,conf. Of >> course I don't get out much:) Not sure of its purpose. It seems to be >> in the place of the IP mask. > > i think thats an email program artifact, trying to treat an IP as a URL > > Yea, you are right it showed up in the reply not the original message, time for that beer. -- Adrian Klaver adrian.klaver@gmail.com