Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consul on Windows 7 Cannot Create an Agent After Installation #2843

Closed
adrwalker opened this issue Mar 29, 2017 · 10 comments
Closed

Consul on Windows 7 Cannot Create an Agent After Installation #2843

adrwalker opened this issue Mar 29, 2017 · 10 comments

Comments

@adrwalker
Copy link

adrwalker commented Mar 29, 2017

consul version for both Client and Server

Client: Consul v0.7.5
Server: N/A

consul info for both Client and Server

Client:

agent:                      
        check_monitors = 0  
        check_ttls = 0      
        checks = 0          
        services = 0        
build:                      
        prerelease =        
        revision = '21f2d5a 
        version = 0.7.5     
consul:                     
        known_servers = 0   
        server = false      
runtime:                    
        arch = amd64        
        cpu_count = 8       
        goroutines = 30     
        max_procs = 8       
        os = windows        
        version = go1.7.5   
serf_lan:                   
        encrypted = false   
        event_queue = 0     
        event_time = 1      
        failed = 0          
        health_score = 0    
        intent_queue = 0    
        left = 0            
        member_time = 1     
        members = 1         
        query_queue = 0     
        query_time = 1      

Server:

N/A

Operating system and Environment details

OS Version: (Windows 7) 6.1.7601 Service Pack 1 Build 7601

Description of the Issue (and unexpected/desired result)

The UI gives a 500 error when starting up. I tried to use consul agent -dev but this gives the error: ==> Error starting agent: Failed to start Consul server: Failed to start lan serf: Failed to create memberlist: Failed to start TCP listener. Err: listen tcp 127.0.0.1:8301: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

Adding a server myself gives this error:

==> Error starting agent: Failed to start Consul server: Failed to start lan serf: Failed to create memberlist: Failed to start TCP listener. Err: listen tcp 0.0.0.0:8301: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

Note that this error is usually caused by something occupying that port. I've confirmed that only the Consul instance is on 8301. In the Resource Monitor, there are TCP and UDT ports with IPv4 and IPv6 addresses for each. These ports are all open and not restricted at all by the firewall.

Reproduction steps

  1. Install Consul on a Windows 7 machine via Chocolatey
  2. After installation, bring up the UI, or type consul agent -dev in the command prompt.

Log Fragments or Link to gist

These two messages are logged repeatedly after Consul installation is completed and the client agent is up and running.

2017/03/29 10:26:10 [WARN] manager: No servers available
2017/03/29 10:26:10 [ERR] agent: failed to sync remote state: No known Consul servers

@adrwalker
Copy link
Author

adrwalker commented Mar 29, 2017

Issue is with Chocolatey, not Consul. I'll bring the issue up with the package managers.

@dlarr
Copy link

dlarr commented Apr 5, 2018

Any solution on this ?

@mkeeler
Copy link
Member

mkeeler commented Apr 5, 2018

@dlarr Are you also using chocolatey to install consul? Have you tried just downloading it from here: https://www.consul.io/downloads.html.

@dlarr
Copy link

dlarr commented Apr 6, 2018

Hello, thanks for answering back here.

Actually, yes I am using chocolatey and yes, I did try this direct download. But I reported my issue here : sous-chefs/consul#236 (although the place was not the good one)

The consul.exe for windows never succeded to launch :( that's the reason why I went for chocolatey. I have a very quick window showing up and closing right away, but nothing more happens.

@mkeeler
Copy link
Member

mkeeler commented Apr 6, 2018

@dlarr I believe whats happening for you is that you are launching consul.exe via the GUI. The window that opens temporarily is a shell output window that if it stayed around long enough would be showing you the consul command line usage. You will need to run with some arguments in another shell.

First open either powershell or cmd.exe and then try running

consul.exe agent -dev

@dlarr
Copy link

dlarr commented Apr 11, 2018

Ok, I will try it when my client has budget for this matter (he doesn't want me to spend more time on the subject) I'll keep you posted. Thanks again for info ;)

@gudiseva
Copy link

gudiseva commented May 9, 2018

Matt Keeler,
I tried in Powershell and get the same error:

PS D:\WORKSPACE\consul-course> consul.exe agent -dev
==> Starting Consul agent...
==> Error starting agent: Failed to start Consul server: Failed to start LAN Serf: Failed to create memberlist: Could not set up network transport: failed to obtain an address: Failed to start TCP listener on "127.0.0.1" port 8301: listen tcp 127.0.0.1:8301: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
PS D:\WORKSPACE\consul-course>

@Javo-rj
Copy link

Javo-rj commented May 18, 2018

@gudiseva your excecute powershell as Adminsitrator?

@mkeeler
Copy link
Member

mkeeler commented May 21, 2018

@gudiseva Given that error message I could see a few potential problems. First you should try what @Javo-rj suggested. If that works then the problem is that the firewall or security policy for your system is not allowing your user to bind to that port. The next potential problem is that the port is already in use. Verify that there are no other processes bound to the port somehow by running netstat -a and looking for a connection on port 8301 in the LISTENING state. If neither of those are the problem then my next thought would be to ask if you are running any sort of AV or security software that injects itself into the windows networking stack. Many such pieces of software intercept requests to bind to ports or open connections and allow/disallow based on some external policy. I don't know your exact setup but I would think one of those 3 scenarios likely would cover it.

@kgonia
Copy link

kgonia commented Jul 12, 2021

Maybe it will help someone in future:
consul returns this error when port it's already taken, solution may be to kill process that occupied port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants