Thread: "expected authentication request from server, but received..."

"expected authentication request from server, but received..."

From
Michał Jęczalik
Date:
     Hello,

I have a very old postgres 6.4 installation. I'm trying to connect to it 
from a fresh, up-to-date Debian-host, but I'm constantly getting (from DBI 
and PHP as well) this error message:

# ./update_dns.pl
DBI connect('dbname=dns;host=sql;authtype=password','dns',...) failed: 
expected authentication request from server, but received U at ./update_dns.pl line 237


Connection with psql works OK. Connecting from different (older) hosts 
with DBI/PHP works perfect as well. Something must have changed in recent 
versions of libpq and now it doesn't work. I looked into source code and 
found that the server's message at the very start of conversation appears 
to be something else than the libpq expects. But how to fix it?! Has the 
protocol change or what?

P.S. Don't tell me to upgrade postgres :) It must stay like that for some 
reasons which are beyond me.
-- 
Samotnik Michał Jęczalik, +48.695.64.75.14
www.zagle.org.pl   - rejsy morskie



Re: "expected authentication request from server, but received..."

From
Martijn van Oosterhout
Date:
On Mon, Sep 26, 2005 at 09:59:53AM +0200, Micha? J?czalik wrote:
> Connection with psql works OK. Connecting from different (older) hosts
> with DBI/PHP works perfect as well. Something must have changed in recent
> versions of libpq and now it doesn't work. I looked into source code and
> found that the server's message at the very start of conversation appears
> to be something else than the libpq expects. But how to fix it?! Has the
> protocol change or what?

Umm, I think the protocol version is up to 3 or 4 now. I think libpq
supports all the way back to 7.0, I don't know if anyone tests earlier
than that.

If you really need this to work, I suggest pulling the libpq from that
release (CVS or tarball) or slightly later and installing that on the
new machines.

But you should upgrade, 6.4 hasn't had support for year, who know how
many bugs...
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Re: "expected authentication request from server, but

From
Michal Jeczalik
Date:
On Mon, 26 Sep 2005, Martijn van Oosterhout wrote:

> On Mon, Sep 26, 2005 at 09:59:53AM +0200, Micha? J?czalik wrote:
>> Connection with psql works OK. Connecting from different (older) hosts
>> with DBI/PHP works perfect as well. Something must have changed in recent
>> versions of libpq and now it doesn't work. I looked into source code and
>> found that the server's message at the very start of conversation appears
>> to be something else than the libpq expects. But how to fix it?! Has the
>> protocol change or what?
>
> Umm, I think the protocol version is up to 3 or 4 now. I think libpq
> supports all the way back to 7.0, I don't know if anyone tests earlier
> than that.
>
> If you really need this to work, I suggest pulling the libpq from that
> release (CVS or tarball) or slightly later and installing that on the
> new machines.

Heh, that's what I'm currently doing, but it's not so easy to compile 6.4 
on a new system. configure states that the compiler cannot create 
executables, but I ripped this check out of it. Anyway, something goes 
wrong while generating the Makefile:

sed: file conftest.s1 line 33: unterminated `s' command
creating backend/catalog/genbki.sh
sed: file conftest.s1 line 33: unterminated `s' command
creating backend/utils/Gen_fmgrtab.sh
sed: file conftest.s1 line 33: unterminated `s' command
creating bin/pg_dump/Makefile
sed: file conftest.s1 line 33: unterminated `s' command
creating bin/pg_version/Makefile
sed: file conftest.s1 line 33: unterminated `s' command

:(
-- 
Samotnik Michał Jęczalik, +48.695.64.75.14
www.zagle.org.pl   - rejsy morskie



Re: "expected authentication request from server, but

From
"Michael Paesold"
Date:
Michal Jeczalik wrote:

> On Mon, 26 Sep 2005, Martijn van Oosterhout wrote:
>
>> On Mon, Sep 26, 2005 at 09:59:53AM +0200, Micha? J?czalik wrote:
>>> Connection with psql works OK. Connecting from different (older) hosts
>>> with DBI/PHP works perfect as well. Something must have changed in 
>>> recent
>>> versions of libpq and now it doesn't work. I looked into source code and
>>> found that the server's message at the very start of conversation 
>>> appears
>>> to be something else than the libpq expects. But how to fix it?! Has the
>>> protocol change or what?
>>
>> Umm, I think the protocol version is up to 3 or 4 now. I think libpq
>> supports all the way back to 7.0, I don't know if anyone tests earlier
>> than that.
>>
>> If you really need this to work, I suggest pulling the libpq from that
>> release (CVS or tarball) or slightly later and installing that on the
>> new machines.
>
> Heh, that's what I'm currently doing, but it's not so easy to compile 6.4 
> on a new system. configure states that the compiler cannot create 
> executables, but I ripped this check out of it. Anyway, something goes 
> wrong while generating the Makefile:

Try to compile 7.0 or 7.1, those versions will probably still support the 
6.4 wire protocol. I am sure someone with more historical knowledge (or 
reading the release notes back to 6.4) can exactly tell you the latest 
version compatible with 6.4.

It was already said, but please -- upgrade. Any version before 7.2 is going 
to eat your data after a certain amount of transactions.

Best Regards,
Michael Paesold 



Re: "expected authentication request from server, but received..."

From
Tom Lane
Date:
Michał Jęczalik <pgsql-hackers@jeczalik.com> writes:
> I have a very old postgres 6.4 installation. I'm trying to connect to it 
> from a fresh, up-to-date Debian-host, but I'm constantly getting (from DBI 
> and PHP as well) this error message:

> # ./update_dns.pl
> DBI connect('dbname=dns;host=sql;authtype=password','dns',...) failed: 
> expected authentication request from server, but received U
>   at ./update_dns.pl line 237

You certain it's 6.4, and not even older?  A look in the CVS logs says
that we were using protocol 2.0 starting in 6.4, so current libpq should
still talk to it.

> P.S. Don't tell me to upgrade postgres :) It must stay like that for some 
> reasons which are beyond me.

6.4 *will* eat your data eventually.  Don't say you weren't warned.
        regards, tom lane


Re: "expected authentication request from server, but

From
Alvaro Herrera
Date:
On Mon, Sep 26, 2005 at 10:28:48AM +0200, Michal Jeczalik wrote:

> Heh, that's what I'm currently doing, but it's not so easy to compile 6.4 
> on a new system. configure states that the compiler cannot create 
> executables, but I ripped this check out of it. Anyway, something goes 
> wrong while generating the Makefile:
> 
> sed: file conftest.s1 line 33: unterminated `s' command

I bet this is the multiline gcc --version.  You could try wrapping gcc
with a script that returns a single line --version.  (Or maybe using an
older gcc release.)

-- 
Alvaro Herrera                                http://www.PlanetPostgreSQL.org
"World domination is proceeding according to plan"        (Andrew Morton)


Re: "expected authentication request from server, but

From
Michal Jeczalik
Date:
On Mon, 26 Sep 2005, Tom Lane wrote:

> Michał Jęczalik <pgsql-hackers@jeczalik.com> writes:
>> I have a very old postgres 6.4 installation. I'm trying to connect to it
>> from a fresh, up-to-date Debian-host, but I'm constantly getting (from DBI
>> and PHP as well) this error message:
>
>> # ./update_dns.pl
>> DBI connect('dbname=dns;host=sql;authtype=password','dns',...) failed:
>> expected authentication request from server, but received U
>>   at ./update_dns.pl line 237
>
> I went back and built the 6.4 branch just to confirm that current libpq
> and psql would still talk to a 6.4 server.  They do (modulo most of
> psql's \d commands not working).  So there's something more here than a
> simple version mismatch.  Is it possible that DBI is using some private
> all-Perl client library rather than libpq to talk to the server?

Quite possible. I managed to compile 7.4 and that error message 
disappeared. Anyway, perl dumped core at the very start of the connection. 
;) I downgraded DBD::Pg to 1.22 and... it worked! I did not try to upgrade 
libpq back to 8.x, but... PHP didn't worked as well with recent version of 
libs... After downgrading to 7.4 it worked fine. So there must be 
something about libpq anyway.

Regards,
-- 
Samotnik Michał Jęczalik, +48.695.64.75.14
www.zagle.org.pl   - rejsy morskie



Re: "expected authentication request from server, but

From
Michal Jeczalik
Date:
On Mon, 26 Sep 2005, Michael Paesold wrote:

>>>> to be something else than the libpq expects. But how to fix it?! Has the
>>>> protocol change or what?
>>> 
>>> Umm, I think the protocol version is up to 3 or 4 now. I think libpq
>>> supports all the way back to 7.0, I don't know if anyone tests earlier
>>> than that.
>>> 
>>> If you really need this to work, I suggest pulling the libpq from that
>>> release (CVS or tarball) or slightly later and installing that on the
>>> new machines.
>> 
>> Heh, that's what I'm currently doing, but it's not so easy to compile 6.4 
>> on a new system. configure states that the compiler cannot create 
>> executables, but I ripped this check out of it. Anyway, something goes 
>> wrong while generating the Makefile:
>
> Try to compile 7.0 or 7.1, those versions will probably still support the 6.4 
> wire protocol. I am sure someone with more historical knowledge (or reading 
> the release notes back to 6.4) can exactly tell you the latest version 
> compatible with 6.4.

OK. It worked with 7.4 + DBD not newer than 1.22 - more recent versions 
simply make perl to dump core while connecting to postgres. ;)
-- 
Samotnik Michał Jęczalik, +48.695.64.75.14
www.zagle.org.pl   - rejsy morskie