How do I release port 80 on a beaglebone so I can use it?
Asked Answered
M

3

16

I have a beaglebone on which I have configured lighttpd to run. Currently I have it running on port 8080 and it works fine. Except I really want to use it on port 80. Unfortunately it won't start on port 80 because it fails and reports that the port is already in use. When I access the beaglebone via HTTP on port 80, of course I get the beaglebone 101 screen.

This page suggests that I run systemctl disable bone101.service but that service does not even exist on my version of Angstrom. I am using the Angstrom img I got from here, which is Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.12-beaglebone-2013.04.13.img.xz.

I am currently running with all of the following disabled:

systemctl disable cloud9.service                  
systemctl disable gateone.service                 
systemctl disable bonescript.service              
systemctl disable bonescript-autorun.service      
systemctl disable avahi-daemon.service            
systemctl disable gdm.service     # this disables the Gnome desktop which is maybe irrelevant here, but saves a ton of memory

But I still get the problem on port 80.

I know that node.js is what's serving up the content, but even when ps aux shows that node.js is not running (I can kill it), it seems that accessing the port once again invokes node.js.

How can I disable port 80 once and for all so I can free it up for use by lighttpd?

Here is the complete output from ps aux:

root         1  0.2  1.0   4820  2684 ?        Ss   17:58   0:01 /sbin/init run_hardware_tests
root         2  0.0  0.0      0     0 ?        S    17:58   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    17:58   0:00 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   17:58   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S<   17:58   0:00 [kworker/u:0H]
root         8  0.0  0.0      0     0 ?        S    17:58   0:00 [migration/0]
root         9  0.0  0.0      0     0 ?        S    17:58   0:00 [rcu_bh]
root        10  0.0  0.0      0     0 ?        S    17:58   0:00 [rcu_sched]
root        11  0.0  0.0      0     0 ?        S    17:58   0:00 [watchdog/0]
root        12  0.0  0.0      0     0 ?        S<   17:58   0:00 [khelper]
root        13  0.0  0.0      0     0 ?        S    17:58   0:00 [kdevtmpfs]
root        14  0.0  0.0      0     0 ?        S<   17:58   0:00 [netns]
root        15  0.0  0.0      0     0 ?        S    17:58   0:00 [kworker/0:1]
root        16  0.0  0.0      0     0 ?        S    17:58   0:00 [bdi-default]
root        17  0.0  0.0      0     0 ?        S<   17:58   0:00 [kintegrityd]
root        18  0.0  0.0      0     0 ?        S<   17:58   0:00 [kblockd]
root        19  0.0  0.0      0     0 ?        S    17:58   0:00 [khubd]
root        20  0.0  0.0      0     0 ?        S    17:58   0:00 [irq/86-44e0b000]
root        21  0.0  0.0      0     0 ?        S    17:58   0:00 [kworker/u:1]
root        26  0.0  0.0      0     0 ?        S    17:58   0:00 [irq/46-4819c000]
root        35  0.0  0.0      0     0 ?        S<   17:58   0:00 [rpciod]
root        37  0.0  0.0      0     0 ?        S    17:58   0:00 [khungtaskd]
root        38  0.0  0.0      0     0 ?        S    17:58   0:00 [kswapd0]
root        39  0.0  0.0      0     0 ?        S    17:58   0:00 [fsnotify_mark]
root        40  0.0  0.0      0     0 ?        S<   17:58   0:00 [nfsiod]
root        41  0.0  0.0      0     0 ?        S<   17:58   0:00 [crypto]
root        44  0.0  0.0      0     0 ?        S<   17:58   0:00 [pencrypt]
root        45  0.0  0.0      0     0 ?        S<   17:58   0:00 [pdecrypt]
root        52  0.0  0.0      0     0 ?        S<   17:58   0:00 [OMAP UART0]
root        54  0.0  0.0      0     0 ?        S<   17:58   0:00 [kpsmoused]
root        66  0.0  0.0      0     0 ?        S<   17:58   0:00 [deferwq]
root        67  0.0  0.0      0     0 ?        S    17:58   0:00 [kworker/u:2]
root        68  0.1  0.0      0     0 ?        D    17:58   0:00 [mmcqd/0]
root        71  0.0  0.0      0     0 ?        S<   17:58   0:00 [kworker/0:1H]
root        72  0.0  0.0      0     0 ?        S    17:58   0:00 [jbd2/mmcblk0p2-]
root        73  0.0  0.0      0     0 ?        S<   17:58   0:00 [ext4-dio-unwrit]
root        81  0.6  2.0 260668  5212 ?        Ss   17:58   0:06 /lib/systemd/systemd-journald
root        83  0.0  0.6   3732  1668 ?        Ss   17:58   0:00 /lib/systemd/systemd-udevd
root        86  0.0  0.0      0     0 ?        S    17:58   0:00 [kworker/0:2]
root        93  0.0  0.0      0     0 ?        S<   17:58   0:00 [krfcommd]
root       164  0.0  0.4   3008  1196 ?        Ss   17:58   0:00 /usr/sbin/crond -n
root       166  0.0  0.3   2464   916 ?        Ss   17:58   0:00 /usr/sbin/lighttpd -D -f /etc/lighttpd.conf
root       167  0.0  0.8   5524  2260 ?        Ss   17:58   0:00 /usr/sbin/connmand -n
root       169  0.0  0.5   3012  1332 ?        Ss   17:58   0:00 /bin/sh /usr/bin/g-ether-load.sh
root       173  0.0  0.5   3056  1396 ?        Ss   17:58   0:00 /bin/sh /usr/bin/mysqld_safe
root       175  0.0  0.4   2976  1156 ?        Ss   17:58   0:00 /lib/systemd/systemd-logind
999        185  0.0  0.5   2840  1380 ?        Ss   17:58   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root       191  0.0  0.2   1992   724 tty1     Ss+  17:58   0:00 /sbin/agetty --noclear tty1 38400 linux
root       234  0.0  0.2   1992   712 ttyO0    Ss+  17:58   0:00 /sbin/agetty -s ttyO0 115200
root       335  0.0  0.0      0     0 ?        S    17:58   0:00 [flush-179:0]
root       394  0.0  0.0      0     0 ?        S    17:58   0:00 [file-storage]
root       407  0.0  0.2   2152   688 ?        S    17:58   0:00 /usr/sbin/udhcpd -f -S /etc/udhcpd.conf
mysql      448  0.0  1.6  26604  4064 ?        Sl   17:59   0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/mysql --user=mysql --log-error=/var/log/mysqld.err --pid-file=/var/lib/mysql/mysqld.p
root       479  0.0  0.4   3564  1216 ?        Ss   17:59   0:00 /usr/bin/ntpd -p /run/ntpd.pid
root       491  0.1  0.5   3028  1320 ?        Ss   18:03   0:00 /usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -p 22
root       492  0.0  0.6   3164  1688 pts/0    Ss   18:03   0:00 -sh
root       508  0.0  0.0      0     0 ?        S    18:08   0:00 [kworker/0:0]

