Foreman: Connection refused - connect(2)

Hi,

I am trying to install Foreman on the Puppetmaster server. I followed the
auto installer and it ran without errors. However, I cannot access the
website nor can I execute anything else Foreman related.

These are the errors I receive:

[root@puppet-master puppet]# sudo -u puppet /etc/puppet/node.rb
> puppet-master.domain.local
> Could not send facts to Foreman: Connection refused - connect(2)
>

and

Warning: Unable to fetch my node definition, but the agent run will
> continue:
> Warning: Error 400 on SERVER: Failed to find puppet-master.domain.local
> via exec: Execution of '/etc/puppet/node.rb puppet-master.domain.local'
> returned 1:
> Info: Retrieving plugin
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
> Failed when searching for node puppet-master.domain.local: Failed to find
> puppet-master.domain.local via exec: Execution of '/etc/puppet/node.rb
> puppet-master.domain.local' returned 1:
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run
>

I already tried changing the permissions on /etc/puppet/node.rb with chmod
777 but that did not help.

I am new to Puppet and Foreman, so please help me get Foreman working on my
puppetmaster server.

Kind regards,

Bram

Connection refused indicates a network connectivity issue, not
permissions. If you can't access the website, this would agree.

Is httpd running? Is it listening on ports 80 and 443?

Do you have a firewall, iptables or otherwise? Try disabling it.

··· On 14/10/13 14:02, Bram Buermans wrote: > Hi, > > I am trying to install Foreman on the Puppetmaster server. I followed > the auto installer and it ran without errors. However, I cannot access > the website nor can I execute anything else Foreman related. > > These are the errors I receive: > > > [root@puppet-master puppet]# sudo -u puppet /etc/puppet/node.rb > puppet-master.domain.local > Could not send facts to Foreman: Connection refused - connect(2)


Dominic Cleal
Red Hat Engineering

At least with version 1.2 of foreman, I also found that it was important to
have a fully qualified domain name for your foreman host machine.
So, "xxxx.localdomain" for example and not just hostname "xxxx".
On CentOS 6.4, I ensured that I had a fully qualified domain name in both
/etc/sysconfig/network and an entry in the /etc/hosts table (no DNS for me).

With just a short hostname, the installation completed without errors, but
I could never add the smart proxy.

··· On Monday, October 14, 2013 9:02:24 AM UTC-4, Bram Buermans wrote: > > Hi, > > I am trying to install Foreman on the Puppetmaster server. I followed the > auto installer and it ran without errors. However, I cannot access the > website nor can I execute anything else Foreman related. > > These are the errors I receive: > > > [root@puppet-master puppet]# sudo -u puppet /etc/puppet/node.rb >> puppet-master.domain.local >> Could not send facts to Foreman: Connection refused - connect(2) >> > > and > > Warning: Unable to fetch my node definition, but the agent run will >> continue: >> Warning: Error 400 on SERVER: Failed to find puppet-master.domain.local >> via exec: Execution of '/etc/puppet/node.rb puppet-master.domain.local' >> returned 1: >> Info: Retrieving plugin >> Error: Could not retrieve catalog from remote server: Error 400 on >> SERVER: Failed when searching for node puppet-master.domain.local: Failed >> to find puppet-master.domain.local via exec: Execution of >> '/etc/puppet/node.rb puppet-master.domain.local' returned 1: >> Warning: Not using cache on failed catalog >> Error: Could not retrieve catalog; skipping run >> > > I already tried changing the permissions on /etc/puppet/node.rb with chmod > 777 but that did not help. > > I am new to Puppet and Foreman, so please help me get Foreman working on > my puppetmaster server. > > Kind regards, > > Bram > > >

Opening the 443 port seems to be the solution for this.

Anyway, I changed the puppet.conf file back, turned off the puppetmaster
service and restarted the httpd service succesfully. It should now run back
on apache again and seems to be working fine aswell.

I will ignore the puppet master errors as they are not able to execute
anymore because the service is down.

Thank you for your help!

Hopefully it will keep running in this state.

