Issue 142 in shellinabox: When starting shellinaboxd, I always get the erroro message "Failed to find any available port"

610 views
Skip to first unread message

shell...@googlecode.com

unread,
Oct 1, 2011, 10:41:35 AM10/1/11
to shell...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 142 by olaf.tri...@googlemail.com: When starting shellinaboxd, I
always get the erroro message "Failed to find any available port"
http://code.google.com/p/shellinabox/issues/detail?id=142

What steps will reproduce the problem?
1. When running under root "shellinaboxd" I always get the erroro
message "Failed to find any available port". What do I have to do to make
sellinabox work?

What is the expected output? What do you see instead?
That the shellinabox demon would start

What version of the product are you using? On what operating system?
ShellInABox: shellinabox_2.10-1_amd64.deb
OS: Debian Lenny v5.0 54bit

Please provide any additional information below.


shell...@googlecode.com

unread,
Oct 2, 2011, 9:24:35 AM10/2/11
to shell...@googlegroups.com

Comment #1 on issue 142 by gomez...@gmail.com: When starting shellinaboxd,
I always get the erroro message "Failed to find any available port"
http://code.google.com/p/shellinabox/issues/detail?id=142

As far as I understand it, that way you are attempting to run SiAB without
of the required parameters. Try this instead:

/etc/init.d/shellinabox start

...which will start it with the options defined in that script. I have
asked a question here regarding the best way to set different options, but
I have never got an answer, so I edit that script directly.

shell...@googlecode.com

unread,
Dec 18, 2014, 8:41:43 AM12/18/14
to shell...@googlegroups.com

Comment #2 on issue 142 by M4dH4TT3...@gmail.com: When starting
shellinaboxd, I always get the erroro message "Failed to find any available
port"
https://code.google.com/p/shellinabox/issues/detail?id=142

I get this error currently and its not because of how im starting it!

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

shell...@googlecode.com

unread,
Mar 13, 2015, 10:40:48 AM3/13/15
to shell...@googlegroups.com

Comment #3 on issue 142 by luka.kra...@gmail.com: When starting
shellinaboxd, I always get the erroro message "Failed to find any available
port"
https://code.google.com/p/shellinabox/issues/detail?id=142

This error means that some other application is already listening on port
4200.
Maybe it is even shellinabox.

You could add --port parameter so that shellinabox will run on port 4201.

./shellinaboxd --port 4201

shell...@googlecode.com

unread,
Mar 16, 2015, 9:02:37 PM3/16/15
to shell...@googlegroups.com

Comment #4 on issue 142 by imgent...@gmail.com: When starting shellinaboxd,
I always get the erroro message "Failed to find any available port"
https://code.google.com/p/shellinabox/issues/detail?id=142

Hello Dears,
I am facing something similar in Raspbian.

When I perform netstat -ntl I got:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:4200 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:5900 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:6000 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:6010 0.0.0.0:*
LISTEN

That means that the port 4200 has been configured to shellinabox (line 1),
right?

But when I run the command shellinabox -d:

Failed to find any available port

If I try to change the port (shellinaboxd -p 4201), the shell stops and
after a control Z I have repeated the netstat -ntl:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:4200 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:4201 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN

I try to access the shellinabox in my browser, but I got a timeout.
Any idea?

shell...@googlecode.com

unread,
Mar 17, 2015, 4:23:33 AM3/17/15
to shell...@googlegroups.com

Comment #5 on issue 142 by luka.kra...@gmail.com: When starting
shellinaboxd, I always get the erroro message "Failed to find any available
port"
https://code.google.com/p/shellinabox/issues/detail?id=142

Hi, shellinabox is probably already running on port 4200. Try to run
command "ps axl | grep shellinabox"
and check the output.

Output "127.0.0.1:4200" is telling us that shellinabox is configured to
listen only on localhost, with
option "--localhost-only". You can only connect to it from browser running
on raspberry.

You should remove option "--localhost-only" from startup script and try
again. I think that your startup
script is "/etc/init.d/shellinabox". To restart shellinabox
run "/etc/init.d/shellinabox restart".

PS: running shellinabox by hand is only usefull for testing
(like "shellinaboxd -p 4201"), but as I can
see from your second output you should be able to connect to
http://{IP_ADDRESS}:4201

Bye :)

shell...@googlecode.com

unread,
Mar 18, 2015, 8:28:08 PM3/18/15
to shell...@googlegroups.com

Comment #6 on issue 142 by imgent...@gmail.com: When starting shellinaboxd,
I always get the erroro message "Failed to find any available port"
https://code.google.com/p/shellinabox/issues/detail?id=142

Hello luka.kra,

Thank you for your support.

The option --localhost-only was really there and I have removed it from the
startup script. But it was not in the script, but in a config file
(/etc/default/shellinabox) described in the script.
After restart the shellianbox I have run netstat -ntl:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:4200 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN

Unfortunately, I could not access it in my browser. The reaction is the
same:
ERR_CONNECTION_TIMED_OUT

Is there some way to check the request in the port 4200?

Here the result of "ps axl | grep shellinabox"

5 108 5552 1 20 0 4560 2400 poll_s Ss ? 0:00
/usr/bin/shellinaboxd -q --background=/var/run/shellinaboxd.pid -c
/var/lib/shellinabox -p 4200 -u shellinabox -g shellinabox --user-css Black
on White:+/etc/shellinabox/options-enabled/00+Black on White.css,White On
Black:-/etc/shellinabox/options-enabled/00_White On Black.css;Color
Terminal:+/etc/shellinabox/options-enabled/01+Color
Terminal.css,Monochrome:-/etc/shellinabox/options-enabled/01_Monochrome.css
--no-beep -s /terminal:LOGIN --disable-ssl
5 108 5553 5552 20 0 4560 1316 unix_s S ? 0:00
/usr/bin/shellinaboxd -q --background=/var/run/shellinaboxd.pid -c
/var/lib/shellinabox -p 4200 -u shellinabox -g shellinabox --user-css Black
on White:+/etc/shellinabox/options-enabled/00+Black on White.css,White On
Black:-/etc/shellinabox/options-enabled/00_White On Black.css;Color
Terminal:+/etc/shellinabox/options-enabled/01+Color
Terminal.css,Monochrome:-/etc/shellinabox/options-enabled/01_Monochrome.css
--no-beep -s /terminal:LOGIN --disable-ssl
0 1000 5613 5299 20 0 3552 1836 pipe_w S+ pts/1 0:00 grep
--color=auto shellinabox

shell...@googlecode.com

unread,
Mar 19, 2015, 4:43:29 AM3/19/15
to shell...@googlegroups.com

Comment #7 on issue 142 by luka.kra...@gmail.com: When starting
shellinaboxd, I always get the erroro message "Failed to find any available
port"
https://code.google.com/p/shellinabox/issues/detail?id=142

Ok, we are making progress :)

With ps command I can see that your shellinabox starts without SSL and is
available on "/terminal" path. You can see that by "--disable-ssl" and "-s
/terminal..." options. That means that you should be able to access it on
URL: http://{IP_ADDRESS}:4200/terminal

For test purposes try to run command "shellinaboxd --disable-ssl --port
4222 --debug" and than try to connect with URL: http://{IP_ADDRESS}:4222/.
You should see some output like this:

------------------
luka@luka-vm:~/Projects/shellinabox$ ./shellinaboxd --disable-ssl --port
4222 --debug
Command line: ./shellinaboxd --disable-ssl --port 4222 --debug
Listening on port 4222
Accepted connection from luka-pc:63875
Handling "GET" "/"
Compressed response from 5282 to 2285
luka-pc - - [19/Mar/2015:11:22:58 +0100] "GET / HTTP/1.1" 200 2375
Handling "GET" "/styles.css"
Compressed response from 7269 to 1497
luka-pc - - [19/Mar/2015:11:22:58 +0100] "GET /styles.css HTTP/1.1" 200 1626
Accepted connection from luka-pc:63876
...
------------------

You should see this GET requests and later POST request. Note
that "luka-pc" should be your PC name or IP address. If you don't see this
you probably have ports 4222 (and 4200) blocked by some firewall. Do you
have "iptables" or something alike installed and running on your system.
You could try to run command "sudo iptables --list" ...

Maybe you could also tell us what kind of browser do you use, because there
are some problems with IE11...

shell...@googlecode.com

unread,
Mar 25, 2015, 9:55:23 PM3/25/15
to shell...@googlegroups.com

Comment #8 on issue 142 by imgent...@gmail.com: When starting shellinaboxd,
I always get the erroro message "Failed to find any available port"
https://code.google.com/p/shellinabox/issues/detail?id=142

Hello Luka,
I have followed your instructions until the iptables and it has not worked.
Then, I have researched how to open ports with iptables. I have executed
the command:
iptables -A INPUT -p tcp --dport 4222 -j ACCEPT
After that, it has worked!!! So, the problem was the firewall
that was blocking the ports. I can access shellinabox from a browser
(Firefox and Chrome).

Thank you very much for your support. I have learned a lot.

shell...@googlecode.com

unread,
Apr 29, 2015, 4:46:38 AM4/29/15
to shell...@googlegroups.com

Comment #9 on issue 142 by luka.kra...@gmail.com: When starting
shellinaboxd, I always get the erroro message "Failed to find any available
port"
https://code.google.com/p/shellinabox/issues/detail?id=142

Hi, I am glad that you got it to work :)
Reply all
Reply to author
Forward
0 new messages