Code Monkey home page Code Monkey logo

Comments (8)

jvanbaarsen avatar jvanbaarsen commented on July 16, 2024

@brauliobo Did you by any change found a work around for this?

👍 For a fix for this

from ohai.

brauliobo avatar brauliobo commented on July 16, 2024

@jvanbaarsen Yeah, disable it! Ohai::Config[:disabled_plugins] = [:GCE] on solo.rb or client.rb

from ohai.

lamont-granquist avatar lamont-granquist commented on July 16, 2024

Does this still replicate on ohai-8.0.x and chef-12?

Also, we don't support non-omnibus installs of chef that I can see that you're doing in /usr/lib/ruby and we're dropping support for 1.9.x in Chef-12.1.0 (the gem will no longer install on that ruby).

from ohai.

jvanbaarsen avatar jvanbaarsen commented on July 16, 2024

@lamont-granquist I finally installed a vagrant box with chef succesfully yesterday, but im not sure if its because I switched to VMWare provider or an update in chef / ohai. I'll look at that later this week.

from ohai.

alexdo avatar alexdo commented on July 16, 2024

Same problem here. Some of my nodes have a NATed network, all of them are encountering this error.
It seems to come down to the GCE Metatdata Mixin which successfully establishes a socket to a non-resolvable GCE Metadata Endpoint. (as the aforementioned nodes are not hosted at GCE)

I was also able to reproduce this issue via chef's embedded irb:

$ /opt/chef/embedded/bin/irb
irb(main):005:0> require 'ohai/mixin/gce_metadata'
=> true
irb(main):007:0> Ohai::Mixin::GCEMetadata::GCE_METADATA_ADDR
=> "metadata.google.internal"
irb(main):008:0> include Ohai::Mixin::GCEMetadata
=> Object
irb(main):010:0> can_metadata_connect?(Ohai::Mixin::GCEMetadata::GCE_METADATA_ADDR,80)
=> true
irb(main):011:0> require 'socket'
=> false
irb(main):012:0> t = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0)
=> #<Socket:fd 7>
irb(main):013:0> saddr = Socket.pack_sockaddr_in(80, Ohai::Mixin::GCEMetadata::GCE_METADATA_ADDR)
=> "\x02\x00\x00P\x90L+\x1C\x00\x00\x00\x00\x00\x00\x00\x00"
irb(main):015:0> t.connect_nonblock(saddr)
Errno::EINPROGRESS: Operation now in progress - connect(2) would block
    from (irb):15:in `connect_nonblock'
    from (irb):15
    from /opt/chef/embedded/bin/irb:12:in `<main>'

Supplying an invalid port returns the result which is expected by the GCE Mixin (-> failing):

irb(main):016:0> saddr = Socket.pack_sockaddr_in(-400, Ohai::Mixin::GCEMetadata::GCE_METADATA_ADDR)
SocketError: getaddrinfo: Servname not supported for ai_socktype
    from (irb):16:in `pack_sockaddr_in'
    from (irb):16
    from /opt/chef/embedded/bin/irb:12:in `<main>'
irb(main):017:0> t.connect_nonblock(saddr)
=> 0

However, I'm quite sure this has something to do with my NATed setup, as a connection on TCP 80 to any URL via Ruby socket succeeds:

irb(main):018:0> t = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0)
=> #<Socket:fd 8>
irb(main):019:0> saddr = Socket.pack_sockaddr_in(80, 'some-crazy-invalid-domain-name')
=> "\x02\x00\x00P\x90L+\x1C\x00\x00\x00\x00\x00\x00\x00\x00"
irb(main):021:0> t.connect_nonblock(saddr)
Errno::EINPROGRESS: Operation now in progress - connect(2) would block
    from (irb):21:in `connect_nonblock'
    from (irb):21
    from /opt/chef/embedded/bin/irb:12:in `<main>'
irb(main):022:0> 

EDIT
After some further investigation, I discovered that my ISPs DNS redirects unknown domain names to some generic page. As a result, the socket to metadata.google.internal is established (obviously to the wrong target), but the metadata API endpoint won't yield any results.

$ nslookup metadata.google.internal
Server:     192.168.173.1
Address:    192.168.173.1#53

Non-authoritative answer:
Name:   metadata.google.internal
Address: my.providers.generic.page

$ curl metadata.google.internal
=> generic page html

from ohai.

bgehman avatar bgehman commented on July 16, 2024

We hit the same problem, and it is easy to reproduce once you understand the root-cause. It all boils down to if your VM is in the "smoketest.com" domain, then the GCE plugin is able to resolve the metadata.google.internal hostname, as in:

nslookup metadata.google.internal.smoketest.com

Server: 10.0.80.11
Address: 10.0.80.11#53

Non-authoritative answer:
Name: metadata.google.internal.smoketest.com
Address: 69.172.201.208

This tricks the Ohai/GCE plugin into thinking that the VM is running in the GCE cloud, and hangs chef-server / chef-client startup (since 69.172.201.208 is not a real GCE metadata server).

from ohai.

thommay avatar thommay commented on July 16, 2024

#736 should make this better

from ohai.

tas50 avatar tas50 commented on July 16, 2024

This is resolved with #736 via a short timeout period.

from ohai.

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.