··· On Monday, October 14, 2013 3:02:24 PM UTC+2, Bram Buermans wrote: > > Hi, > > I am trying to install Foreman on the Puppetmaster server. I followed the > auto installer and it ran without errors. However, I cannot access the > website nor can I execute anything else Foreman related. > > These are the errors I receive: > > > [root@puppet-master puppet]# sudo -u puppet /etc/puppet/node.rb >> puppet-master.domain.local >> Could not send facts to Foreman: Connection refused - connect(2) >> > > and > > Warning: Unable to fetch my node definition, but the agent run will >> continue: >> Warning: Error 400 on SERVER: Failed to find puppet-master.domain.local >> via exec: Execution of '/etc/puppet/node.rb puppet-master.domain.local' >> returned 1: >> Info: Retrieving plugin >> Error: Could not retrieve catalog from remote server: Error 400 on >> SERVER: Failed when searching for node puppet-master.domain.local: Failed >> to find puppet-master.domain.local via exec: Execution of >> '/etc/puppet/node.rb puppet-master.domain.local' returned 1: >> Warning: Not using cache on failed catalog >> Error: Could not retrieve catalog; skipping run >> > > I already tried changing the permissions on /etc/puppet/node.rb with chmod > 777 but that did not help. > > I am new to Puppet and Foreman, so please help me get Foreman working on > my puppetmaster server. > > Kind regards, > > Bram > > >

The Foreman is running now and I can access the web server but I cannot let
the agents connect to the puppetmaster now because the puppetmaster service
is dead.

It shows:

puppet dead but pid file exists

When I execute puppet master --no-daemonize --verbose, it tells me:

Error: Could not run: Address already in use - bind(2)

This probably means that both Foreman and Puppet are running on the same
port and therefor crashing. I cannot restart the puppetmaster service and
deleting the master.pid file doesn't result in a good startup of the
service either.

What should I do?

··· On Tuesday, 15 October 2013 21:36:49 UTC+2, Arnold Itterate wrote: > > > At least with version 1.2 of foreman, I also found that it was important > to have a fully qualified domain name for your foreman host machine. > So, "xxxx.localdomain" for example and not just hostname "xxxx". > On CentOS 6.4, I ensured that I had a fully qualified domain name in both > /etc/sysconfig/network and an entry in the /etc/hosts table (no DNS for me). > > With just a short hostname, the installation completed without errors, but > I could never add the smart proxy. > > > > On Monday, October 14, 2013 9:02:24 AM UTC-4, Bram Buermans wrote: >> >> Hi, >> >> I am trying to install Foreman on the Puppetmaster server. I followed the >> auto installer and it ran without errors. However, I cannot access the >> website nor can I execute anything else Foreman related. >> >> These are the errors I receive: >> >> >> [root@puppet-master puppet]# sudo -u puppet /etc/puppet/node.rb >>> puppet-master.domain.local >>> Could not send facts to Foreman: Connection refused - connect(2) >>> >> >> and >> >> Warning: Unable to fetch my node definition, but the agent run will >>> continue: >>> Warning: Error 400 on SERVER: Failed to find puppet-master.domain.local >>> via exec: Execution of '/etc/puppet/node.rb puppet-master.domain.local' >>> returned 1: >>> Info: Retrieving plugin >>> Error: Could not retrieve catalog from remote server: Error 400 on >>> SERVER: Failed when searching for node puppet-master.domain.local: Failed >>> to find puppet-master.domain.local via exec: Execution of >>> '/etc/puppet/node.rb puppet-master.domain.local' returned 1: >>> Warning: Not using cache on failed catalog >>> Error: Could not retrieve catalog; skipping run >>> >> >> I already tried changing the permissions on /etc/puppet/node.rb with >> chmod 777 but that did not help. >> >> I am new to Puppet and Foreman, so please help me get Foreman working on >> my puppetmaster server. >> >> Kind regards, >> >> Bram >> >> >> >

The Foreman installer sets up a puppet master for you using Apache HTTP,
so running "puppet master" yourself to debug fails as the port's already
in use.

You can move /etc/{httpd,apache2}/conf.d/puppet.conf out of the way and
restart httpd to disable running it under Apache temporarily.

Regarding your original error, try running this and observe the output:

sudo -u puppet /etc/puppet/node.rb puppet-master.domain.local

Also check /var/log/foreman/production.log for any errors.

··· -- Dominic Cleal Red Hat Engineering

On 16/10/13 09:03, Bram Buermans wrote:

The Foreman is running now and I can access the web server but I cannot
let the agents connect to the puppetmaster now because the puppetmaster
service is dead.

