Mpc problem: getaddrinfo not checking /etc/hosts?

The source of this question is my attempt to get mpc to contact mpd on my localhost when the internet is down. When the internet is up it works fine, but when i'm not connected to the internet, running mpc behaves as follows:
I seem to have tracked this down to a problem in getaddrinfo (possibly in my sytem configuration?). I created a piece of test code (below) that does a gethostbyname and then a getaddrinfo. On this computer, both work when connected to the internet, but getaddrinfo fails when disconnected. I tested the same code on an ubuntu computer and it getaddrinfo worked even when disconnected from the internet.
My /etc/hosts and /etc/host.conf seem to be set properly. glibc is 2.8-3. I would have thought that getaddrinfo having such a problem would cause more errors than just in mpc, but I haven't noticed any.
I'd really appreciate any help.
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
int main (void)
struct addrinfo *addrinfo;
int i, error;
struct hostent *h;
h = gethostbyname("localhost");
if (h) {
for (i=0; i < h->h_length - 1; i++)
printf("%d.", h->h_addr_list[0][i]);
printf("%d\n", h->h_addr_list[0][i]);
} else {
printf("no such host\n");
error = getaddrinfo("localhost", NULL, NULL, &addrinfo);
if (error) {
printf("host not found: %s\n", gai_strerror(error));
} else {
while (addrinfo) {
printf("%d %d %d\n",AF_INET,AF_INET6,addrinfo->ai_family);
addrinfo = addrinfo->ai_next;
return 0;
$ ./hnt
127.0.0.1
2 10 2
2 10 2
2 10 2
$ sudo dhcpcd -k wlan0
$ ./hnt
127.0.0.1
host not found: Temporary failure in name resolution
$ mpc
MPD_HOST and/or MPD_PORT environment variables are not set
error: host "localhost" not found: Temporary failure in name resolution
$
Uncommented and nonblank lines of /etc/hosts:
127.0.0.1      localhost.localdomain  localhost heroine
and /etc/host.conf:
order hosts,bind
multi on

Alas, setting MPD_HOST does not help. If there is some way to give mpc an ip address instead of a hostname, that might help. Just putting 127.0.0.1 as MPD_HOST doesn't work.
I also really think there is something really weird going on with getaddrinfo.
Thanks for the idea.
$ MPD_HOST=localhost mpc
MPD_HOST and/or MPD_PORT environment variables are not set
error: host "localhost" not found: Temporary failure in name resolution
$ MPD_HOST=127.0.0.1 mpc
MPD_HOST and/or MPD_PORT environment variables are not set
error: host "127.0.0.1" not found: Address family for hostname not supported
$

Similar Messages

  • I have this message on Terminal. nano/private/etc/hosts: command not found. How can I fix it to get right?

    /etc/hosts ; exit;
    /etc/hosts: line 7: 127.0.0.1: command not found
    /etc/hosts: line 8: 255.255.255.255: command not found
    /etc/hosts: line 9: ::1: command not found
    logout

    What are you attempting to do?

  • How to use /etc/hosts file

    how to get Mac OS "X" 10.6.x to use /etc/hosts file and/or /etc/resolv.conf file(s) (ala Unix-style); instead of using some other mechanism?

    I 'thought' that SnowLeopard (somewhere in the "Support" arena) told me that 10.6 (SnowLeopard) did NOT use /etc/hosts, but I am corrected, and now understand through a number of replies here (Apple-Support-Discussions) and other responses that SnowLeopard (10.6 (I'm at 10.6.7) DOES USE /etc/hosts... - AND YES _ I'm attempting to prevent some things, and have some web-site-development-things go to a local-server, etc. etc. etc. - but - I guess my 'answer' was supplied by a number of people and that my ...nix background and my familiarity with /etc/hosts is fine and working well...
    thanks to one and all who helped! - I'm now also well-acquainted with dscl, dscacheutil, and other such utilities...
    THANKSSSSS!!!!!!!

  • Impact on changing mode of /etc/hosts to 600(rw-------)

    Hi all,
    I have a customer who asked us the imapct on changing mode of /etc/hosts to 600(rw-------) to an IQ server.
    They have to change the mode as above due to a guideline from Government.
    Is it ok with an IQ server if we change hostname in all scripts, such as .odbc.ini, to ip address for the machine where the IQ server is running ?
    1. Would you please let me know what kind of impacts would be expected if the customer change the mode of the /etc/hosts file ?
    2. Are there any points we should consider ?
    Any replies would be highly appreciated.
    Regards.
    Jerry

    As long as gethostbyaddr() and gethostbyname() retrieve valid information for the local addresses, then you should be fine.  IQ does not parse /etc/hosts directly.
    see the man pages of gethostbyaddr and gethostbyname for more details on how name/ip resolution occurs.
    jason

  • Have published iweb site for five years with no problems and just opened a new site and get - 404: Page not found  This error is generated when there was no web page with the name you specified at the web site.-is the problem with iweb or with hosting?  T

    I am sorry if thie is republished-My first time doing this and I am not sure what goes where and where to hear feedback.
    Have published iweb site for five years with no problems and just opened a new site and get -
    404: Page not found 
    This error is generated when there was no web page with the name you specified at the web site.-
    Troubleshooting suggestions:
    Ensure the page you are linking to exists in the correct folder.
    Check your file name for case sensitivity . Index.htm is not the same as index.htm!
    Temporarily disable any rewrite rules by renaming your .htaccess file if it exists
    is the problem with
    iweb or with hosting?
    One Apple tech started to fix Iweb and had to end session and the next said problem with hosting at Network Solutions as it published
    to local folder. NWS has checked sttting a few times-
    Any help would be extremely appreciated as trying to fix this for about five weeks
    Thanks VG
    <Email Edited by Host>

    It's a really bad idea to post your email address - it's an invitation to spam - and I've asked the Hosts to remove it. (Even though I've now noticed you mis-spelled it! - anyway, never post your address in a forum.)
    You have a site here: http://virginiagordon.com/www.virginiagordon.com/WELCOME.html
    If that's not the page you are having trouble with, what is that page's URL?

  • The new entries made in /etc/hosts file is not picked up by Weblogic.

    Hi All,
    I have come across a scenario where i have changed the IP address of a particular host name (which was already present in etc/hosts) to point to a new IP address.
    After i did this change, when i do a telnet test to the same hostname, i can see it is getting connected to the new IP to which i changed. But my service which is deployed on weblogic 10.0 still keeps sending requests to the old IP which i commented in the etc/hosts file instead of the new IP address.
    My question is will weblogic cache the data in etc/hosts file somewhere?
    Thanks in anticipation..
    Madhu

    Application deployed on weblogic server will pick the IP address of the server on which the application is deployed .
    IP address or listen address for weblogic server can be configured in 3 different ways :
    Listen Address : Blank --- This means that the server will listen to all the interfaces available on the Machine .
    Listen Address : IP address or Hostname --- The server will listen only to the specified IP address or the hostname .
    Listen Address : : localhost --- The server will be listening only on localhost address and will not be accessible remotely .
    Please check what it the listen address specified at you end.
    Thanks,
    Sandeep

  • Editing etc\hosts file on windows xp for apps. problem post installation.

    Hi all,
    I was able to install 11.5.10.2 apps on my win xp prof machine. During that process I had to edit the etc/hosts file in windows directory as a work around for that domain name field during installation. Also added the primary DNS suffix as 'suneel.com' . I gave the domain name as 'suneel.com' during installation. The RapidWiz is taking localhost as the system name and referring to this system as localhost.suneel.com, though the actual system name is 'websoft-xp' .
    The host file on Apps machine has the following entries:
    127.0.0.1 localhost
    127.0.0.1 localhost.suneel.com suneel.com
    127.0.0.1 websoft-xp.suneel.com
    So when I connect to apps login server from other systems in lan, I've to edit their hosts file and add an entry for localhost.suneel.com to point to its ip address or else the apps throws an error after logging in as operations/welcome using a different url say 192.168.1.4:8000 . Is there a way to get around this issue?
    More over I'm not able connect to VIS db from other systems. The oracle clients give an error 'No listner' at this address. (The original listener was listening at localhost.suneel.com:1521). So I tried to create a new listerner from Net Manager that actually listens at websoft-xp (the real system name) but it throws me an error 'A valid log file is required' while saving the network configuration and prevents me from saving the network configuration.
    Did I do something wrong with the hosts file during installation or did i miss any entries in that file thats causing this? Any solutions for the above problems will be appreciated?
    Thanks
    Suneel
    Message was edited by:
    suneelgv

    Well I tried that option but for some reason it didn't work for me. It kept giving the tns:connection closed error. Then I searched in metalink and found this note : Note:333158.1
    It suggested setting tcp.validnode_checking = no
    in sqlnet.ora. in
    F:\oracle\visdb\9.2.0\network\admin\VIS_websoft-xp
    And it works. Hope this helps someone facing a similar problem. Good luck.
    BTW how do I run autoconfig?
    Thanks,
    Suneel Gundlapalli

  • Interconnect ip is not visible in /etc/hosts !!

    Hi, all.
    The db is 11.2.0.3 on a linux machine. (2-node RAC)
    select * from v$cluster_interconnects;
    NAME     IP_ADDRESS     IS_PUBLIC
    bond1:1     122.254.188.11     NOThe 122.254.188.11 ip address does not exists in /etc/hosts.
    Does this mean mis-configuration for interconnector?
    Thanks in advance.
    Best Regards.
    Edited by: 869578 on 2013. 2. 27 오후 9:34

    Hi Friend,
    Please check the following :
    1. IP Addresses are configured using one of the following options :
    a. Oracle Grid Naming Service (GNS) Using one static address defined during your installation.
    b. Static addresses that network administrators assign on a network domain name server (DNS) for each node (In your case two nodes)
    2. Public IP must registered in the domain name server (DNS) or the /etc/hosts file.
    Finally, the cluster must have the following  :
    1. Public IP for each node
    2. Virtual IP for each node
    3. Private IP for each node
    4. Single Client Access Name (SCAN) for the cluster
    Hope it Helps..
    Thanks
    LaserSoft

  • Nothing seems to solve my MacBook Pro problem 'Could not sign in.Please Check your network connection and try again'

    On old MacBook Pro Version 10.6.8 downloaded Facetime from the Mac Store as instructed but error loging in says 'Could not sign in.Please Check your network connection and try again'.
    I have follwed all these discussion fixes with DNS settings 8.8.8.8 and 8.8.4.4 and refreshing everything but nothing works.
    Help!
    I have also logged out of my other laptop and closed my phones Facetime.

    Hi KateD14!
    I have an article here that addresses this sign in issue with FaceTime and may have some troubleshooting steps to help you resolve this issue:
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    Resolution
    Try the following:
    Ensure that you have an active Internet connection.
    Verify that you are using a valid Apple ID at appleid.apple.com. You can also create an Apple ID or reset your password from this website. Other things you should confirm while logged into appleid.apple.com:
    Confirm that the email addresse(s) for your Apple ID has been verified.
    Check for miss-types of the email address
    Check the spelling of the email address
    Check that all letters are lower case
    Make sure that special characters are correct, e.g. no commas (,) where there is supposed to be full stops (.), etc.
    Note You may experience issues if your email address is associated with more than one Apple ID. If you have multiple Apple IDs, log in to appleid.apple.com with each Apple ID and confirm that each email address you wish to use for FaceTime or Messages is associated with only a single Apple ID.
    Make sure the date, time, and time zone are set correctly in Data & Time preferences, in System Preferences. Tip: Enable "Set date and time automatically" in Date & Time preferences to automatically keep this information accurate.
    If third-party firewall or port filtering software is installed, it needs to be configured to allow connections to apple.com, verisign.com and verisign.net. A list of ports required for using FaceTime and Messages is in Using FaceTime and iMessage behind a firewall. Please consult this article for further help configuring firewalls and Internet security software.
    If your /private/etc/hosts file has been modified, make sure that it is not interfering with communications to apple.com, verisign.com or verisign.net servers. Note: Some third-party software installers may modify the /private/etc/hosts file without alerting you. Instructions about how to check and resolve issues with a /private/etc/hosts file are in the "Blocked by configuration: (Mac OS X/Windows)" section of iTunes: Advanced iTunes Store troubleshooting
    Thanks for being a part of the Apple Support Communities!
    Regards,
    Braden

  • In my i phone 4s all the notification sounds come first.after 4-5 seconds the msg,facebook notifications etc.seems to appear on the screen.But earlier the problem was not there.Earlier with instant sound the notifications were there on the screen.how to S

    in my i phone 4s all the notification sounds come first.after 4-5 seconds the msg,facebook notifications etc.seems to appear on the screen.But earlier the problem was not there.Earlier with instant sound the notifications were there on the screen.how to Sort out the Problem?

    No, sounds like when you dropped it an cracked the screen it may have also damaged the logic board or the repair person damaged a cable.

  • When i connect my ipad2 to iTune, it show "iTunes could not check for an update to the carrier settings for your iPad. An unknown error occured (1651)". What should i do to solve this problem? My iTune version is 10.1.4.10 and my ipad is 4.3.5.

    When i connect my ipad2 to iTune, it show "iTunes could not check for an update to the carrier settings for your iPad. An unknown error occured (1651)". What should i do to solve this problem? My iTune version is 10.1.4.10 and my ipad is 4.3.5.

    If you have iOS 7.1 then you must be a developer, so you should be posting in the developer forums : https://devforums.apple.com/index.jspa

  • I want to restore my ipod 4g to ios 6.1.2 but it said error code 3194 i updated itunes and i checked my host file and it won't work Thank you for choosing the Apple Store. If you have any additional questions, please chat us again. You are currently not i

    i want to restore my ipod 4g to ios 6.1.2 but it said error code 3194 i updated itunes and i checked my host file and it won't work and i am running 6.1.5 at the moment

    That's because downgrading is not supported.

  • Blocking Ad servers via etc/host file not working

    In Snow Leopard I add a list of ad servers and direct them to 127.0.0.1 via the /ect/host file.
    I've configured the host file on my mac mini server and it doesn't work.
    i just want to block ads when using browsers ON the Mini.
    How can I achieve this?

    Yeah; that's an old-time Windows and Unix hack.
    There are ad-blocking extensions for all major web browsers, and those are easier to manage and maintain.
    Off the top, I'd have to check the search order to see if I was getting a response from remote DNS or from /etc/hosts here.
    If you're running a Mac OS X Server box, you're hopefully also running DNS services, and if you're running DNS services, then that's going to be where this hackery gets implemented. Add bogus zones. And if DNS gets an answer from its cache, I wouldn't tend to expect it to go read /etc/hosts (for performance reasons), for that matter.
    There may well be an ad-blocking DNS server around you can forward queries to, too; I haven't looked for that.
    If you make changes to your local /etc/hosts setup, try issuing the following to clear the cache:
    dnscacheutil -flushcache
    I'd recommend installing an ad-blocker. /etc/hosts is an old-school approach and can end up causing weirdnesses on errors, particularly if your box is (also) a DNS server for your LAN. (Also realize that Apple isn't documenting the /etc/hosts file in the Mac OS X Server 10.6 networking manual.)

  • Will there be an update to v29 that fixes the problem of not closing? Reset, disabling add-ons, etc, did not fix it.

    After upgrading to v 29 four days ago, Firefox will not close 9 out of 10 times...get the error message that says Firefox is still running, close it or restart. The only way I have been to fully close Firefox is to force it to close by running CCLeaner or computer restart. I have tried disabling add-ons, safe mode, etc. I do not want nor should I have to lose settings by a reset. Given the other posts re: this same problem, this appears to be a Firefox v29 problem and not a user/customer problem. This is on a Win 7 machine running AVG Free.

    I have the same problems.
    Tried version 30beta without success
    Have to unload the Firefox process with Taskmanager
    I like the new version 29 but have gone back to trouble free version 28.
    Unless the problem can be fixed I will regretfully go to Chrome.
    My system is Win 7 (64Bit) with SP1 and all updates.
    Extensions are ADBlock, Better Privacy, Disconnect, Self-Dectructing Cookies, Foxflag, Colorful Tabs, HTTPS-Everywhere

  • I keep having the same problem with my messages over and over again. My number is not checked in my message settings it just unchecks itself

    I keep having the same problem with my messages over and over again. My number is not checked in my message settings it just unchecks itself

    Dear Tomarshe
    I had the same problem a couple of weeks back.
    What I did was that I restarted that Ipad of mine and voila!
    Problem solved!
    hope this helped!
    - DASHdotDASHdot

Maybe you are looking for

  • Free Goods line item in Billing Doc.

    Hello SAP GURUS, I am working on ECC.6. I am processing the sales order and delivery for FREE GOODS every thing is fine but I not able to see the relavent free good item in the billing document.Can some one help me How to get the same. Thanks & Regar

  • Is there a way to use iMessage but not have the texts sync to my iPad or other devices, just stay on my iPhone?

    I don't like when things from my phone sync to my iPad or iPod, so I am wondering if there is a way to keep the texts on my phone and off of everything else.  I share my iPad with others and don't want to be in the middle of a conversation when all o

  • Help Please!!! AS3 Platform game

    I am creating a a platform game for one of my classes. I am not fimilar with Flash and I am having trouble with the coding. I keep getting this error message TypeError: Error #1009: Cannot access a property or method of a null object reference.     a

  • Lc config document

    Hi     wat is lc i.e., letter of credit;provide step by step configuration Thanks in advance Arpitha

  • Unable to modify skin settings after project upgrade from Cp3 to Cp5

    Folks, just got the full upgrade from Cp3 to Cp5 (not a trial version and Cp3 is wiped out and there's no going back). One of the first snags I'm finding is that when I wanted to publish, I cannot modify my skin settings. Before in Cp3 I had a saved