Coder Social home page Coder Social logo

Comments (22)

sethvargo avatar sethvargo commented on August 12, 2024

What does your hostsfile look like?

from hostsfile.

sgarbesi avatar sgarbesi commented on August 12, 2024

The hostsfile is the stock repo, unmodified.
(version 2.4.3)

Works fine on my 8 other Ubuntu boxes, only seems to be a problem on the Mac dev box.

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

@sgarbesi okay... could you please answer my question? What does it contain? I don't have access to a "stock repo, unmodified". I need a real test case

from hostsfile.

sgarbesi avatar sgarbesi commented on August 12, 2024

@sethvargo Is this what you're looking for?

hostsfile

knife cookbook site install hostsfile

test cookbook:

knife cookbook create test;

test/metadata.rb:
echo "depends 'hostsfile'" >> test/metdata.rb

test/recipes/default.rb (same code that I previously pasted in my first comment):

# Uniquely enforce our localhost record.
hostsfile_entry '127.0.0.1' do
    hostname 'x-dx-dev-01.dolox.com'
    aliases ['x-dx-dev-01', 'dev.dolox.com', 'localhost']
    comment 'Maintained by Chef'
    action :create
end

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

@sgarbesi no, I literally need to see the contents of /etc/hosts:

$ cat /etc/hosts

from hostsfile.

sgarbesi avatar sgarbesi commented on August 12, 2024

@sethvargo I can't post that here, it contains sensitive data.

There are several 127.0.0.1 entries; possibly that is the problem?

Is there anything in particular you're looking for that maybe I can see if it's relevant?

from hostsfile.

sgarbesi avatar sgarbesi commented on August 12, 2024

@sethvargo

/etc/hosts (I stripped it down to just this and still get the same error).

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       x-dx-dev-01.dolox.com x-dx-dev-01 localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

@sgarbesi then you're previous statement that it's a "stock" file is incorrect. I can't help you debug without that information. Basically you either have an entry with an invalid address or an entry without an address, thus making the line invalid.

from hostsfile.

sgarbesi avatar sgarbesi commented on August 12, 2024

@sethvargo I posted the file stripped down with the test case and it doesn't work?

In other words I changed my hosts file to contain nothing but my previous post and ran the test and received the same error. The hosts file is valid.

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

The error is happening on this line. That means one of the IP addresses in your hostsfile is not valid. It's either blank or malformed.

[1] pry(main)> require 'ipaddr'
=> true
[2] pry(main)> IPAddr.new('127.0.0.1')
=> #<IPAddr: IPv4:127.0.0.1/255.255.255.255>
[3] pry(main)> IPAddr.new('255.255.255.255')
=> #<IPAddr: IPv4:255.255.255.255/255.255.255.255>
[4] pry(main)> IPAddr.new('::1')
=> #<IPAddr: IPv6:0000:0000:0000:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>
[5] pry(main)> IPAddr.new('fe80::1%lo0')
IPAddr::InvalidAddressError: invalid address
from /Users/sethvargo/.rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/ipaddr.rb:559:in `in6_addr'

So Ruby thinks fe80::1%lo0 isn't a valid IPv6 address. There's not much I can do here - IPAddr is a core Ruby class. So if it's blowing up, that address either isn't valid or the Ruby core has a bug.

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

Actually, there's a test in MRI explicitly testing that an address of that format DOES raise an error: https://github.com/ruby/ruby/blob/trunk/lib/ipaddr.rb#L738

from hostsfile.

sgarbesi avatar sgarbesi commented on August 12, 2024

@sethvargo Okay.

This is the stock /etc/hosts file that Apple ships with OS X Mavericks.

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

Right. And, according to Ruby, fe80::1%lo0 is not a valid IPv6 address.

from hostsfile.

sgarbesi avatar sgarbesi commented on August 12, 2024

@sethvargo Alright then; not sure if it's worth posting in the wiki/readme or not.

Removing fe80::1%lo0 localhost allows it to run without error.

Thanks for the help! Appreciate it.

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

@sgarbesi well I need to figure out what to do. This might actually be a bug in OSX Mavericks (since all indications say that is NOT a valid IPv6 address).

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

Sigh. See also: http://johncblandii.com/2011/07/osx-lion-gotcha-etchosts-file.html

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

Blarg. https://bugs.ruby-lang.org/issues/8464

from hostsfile.

sgarbesi avatar sgarbesi commented on August 12, 2024

@sethvargo Ouch :/

Personal opinion: I would post it in the README/Wiki and call it a day.

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

7629e0b

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

v2.4.4

from hostsfile.

sgarbesi avatar sgarbesi commented on August 12, 2024

Tested and works fine on v2.4.4.

Thanks again @sethvargo !

from hostsfile.

sethvargo avatar sethvargo commented on August 12, 2024

Yup

from hostsfile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.