It shows:

puppet dead but pid file exists

When I execute puppet master --no-daemonize --verbose, it tells me:

Error: Could not run: Address already in use - bind(2)

This probably means that both Foreman and Puppet are running on the same
port and therefor crashing. I cannot restart the puppetmaster service
and deleting the master.pid file doesn’t result in a good startup of the
service either.

What should I do?

On Tuesday, 15 October 2013 21:36:49 UTC+2, Arnold Itterate wrote:

At least with version 1.2 of foreman, I also found that it was
important to have a fully qualified domain name for your foreman
host machine.
So, "xxxx.localdomain" for example and not just hostname "xxxx".
On CentOS 6.4, I ensured that I had a fully qualified domain name in
both /etc/sysconfig/network and an entry in the /etc/hosts table (no
DNS for me).

With just a short hostname, the installation completed without
errors, but I could never add the smart proxy.



On Monday, October 14, 2013 9:02:24 AM UTC-4, Bram Buermans wrote:

    Hi,

    I am trying to install Foreman on the Puppetmaster server. I
    followed the auto installer and it ran without errors. However,
    I cannot access the website nor can I execute anything else
    Foreman related.

    These are the errors I receive:


        [root@puppet-master puppet]# sudo -u puppet
        /etc/puppet/node.rb puppet-master.domain.local
        Could not send facts to Foreman: Connection refused - connect(2)


    and

         Warning: Unable to fetch my node definition, but the agent
        run will continue:
        Warning: Error 400 on SERVER: Failed to find
        puppet-master.domain.local via exec: Execution of
        '/etc/puppet/node.rb puppet-master.domain.local' returned 1:
        Info: Retrieving plugin
        Error: Could not retrieve catalog from remote server: Error
        400 on SERVER: Failed when searching for node
        puppet-master.domain.local: Failed to find
        puppet-master.domain.local via exec: Execution of
        '/etc/puppet/node.rb puppet-master.domain.local' returned 1:
        Warning: Not using cache on failed catalog
        Error: Could not retrieve catalog; skipping run


    I already tried changing the permissions on /etc/puppet/node.rb
    with chmod 777 but that did not help.

    I am new to Puppet and Foreman, so please help me get Foreman
    working on my puppetmaster server.

    Kind regards,

    Bram


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

Oke that seemed to have worked.

I executed the following commands with the following results:

[root@puppet-master conf.d]# service httpd restart
> Stopping httpd: [ OK ]
> Starting httpd: [Wed Oct 16 10:27:42 2013] [warn] default VirtualHost
> overlap on port 443, the first has precedence
> [ OK ]
> [root@puppet-master conf.d]# service puppetmaster start
> Starting puppetmaster: [ OK ]
> [root@puppet-master conf.d]# service puppetmaster status
> puppet (pid 7446) is running…
>

The puppetmaster service is running now and I can still access the Foreman
web server, however I can only access it when the iptables service is
turned off. Which ports should I open in order for that to work as having
the iptables turned off in the production environment is no option.

Also, If I keep it like this, with the service puppetmaster running, is
that good? Is there a reason for moving the puppet.conf file back to
/etc/httpd/conf.d/ as the /etc/puppet/puppet.conf contains the same file.

The puppet master --no-daemonize --verbose command now shows that it cannot
create a PID file in /var/run/puppet/master.pid, should I ignore this as
both services are already running and seem to be working?

··· On Wednesday, 16 October 2013 10:08:55 UTC+2, Dominic Cleal wrote: > > The Foreman installer sets up a puppet master for you using Apache HTTP, > so running "puppet master" yourself to debug fails as the port's already > in use. > > You can move /etc/{httpd,apache2}/conf.d/puppet.conf out of the way and > restart httpd to disable running it under Apache temporarily. > > Regarding your original error, try running this and observe the output: > > sudo -u puppet /etc/puppet/node.rb puppet-master.domain.local > > Also check /var/log/foreman/production.log for any errors. > > -- > Dominic Cleal > Red Hat Engineering > > On 16/10/13 09:03, Bram Buermans wrote: > > The Foreman is running now and I can access the web server but I cannot > > let the agents connect to the puppetmaster now because the puppetmaster > > service is dead. > > > > It shows: > > > > puppet dead but pid file exists > > > > When I execute puppet master --no-daemonize --verbose, it tells me: > > > > Error: Could not run: Address already in use - bind(2) > > > > This probably means that both Foreman and Puppet are running on the same > > port and therefor crashing. I cannot restart the puppetmaster service > > and deleting the master.pid file doesn't result in a good startup of the > > service either. > > > > What should I do? > > > > > > > > On Tuesday, 15 October 2013 21:36:49 UTC+2, Arnold Itterate wrote: > > > > > > At least with version 1.2 of foreman, I also found that it was > > important to have a fully qualified domain name for your foreman > > host machine. > > So, "xxxx.localdomain" for example and not just hostname "xxxx". > > On CentOS 6.4, I ensured that I had a fully qualified domain name in > > both /etc/sysconfig/network and an entry in the /etc/hosts table (no > > DNS for me). > > > > With just a short hostname, the installation completed without > > errors, but I could never add the smart proxy. > > > > > > > > On Monday, October 14, 2013 9:02:24 AM UTC-4, Bram Buermans wrote: > > > > Hi, > > > > I am trying to install Foreman on the Puppetmaster server. I > > followed the auto installer and it ran without errors. However, > > I cannot access the website nor can I execute anything else > > Foreman related. > > > > These are the errors I receive: > > > > > > [root@puppet-master puppet]# sudo -u puppet > > /etc/puppet/node.rb puppet-master.domain.local > > Could not send facts to Foreman: Connection refused - > connect(2) > > > > > > and > > > > Warning: Unable to fetch my node definition, but the agent > > run will continue: > > Warning: Error 400 on SERVER: Failed to find > > puppet-master.domain.local via exec: Execution of > > '/etc/puppet/node.rb puppet-master.domain.local' returned 1: > > Info: Retrieving plugin > > Error: Could not retrieve catalog from remote server: Error > > 400 on SERVER: Failed when searching for node > > puppet-master.domain.local: Failed to find > > puppet-master.domain.local via exec: Execution of > > '/etc/puppet/node.rb puppet-master.domain.local' returned 1: > > Warning: Not using cache on failed catalog > > Error: Could not retrieve catalog; skipping run > > > > > > I already tried changing the permissions on /etc/puppet/node.rb > > with chmod 777 but that did not help. > > > > I am new to Puppet and Foreman, so please help me get Foreman > > working on my puppetmaster server. > > > > Kind regards, > > > > Bram > > > > > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Foreman users" group. > > To unsubscribe from this group and stop receiving emails from it, send > > an email to foreman-user...@googlegroups.com . > > To post to this group, send email to forema...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/groups/opt_out. > >

> Oke that seemed to have worked.
>
> I executed the following commands with the following results:
>
> [root@puppet-master conf.d]# service httpd restart
> Stopping httpd: [ OK ]
> Starting httpd: [Wed Oct 16 10:27:42 2013] [warn] default
> VirtualHost overlap on port 443, the first has precedence
> [ OK ]
> [root@puppet-master conf.d]# service puppetmaster start
> Starting puppetmaster: [ OK ]
> [root@puppet-master conf.d]# service puppetmaster status
> puppet (pid 7446) is running…
>
>
> The puppetmaster service is running now and I can still access the
> Foreman web server, however I can only access it when the iptables
> service is turned off. Which ports should I open in order for that to
> work as having the iptables turned off in the production environment is
> no option.

80, 443 and 8140 TCP inbound.

> Also, If I keep it like this, with the service puppetmaster running, is
> that good? Is there a reason for moving the puppet.conf file back to
> /etc/httpd/conf.d/ as the /etc/puppet/puppet.conf contains the same file.

Best to use Apache (and Passenger) as it's more scalable. I assumed you
were trying to debug using a standalone command, but otherwise I'd leave
it in the original configuration.

> The puppet master --no-daemonize --verbose command now shows that it
> cannot create a PID file in /var/run/puppet/master.pid, should I ignore
> this as both services are already running and seem to be working?

I'm not sure…

··· On 16/10/13 09:38, Bram Buermans wrote:


Dominic Cleal
Red Hat Engineering

On Wednesday, 16 October 2013 10:08:55 UTC+2, Dominic Cleal wrote:

The Foreman installer sets up a puppet master for you using Apache
HTTP,
so running "puppet master" yourself to debug fails as the port's
already
in use.