Also, the /etc/xinetd.conf file is pretty barren:

# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{


}

includedir /etc/xinetd.d

And the /etc/xinetd.d folder is empty.

I've also tried using netstat, but it fails to provide the -p switch on the beaglebone for some reason, so I don't get any information about which process is responsible.

The best output I can get from netstat is with netstat -nl | grep tcp which gives:

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 :::53                   :::*                    LISTEN

netstat -p says invalid option -- 'p',

Mcgowan answered 15/5, 2013 at 0:11 Comment(11)
It could be launched by inetd - do you see anything node.js related in /etc/xinetd.dCastleberry
This also might be better suited for serverfault.comCastleberry
@doublesharp, I added details about my xinetd.d. It is empty.Mcgowan
Def a serverfault Q, this has little to nothing to do with lighttpd. In the mean time, take a look at netstat --tcp.Voroshilov
@David, Serverfault closed it as 'off topic'. Also, I've added details about the output from netstat.Mcgowan
@DavidSouther This is why ServerFault was removed as a migration option on StackOverflow. A Beagle Board is not for professional use. This question is not on-topic on ServerFault. It might be on Unix.SE but it's worth asking in chat first.Epidemic
Ah, sorry, wasn't aware of that rule for serverfault.Voroshilov
Well in this case it is actually 'professional'. We plan to deploy it as a microserver.Mcgowan
Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See What topics can I ask about here in the Help Center. Perhaps Super User or Unix & Linux Stack Exchange would be a better place to ask. Also see Where do I post questions about Dev Ops?.Quean
@jww, if you plan to develop anything web related on a beaglebone then this is a potential issue that you will encounter. This is DEFINITELY a development question. besides, this was posted more than two years ago.Mcgowan
@Mcgowan - "then this is a potential issue that you will encounter..." - I came across it when trying to shutdown unneeded services. So yes, it is needed information. "This is DEFINITELY a development question..." - how so? It looks like you are pleading the "I am a developer, therefore everything I ask is on-topic". This is simply gadget configuration. According to this site's charter, its off-topic. That it was asked in 2012 or after just means the community did not police itself well. We have to tag them as off-topic; otherwise others will keep asking the same off-topic stuff.Quean
M
29

I found the solution at last. The secret is to also disable the socket as well as the service.

systemctl disable bonescript.service              
systemctl disable bonescript.socket
systemctl disable bonescript-autorun.service

And now I can use port 80 for lighttpd.

Mcgowan answered 15/5, 2013 at 16:55 Comment(0)
T
3

On my Debian-based BeagleBone Black, the contents of /lib/systemd/system/bonescript.socket reads:

[Socket]
ListenStream=80

[Install]
WantedBy=sockets.target

The makes it possible to move the bonescript socket to another port without resorting to disabling the service. This will have side-effects on the node.js server that expects to find resources on port 80, so it will involve more than just setting the listener port to preserve the existing functionality.

Tinfoil answered 1/6, 2016 at 1:59 Comment(0)
E
0

It looks like the BeagleBoard has lsof available. Try this:

sudo lsof -i -nP

If there's too much output and you need to restrict it:

sudo lsof -i -nP | grep ":80 (LISTEN)"
Epidemic answered 15/5, 2013 at 16:20 Comment(1)
Angstrom (as of 2013-06-20) comes without lsofEvonevonne

© 2022 - 2024 — McMap. All rights reserved.