I setup this.
http://www.zell-weekeat.com/grunt-sass-with-susy/
It works fine for one run then, if I exit out of the sass watch I can't free up the port.
Fatal error: Port 35729 is already in use by another process.
Then
sudo lsof -i :35729
gives
\COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
grunt 26305 author 12u IPv6 7064373 0t0 TCP *:35729 (LISTEN)
How do I get this port to free up
Just for organization sake, as mentioned in comments:
You should stop a process with Ctrl+C in the terminal.
Ctrl+Z will keep it running.
If you need to kill it, find the PID with sudo lsof -i :35729 and then kill -9 PID.
Just sudo netstat -tulpn | grep -i : <port>. kill it with kill -9 PID
Related
I can join the port sucessfully by
ssh -N -L 8888:127.0.0.1:8888 server_ip
But if I just join the server, and then use jupyter notebook, I can't open the port sucessfully.
ssh server_ip
jupyter notebook --port=8888
Error:
The port 8888 is already in use, trying another port.
What is the reason and how to solve it?
You can check which application is currently running on port 8888 by following commands on Linux machine. If in case it happens to be an existing jupyter, you may try killing that process and start a new one.
Check current process running in 8888
lsof -i:8888
To kill the current process.
kill $(lsof -t -i:8888)
To forcefully kill the current process
kill -9 $(lsof -t -i:8888)
If for some reason you wish not to kill the current process, you may try launching jupyter on a different port.
jupyter notebook --port=8889
Sounds like you have some other process on port 8888.
You can either:
1) Kill the process on port 8888 and then launch jupyter-notebook on port 8888
2) Launch jupyter notebook on a different port and then use ssh to connect to the new port
I am using Hadoop hadoop-2.6.0, while starting hadoop services unable to start secondarynamenode, datanode, nodemanager services.
Getting Java.net.bind exceptions.
NodeManager:
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: java.net.BindException: Problem binding to [0.0.0.0:8040] java.net.BindException: Address already in use; For more details see: http://wiki.apache.org/hadoop/BindException
at org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl.getServer(RpcServerFactoryPBImpl.java:139)
at org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC.getServer(HadoopYarnProtoRPC.java:65)
at org.apache.hadoop.yarn.ipc.YarnRPC.getServer(YarnRPC.java:54)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService.createServer(ResourceLocalizationService.java:356)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService.serviceStar
NameNode:
2017-10-10 23:58:07,872 INFO org.apache.hadoop.http.HttpServer2: HttpServer.start() threw a non Bind IOException
java.net.BindException: Port in use: 0.0.0.0:50090
at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:891)
at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:827)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.initialize(SecondaryNameNode.java:276)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.<init>(SecondaryNameNode.java:192)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.main(SecondaryNameNode.java:671)
DataNode:
java.net.BindException: Problem binding to [0.0.0.0:50010] java.net.BindException: Address already in use; For more details see: http://wiki.apache.org/hadoop/BindException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
On trying netstat -ntpl command the below ports are in already in use
tcp 0 0 0.0.0.0:50010 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:50090 0.0.0.0:* LISTEN -
tcp6 0 0 :::8040 :::* LISTEN -
Please someone suggest me how to kill these ports to resolve this issue.
:~/hadoopinstall/hadoop-2.6.0$ jps
18255 org.eclipse.equinox.launcher_1.3.0.dist.jar
27492 RunJar
12387 Jps
11951 ResourceManager
11469 NameNode
the netstat command that you have provided also shows the PID of the process which is listening on that port.
For example
[root#dn1 ~]# netstat -ntpl | grep 50010
tcp 0 0 0.0.0.0:50010 0.0.0.0:* LISTEN 1093/java
In the above example, 1093 is the PID of the java process which binds the 50010 port.
You can easily check what process is running and if you have the correct permissions, you can kill the process too using the command.
kill -9 1093
After frequent searches/tries i have found the solution to kill the process(port) without pid.
*******#127:~$ sudo fuser -k 50010/tcp
[sudo] password for muralee1857:
50010/tcp: 1514
*******#127:~$ sudo kill -9 $(lsof -t -i:50010)
*******#127:~$ sudo fuser -k 50010/tcp
*******#127:~$ sudo kill -9 $(lsof -t -i:50090)
*******#127:~$ sudo fuser -k 50090/tcp
50090/tcp: 2110
*******#127:~$ sudo kill -9 $(lsof -t -i:50090)
*******#127:~$ sudo fuser -k 50090/tcp
*******#127:~$ sudo fuser -k 8040/tcp
8040/tcp: 2304
*******#127:~$ sudo kill -9 $(lsof -t -i:8040)
*******#127:~$ sudo fuser -k 8040/tcp
Now i am able start all hadoop services.
/hadoopinstall/hadoop-2.6.0$ jps
6844 NodeManager
7150 Jps
6547 SecondaryNameNode
6202 NameNode
6702 ResourceManager
6358 DataNode
I am doing this basic tutorial: http://www.asp.net/get-started
It suggests doing some changes, then running dotnet run again. However, Ctrl+C isn't working and the Package Manager Console seems frozen. When I exit VS and/or restart it, I do my changes and dotnet run again.
When I am doing this, I am getting an error (not the same every time), because the server is already running. The question is simple as 1-2-3:
How do I manually stop the kestrel server? (I am running Windows 10).
On OSX Terminal:
sudo lsof -iTCP -sTCP:LISTEN -P | grep :5000
sudo kill -9 1872
I ran this on powershell to kill all instances of the kestral server
Get-Process -Name *dotnet* | Stop-Process
For windows users
run netstat -ano -p TCP | find /I "listening" | find /I "port number"
then run taskkill /F /PID process ID on Command Prompt.
Here is an example
C:\Users\Kiran>netstat -ano -p TCP | find /I "listening" | find /I "2492"
TCP 127.0.0.1:2492 0.0.0.0:0 LISTENING 820
C:\Users\Kiran>taskkill /F /PID 820
SUCCESS: The process with PID 820 has been terminated.
Here netstat -ano -p TCP | find /I "listening" | find /I "2492" finds the process running TCP protocol listening on port 2492. And taskkill /F /PID 820 command to forcefully terminate the process with id 820
If anything else fails you can simply close it from the task manager. The name of the process would be dotnet. If you have Visual Studio open (in my case at least), there may be at least one other dotnet process running. Could not distiguish between them using only the task manager...
PS: When launching Kestrel with dotnet run from the PMC, in the console you get this:
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
But it didn't work to stop it with Ctrl+C
The line below works for me.
killall -9 dotnet
Stumbled upon it today. The answer above looks cool but netstat is slow. A simpler way to kill kestrel would be to use the PowerShell commandlet Get-NetTCPConnection.
To kill kestrel listening on Port 5000, the command would be
$pId = (Get-NetTCPConnection -LocalPort 5000).OwningProcess[0]
kill -Id $pId
Save the following in a .cmd file and click on the file:
Taskkill.exe /F /IM dotnet.exe /T
Ctrl + Break also does the trick.
I need help figuring out the root cause of this permission denied error. What permissions does nginx need? Why is it so complicated?
the socket API bind() to a port less than 1024, such as 80 as your title mentioned, need root access.
here is "Bind to ports less than 1024 without root access"
and another easier way is to run nginx as root.
If you use a port bigger than 1024 with root privilege, but still got this problem, that's may be caused by SELinux:
Check this port, say 8024, in segange port
sudo semanage port -l | grep http_port_t
If 8024 doesn't exist in the port list, add it into segange port
sudo semanage port -a -t http_port_t -p tcp 8024
###update in 2017.12.22
Sometimes your SELinux is disabled, you need to enforcing it first. Check the status of SELinux by
$ sestatus
More steps can read this wonderful article: https://www.digitalocean.com/community/tutorials/an-introduction-to-selinux-on-centos-7-part-1-basic-concepts
If see this msg after run "nginx -t", you dont have premission run as root "sudo nginx -t"
nginx needs root access. Just use
sudo nginx
next step along with your password
The best solution would be:
1) add user to sudoers ( my user is prod)
usermod -aG sudo prod
2) inside circus ( process manager ) append sudo before nginx executable, mine looks like this:
[watcher:nginx]
cmd = sudo /usr/sbin/nginx
args = -c /home/t/Projects/x_b_11/etc/nginx.conf -p /home/t/Projects/x_b_11
3) and finaly add line into file /etc/sudoers ( my user is prod). This line avoids error (sudo: no tty present and no askpass program specified). Probably need to restart session ( reboot). Enjoy.
prod ALL = NOPASSWD: /usr/sbin/nginx
Ubuntu uses AppArmor and not SELinux. The responses pointing to SELinux may not be that relevant to the OP.
For the others that Googled this: I also encountered this issue on a SELinux-enabled CentOS 7 machine. nginx would not bind port 80 and gave me error 13: permission denied despite having already run
setcap 'CAP_NET_BIND_SERVICE=+ep' /usr/sbin/nginx to allow the service to bind the port with a non-root user.
Temporarily setting SELinux to Permissive (sudo setenforce Permissive) allowed nginx to start. I then ran audit2allow -a which gave me
#============= httpd_t ==============
#!!!! This avc can be allowed using the boolean 'httpd_can_network_connect'
allow httpd_t ntop_port_t:tcp_socket name_connect;
Which meant the solution was to also run:
sudo setsebool -P httpd_can_network_connect on
After which you can set SELinux back to Enforcing (sudo setenforce Enforcing) and restart everything to verify.
How can I check, how many connections are established for example on port 80 and then write it to the file using bash console?
I've read that netstat can do this, but I can not find , what exactly should I do with that, as I'm newbie on "Unix" systems.
You probably want sockstat if you're on FreeBSD:
sockstat -c -L -P tcp -p 80