Bug 113933
Summary: | rhn_register - socket.error: host not found | ||
---|---|---|---|
Product: | Red Hat Satellite 5 | Reporter: | veepee1 <rhn> |
Component: | Registration | Assignee: | Adrian Likins <alikins> |
Status: | CLOSED WONTFIX | QA Contact: | Red Hat Satellite QA List <satqe-list> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | unspecified | CC: | cperry, michaels, nphilipp |
Target Milestone: | --- | Keywords: | EasyFix |
Target Release: | --- | ||
Hardware: | i686 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2009-08-21 22:01:21 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
veepee1
2004-01-20 11:52:51 UTC
Not sure if this is frowned upon or not, but I just wanted to confirm that I have also seen this behavior on three different machines that I've attempted to register with my existing RHN account (username "hironimus") I've done some more digging in the code and I've found that this error is occuring while the rhn_register program is trying to discover information about my machine's hardware. Specifically, it appears to be trying to discover the machine's hostname and IP address, and this is where the error is occuring. It looks like the hardware.py script is opening a socket connection to the serverURL host, then trying to discover the IP address of my machine by getting the properties of that connection: <quote> def findHostByRoute(): cfg = config.RHNConfig() s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serverUrl = cfg.readEntry('serverURL') server = string.split(serverUrl, '/')[2] s.connect((server, 80)) (intf, port) = s.getsockname() hostname = socket.gethostbyaddr(intf)[0] s.close() return hostname, intf </quote> If I comment out the call to findHostByRoute() and hard code my hostname and IP address into the hardware.py file, the registration works. Here is a diff: <quote> [root@gnu2 register]# diff -u hardware.py.orig hardware.py --- hardware.py.orig Fri Feb 6 10:26:21 2004 +++ hardware.py Fri Feb 6 10:26:56 2004 @@ -293,9 +293,9 @@ if netdict['hostname'] == 'localhost.localdomain' or \ netdict['ipaddr'] == "127.0.0.1": - hostname, ipaddr = findHostByRoute() - netdict['hostname'] = hostname - netdict['ipaddr'] = ipaddr + #hostname, ipaddr = findHostByRoute() + netdict['hostname'] = "gnu2.crye-leike.com" + netdict['ipaddr'] = "10.62.148.241" return netdict # This one tries to read the DMI information - it needs root access to do that. </quote> I have one machine here that makes it past this discovery step without incident. It is on the DMZ of my firewall and has a static internal IP which is mapped to an external IP address. Connections from and to this machine are NAT'ed through this address. The machine that I cannot successfully register is on the "trusted" portion of my firewall and has no mapped IP. Connections from this machine are NAT'ed outgoing but the only way to communicate with the machine from the outside is if the machine initiaties the connection itself. I'm not a networking or firewall expert so I may not be describing this completely but that is my understanding of how it works. I'm going to place this machine on my DMZ and give it a different mapped address and see if that rectifies the problem, but I figured I'd share this information in the meantime in case it rings bells with anyone. I figured out what the problem was. When I changed my machine's hostname and IP address I updated the /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0 files, but I forgot to update /etc/hosts. Doh! I realize I made an amateurish mistake, but I would respectfully suggest that the rhn_register script be updated to print a somewhat friendlier error message. My suggestion is something like this: "There was a problem attempting to discover your machine's hostname and IP address. Please check the contents of your network configuration files (list files) for any problems and try again." Thanks... I still see the problem with rhn_register-2.9.2-1.2.1AS from a machine that: - is behind a firewall, you can only use a web proxy to get out - can't resolve external hostnames via nslookup/gethostbyname() - is configured properly w.r.t. hostname, /etc/hosts I have tracked back the behaviour to this section of /usr/share/rhn/register/hardware.py: [...] 280 def read_network(): [...] 284 netdict['hostname'] = socket.gethostname() 285 try: 286 netdict['ipaddr'] = socket.gethostbyname(socket.gethostname()) 287 except: 288 netdict['ipaddr'] = "127.0.0.1" 289 290 netdict['hostname'] = 'localhost.localdomain' 291 netdict['ipaddr'] = "127.0.0.1" 292 [...] Lines 290 and 291 overwrite the real hostname, ipaddr and seem to be debugging statements (to test out the code path going through findHostByRoute()?). When I removed them, everything worked. RHEL 2.1 is EOL'd. Closing this bug out. |