无法使用Pidgin连接到Google Talk(SASL错误)

在安装了Ubuntu 11.10之后,Pidgin无法连接到任何Jabber服务(包括Google Talk和本地即时通讯)。奇怪的是,相同的配置在一台安装了Ubuntu 11.10的笔记本电脑上可以正常工作,但在一台工作站上却不行。已经将.lpurple目录从笔记本电脑复制到工作站,但问题仍然存在。运行"piding -d > pidgin.log"命令后,观察到以下情况:
(16:06:25) account: Connecting to account foo@gmail.com/.
(16:06:25) connection: Connecting. gc = 0x7f38e3828ea0
(16:06:25) dnssrv: querying SRV record for gmail.com: _xmpp-client._tcp.gmail.com
(16:06:25) dnssrv: found 5 SRV entries
(16:06:25) dnsquery: Performing DNS lookup for xmpp.l.google.com
(16:06:25) dns: Wait for DNS child 11596 failed: No child processes
(16:06:25) dns: Created new DNS child 11867, there are now 1 children.
(16:06:25) dns: Successfully sent DNS request to child 11867
(16:06:25) dns: Got response for 'xmpp.l.google.com'
(16:06:25) dnsquery: IP resolved for xmpp.l.google.com
(16:06:25) proxy: Attempting connection to 173.194.70.125
(16:06:25) proxy: Connecting to xmpp.l.google.com:5222 with no proxy
(16:06:25) proxy: Connection in progress
(16:06:25) proxy: Connecting to xmpp.l.google.com:5222.
(16:06:25) proxy: Connected to xmpp.l.google.com:5222.
(16:06:25) jabber: Sending (foo@gmail.com): <?xml version='1.0' ?>
(16:06:25) jabber: Sending (foo@gmail.com): <stream:stream to='gmail.com' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
(16:06:25) jabber: Recv (379): <stream:stream from="gmail.com" id="49198E875F30F7D0" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"><stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism><mechanism>X-OAUTH2</mechanism></mechanisms></stream:features>
(16:06:25) jabber: Sending (foo@gmail.com): <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
(16:06:25) jabber: Recv (50): <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
(16:06:25) nss: subject=CN=gmail.com,O=Google Inc.,L=Mountain View,ST=California,C=US issuer=CN=Google Internet Authority,O=Google Inc,C=US
(16:06:25) nss: subject=CN=Google Internet Authority,O=Google Inc,C=US issuer=OU=Equifax Secure Certificate Authority,O=Equifax,C=US
(16:06:25) nss: subject=OU=Equifax Secure Certificate Authority,O=Equifax,C=US issuer=OU=Equifax Secure Certificate Authority,O=Equifax,C=US
(16:06:25) certificate/x509/tls_cached: Starting verify for gmail.com
(16:06:25) certificate/x509/tls_cached: Checking for cached cert...
(16:06:25) certificate/x509/tls_cached: ...Found cached cert
(16:06:25) nss/x509: Loading certificate from /home/david/.purple/certificates/x509/tls_peers/gmail.com
(16:06:25) certificate/x509/tls_cached: Peer cert matched cached
(16:06:25) nss/x509: Exporting certificate to /home/david/.purple/certificates/x509/tls_peers/gmail.com
(16:06:25) util: Writing file /home/david/.purple/certificates/x509/tls_peers/gmail.com
(16:06:25) certificate: Successfully verified certificate for gmail.com
(16:06:25) jabber: Sending (ssl) (foo@gmail.com): <stream:stream to='gmail.com' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
(16:06:25) jabber: Recv (ssl)(138): <stream:stream from="gmail.com" id="F6FD74872873A647" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
(16:06:25) jabber: Recv (ssl)(197): <stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>X-GOOGLE-TOKEN</mechanism><mechanism>X-OAUTH2</mechanism></mechanisms></stream:features>
(16:06:25) sasl: sasl_state is -1, failing the mech and trying again
(16:06:25) connection: Connection error on 0x7f38e3828ea0 (reason: 3 description: Server does not use any supported authentication method)
(16:06:25) account: Disconnecting account foo@gmail.com/ (0x7f38e2ca5b50)
(16:06:25) connection: Disconnecting connection 0x7f38e3828ea0
(16:06:25) jabber: Sending (ssl) (foo@gmail.com): </stream:stream>
(16:06:25) connection: Destroying connection 0x7f38e3828ea0

如您所见,证书似乎是有效的,有问题的是:
sasl: sasl_state is -1, failing the mech and trying again

没有启用防火墙,所以肯定还有其他原因。有什么想法吗?

3如果你对问题有答案,你应该把答案从问题中取出来,作为一个回答发布出来(自己回答自己的问题也是可以的)。 - Azendale
谢谢,我错过了添加答案的链接。我习惯了 Stack Overflow 的设计 :) - David Kuridža
4个回答

由于某些原因,/etc/hosts 文件中包含了错误的主机名 127.0.0.1。修改后,它已经可以正常工作了。希望对其他人有所帮助 :)

检查你系统的主机名在/etc/hostname文件里面。然后在/etc/hosts文件里面进行修改。这样就能解决你的问题了 :-)

我在Ubuntu 12.04中遇到了同样的问题。当我看到之前的评论时,我检查了/etc/hosts文件,发现它是空白的。所以,我添加了以下内容:
127.0.0.1 localhost  
127.0.1.1 ubuntu  

这是现在的样子:
root@ubuntu:/etc/apt/apt.conf.d# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu

然后
root@ubuntu:/etc/apt/apt.conf.d# /etc/init.d/networking restart  
 * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces  
 * Reconfiguring network interfaces...   

退出Pidgin并重新打开。哇,现在它像魔法一样正常工作了。希望这对其他人也有帮助。

我遇到了同样的问题。原来是我在我的Google账户上启用了两步验证。我只需进入我的应用程序专用密码设置(在Google中),并撤销对Pidgin的访问权限。然后我重新添加了Pidgin,并生成了一个新的应用程序专用密码,将其输入到Pidgin中的Google Talk账户设置中,现在一切都正常工作了。