如何在Beaglebone上释放80端口以便使用?

16

我有一台Beaglebone,已经配置了lighttpd运行,目前它在8080端口上运行良好。但是我真的想在80端口上使用它。不幸的是,它无法在80端口上启动,因为它会失败并报告该端口已被使用。当我通过HTTP访问Beaglebone的80端口时,当然会显示Beaglebone 101屏幕。

这个页面建议我运行systemctl disable bone101.service,但是我的版本的Angstrom上并不存在该服务。我使用从这里下载的Angstrom img,即Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.12-beaglebone-2013.04.13.img.xz

我目前已禁用以下所有内容:

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

但我仍然在80端口上遇到问题。

我知道node.js正在提供内容,但即使 ps aux 显示 node.js 没有运行(我可以杀死它),似乎再次访问该端口会调用 node.js。

我如何一劳永逸地禁用端口 80,以便将其释放供 lighttpd 使用?

以下是 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]

此外,/etc/xinetd.conf文件相当空洞:

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

defaults
{


}

includedir /etc/xinetd.d

而且/etc/xinetd.d文件夹为空。

我曾尝试使用netstat,但由于某种原因,在beaglebone上无法提供-p开关,因此我无法得到有关哪个进程负责的任何信息。

我从netstat中可以得到的最好输出是使用netstat -nl | grep tcp,它会给出:

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 会显示invalid option -- 'p'错误。


1
这也许更适合于http://serverfault.com/。 - doublesharp
@doublesharp,我添加了关于我的xinetd.d的详细信息。它是空的。 - Octopus
这是一个关于服务器故障的问题,与 lighttpd 几乎没有任何关系。同时,请查看 netstat --tcp - David Souther
4
这就是为什么在StackOverflow中移除了ServerFault作为迁移选项的原因。Beagle Board不适合专业使用。这个问题在ServerFault上不是主题范围,可能适合Unix.SE,但最好先在聊天室里询问一下。 - Ladadadada
1
Stack Overflow是一个关于编程和开发问题的网站。这个问题似乎不属于编程或开发范畴。请参阅帮助中心中的我可以在这里问什么样的问题。也许超级用户Unix&Linux Stack Exchange更适合提问。另请参阅我应该在哪里发布Dev Ops相关问题? - jww
显示剩余6条评论
3个回答

29

我终于找到了解决方案。 秘诀是除了服务之外,还要禁用套接字

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

现在我可以使用80端口来运行lighttpd了。

3
在我的基于Debian的BeagleBone Black上,/lib/systemd/system/bonescript.socket的内容如下:
[Socket]
ListenStream=80

[Install]
WantedBy=sockets.target

使得可以将Bonescript套接字移动到另一个端口,而无需禁用服务。这将对期望在端口80上找到资源的node.js服务器产生副作用,因此它涉及更多操作以保留现有功能,而不仅仅是设置监听器端口。


0

看起来BeagleBoard有lsof可用。尝试这个:

sudo lsof -i -nP

如果输出太多,需要限制它:

sudo lsof -i -nP | grep ":80 (LISTEN)"

1
Angstrom(截至2013年06月20日)不带有lsof。 - Alessandro Da Rugna

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接