You can move /etc/{httpd,apache2}/conf.d/puppet.conf out of the way and
restart httpd to disable running it under Apache temporarily.

Regarding your original error, try running this and observe the output:

sudo -u puppet /etc/puppet/node.rb puppet-master.domain.local

Also check /var/log/foreman/production.log for any errors.

-- 
Dominic Cleal
Red Hat Engineering

On 16/10/13 09:03, Bram Buermans wrote:
> The Foreman is running now and I can access the web server but I
cannot
> let the agents connect to the puppetmaster now because the
puppetmaster
> service is dead.
>
> It shows:
>
> puppet dead but pid file exists
>
> When I execute puppet master --no-daemonize --verbose, it tells me:
>
> Error: Could not run: Address already in use - bind(2)
>
> This probably means that both Foreman and Puppet are running on
the same
> port and therefor crashing. I cannot restart the puppetmaster service
> and deleting the master.pid file doesn't result in a good startup
of the
> service either.
>
> What should I do?
>
>
>
> On Tuesday, 15 October 2013 21:36:49 UTC+2, Arnold Itterate wrote:
>
>
>     At least with version 1.2 of foreman, I also found that it was
>     important to have a fully qualified domain name for your foreman
>     host machine.
>     So, "xxxx.localdomain" for example and not just hostname "xxxx".
>     On CentOS 6.4, I ensured that I had a fully qualified domain
name in
>     both /etc/sysconfig/network and an entry in the /etc/hosts
table (no
>     DNS for me).
>
>     With just a short hostname, the installation completed without
>     errors, but I could never add the smart proxy.
>
>
>
>     On Monday, October 14, 2013 9:02:24 AM UTC-4, Bram Buermans >     wrote:
>
>         Hi,
>
>         I am trying to install Foreman on the Puppetmaster server. I
>         followed the auto installer and it ran without errors.
However,
>         I cannot access the website nor can I execute anything else
>         Foreman related.
>
>         These are the errors I receive:
>
>
>             [root@puppet-master puppet]# sudo -u puppet
>             /etc/puppet/node.rb puppet-master.domain.local
>             Could not send facts to Foreman: Connection refused -
connect(2)
>
>
>         and
>
>              Warning: Unable to fetch my node definition, but the
agent
>             run will continue:
>             Warning: Error 400 on SERVER: Failed to find
>             puppet-master.domain.local via exec: Execution of
>             '/etc/puppet/node.rb puppet-master.domain.local'
returned 1:
>             Info: Retrieving plugin
>             Error: Could not retrieve catalog from remote server:
Error
>             400 on SERVER: Failed when searching for node
>             puppet-master.domain.local: Failed to find
>             puppet-master.domain.local via exec: Execution of
>             '/etc/puppet/node.rb puppet-master.domain.local'
returned 1:
>             Warning: Not using cache on failed catalog
>             Error: Could not retrieve catalog; skipping run
>
>
>         I already tried changing the permissions on
/etc/puppet/node.rb
>         with chmod 777 but that did not help.
>
>         I am new to Puppet and Foreman, so please help me get Foreman
>         working on my puppetmaster server.
>
>         Kind regards,
>
>         Bram
>
>          
>
> --
> You received this message because you are subscribed to the Google
> Groups "Foreman users" group.
> To unsubscribe from this group and stop receiving emails from it,
send
> an email to foreman-user...@googlegroups.com <javascript:>.
> To post to this group, send email to forema...@googlegroups.com
<javascript:>.
> Visit this group at http://groups.google.com/group/foreman-users
<http://groups.google.com/group/foreman-users>.
> For more options, visit https://groups.google.com/groups/opt_out
<https://groups.google.com/groups/opt_out>.


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

Oke I opened the port 443 which seems to be the problem as 8140 was already
open. I turned the puppetmaster service off and moved the puppet.conf file
back to the init.d directory and restarted the httpd service. It now seems
to be working again and I am able to use the puppet agent command on the
clients and they report back to the server successfully.

I am not sure what changed though, as having the puppet.conf file moved
away seemed to work aswell and both the web server and puppetmaster service
seemed to work aswell.

I will ignore the puppet master errors as it isn't working now since it
runs over on httpd.

Thanks for the help. Hopefully it will stay working like this :slight_smile: