rpcbind.service启动失败

新装的服务器,启动rpcbind.service通常失败,执行下面的两个命令经常卡死,一直不返回,也不报错

#systemctl start nfs-server.service
#systemctl start rpcbind.service

偶尔执行以下命令,却又可以

#systemctl restart rpcbind.service

关机偶尔会卡在rpcbind.service,近5分钟也关闭不了。阿里的云服务器还是不错的,不仅可以利用网页远程控制服务器,连整个关机、重启的过程的屏显都可以看到。为问题的分析提供了便利。下面是关机时的截图

开机有一个加载失败的提示

于是按提示,在登录系统后执行相关命令

象是说地址没有解释的协议,解释地址错误,于是按提示打开相关配置文件

#vi /etc/systemd/system/sockets.target.wants/rpcbind.socket

因提示的地址并不完整,看上去似乎是64位IP地址有问题,因为内部也没有必要使用64位IP地址,于是我注释了[::]:111相关的两行内容

保存,重启后,问题解决:)

 

昨天在做服务器磁盘分区扩容的时候出现过一个服务启动的问题,在此记录。
情景再现:前天晚上申请做磁盘扩容,得到批准后,昨天早上5点开始做停机调整维护,历经2个多小时的折腾,扩充完毕,有关这部分内容请参考上篇博文 ( https://blog.51cto.com/hld1992/2054837) 而后重启机器,检查服务,nginx,php-fpm,redis,svn,nfs(?)都启动正常。然后,去另一台机器上挂载nfs,问题出现了,nfs无响应。回来检查nfs服务:
ipv6禁用导致rpcbind服务启动失败实例
好嘛,rpcbind服务没有启动,赶紧启动服务。

    [root@BZ ~]# systemctl start rpcbind 
    A dependency job for rpcbind.service failed. See 'journalctl -xe' for details.

报错了,根据提示使用journalctl -xe看一下日志:

[root@BZ ~]# journalctl -xe
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-3.scope has begun starting up.
Dec 26 21:34:26 BZ chronyd[490]: System clock wrong by -1.090838 seconds, adjustment started Dec 26 21:35:31 BZ chronyd[490]: Selected source 61.216.153.107 Dec 26 21:35:31 BZ chronyd[490]: System clock wrong by 0.646329 seconds, adjustment started Dec 26 21:36:24 BZ polkitd[484]: Registered Authentication Agent for unix-process:2701:32282 (system bus name :1.29 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) Dec 26 21:36:24 BZ systemd[1]: rpcbind.socket failed to listen on sockets: Address family not supported by protocol #报错显示ip地址协议不支持 Dec 26 21:36:24 BZ systemd[1]: Failed to listen on RPCbind Server Activation Socket. #端口监听失败 -- Subject: Unit rpcbind.socket has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit rpcbind.socket has failed. -- -- The result is failed. Dec 26 21:36:24 BZ systemd[1]: Dependency failed for RPC bind service. 

于是赶紧谷歌了下,发现是由于ipv6被禁用导致的。查看下/etc/sysctl.conf

[root@BZ ~]# less /etc/sysctl.conf | grep 'net.ipv6'
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

果然ipv6被禁用了。由于当时情况紧急,我采取了一个比较不好的方法,把ipv6启用了(后面还有其他方法介绍)。

[root@BZ ~]# sed -i 's@net.ipv6.conf.all.disable_ipv6 = 1@net.ipv6.conf.all.disable_ipv6 = 0@g' /etc/sysctl.conf
[root@BZ ~]# sysctl -p ... net.ipv6.conf.all.disable_ipv6 = 0

再次启动rpcbind

[root@BZ ~]# systemctl start rpcbind 
[root@BZ ~]# systemctl status rpcbind 
● rpcbind.service - RPC bind service
   Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor preset: enabled) Active: active (running) since Tue 2017-12-26 21:48:22 EST; 7s ago Process: 2734 ExecStart=/sbin/rpcbind -w $RPCBIND_ARGS (code=exited, status=0/SUCCESS) Main PID: 2735 (rpcbind) CGroup: /system.slice/rpcbind.service └─2735 /sbin/rpcbind -w Dec 26 21:48:22 BZ systemd[1]: Starting RPC bind service... Dec 26 21:48:22 BZ systemd[1]: Started RPC bind service.

启动成功。再启动nfs

[root@BZ ~]# systemctl start  nfs 
[root@BZ ~]# systemctl status nfs 
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled) Active: active (exited) since Tue 2017-12-26 21:50:05 EST; 996ms ago Process: 2761 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS) Process: 2756 ExecStartPre=/bin/sh -c /bin/kill -HUP `cat /run/gssproxy.pid` (code=exited, status=0/SUCCESS) Process: 2755 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS) Main PID: 2761 (code=exited, status=0/SUCCESS) CGroup: /system.slice/nfs-server.service Dec 26 21:50:05 BZ systemd[1]: Starting NFS server and services... Dec 26 21:50:05 BZ systemd[1]: Started NFS server and services.

再次去客户端挂载nfs就可以成功了。

========================================================================
刚才说了,启动ipv6当然不是一个好的方法,下面来继续说明下。
从前面的报错日志中我们可以看到,rpcbind.service依赖rpcbind.socket

    -- Unit rpcbind.socket has failed.

既然rpcbind.socket启动失败,那应该在它的配置文件中会有关于ipv6的配置,我来找一下:

    [root@BZ ~]# find /etc/ -name '*rpcbind.socket*'
  /etc/systemd/system/sockets.target.wants/rpcbind.socket

进去看下:

[Unit]
Description=RPCbind Server Activation Socket

[Socket]
ListenStream=/var/run/rpcbind.sock
ListenStream=[::]:111 #果然监听了ipv6地址,将这一行注释即可 ListenStream=0.0.0.0:111 BindIPv6Only=ipv6-only  [Install] WantedBy=sockets.target 

将关于ipv6的相关配置注释后,重启rpcbind.socket

[root@BZ ~]# systemctl restart rpcbind.socket
Warning: rpcbind.socket changed on disk. Run 'systemctl daemon-reload' to reload units.

systemd发现配置文件有改动,需要重载一下。

[root@BZ ~]# systemctl daemon-reload

再次重启

[root@BZ ~]# systemctl restart rpcbind.socket
[root@BZ ~]# systemctl status rpcbind.socket
● rpcbind.socket - RPCbind Server Activation Socket
   Loaded: loaded (/usr/lib/systemd/system/rpcbind.socket; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-12-26 22:01:45 EST; 9s ago Listen: /var/run/rpcbind.sock (Stream) 0.0.0.0:111 (Stream) #只监听了ipv4的111端口

后记

在谷歌的过程中,发现还有一种方法来解决这个问题。具体就是使用dracut -v -f 命令重建下initramfs,然后重启机器即可。
还有一个问题就是rpcbind设置开机自启动失败

[root@BZ ~]# systemctl enable rpcbind.service
[root@BZ ~]# systemctl is-enabled rpcbind.service
indirect

不知道是什么原因,希望有大神可以帮我解答啊,万分感谢,我现在是把它放到了/etc/rc.d/rc.local里面了。

转载于:https://www.cnblogs.com/zhengchunyuan/p/10823528.html

[root@Docker-register ~]# systemctl list-units --type=service --state=running UNIT LOAD ACTIVE SUB DESCRIPTION auditd.service loaded active running Security Auditing Service chronyd.service loaded active running NTP client/server couchbase-server.service loaded active running Couchbase Server crond.service loaded active running Command Scheduler dbus.service loaded active running D-Bus System Message Bus docker.service loaded active running Docker Application Container Engine getty@tty1.service loaded active running Getty on tty1 gssproxy.service loaded active running GSSAPI Proxy Daemon irqbalance.service loaded active running irqbalance daemon lvm2-lvmetad.service loaded active running LVM2 metadata daemon metricbeat.service loaded active running Metricbeat is a lightweight shipper for metrics. NetworkManager.service loaded active running Network Manager polkit.service loaded active running Authorization Manager postfix.service loaded active running Postfix Mail Transport Agent rhnsd.service loaded active running LSB: Starts the Spacewalk Daemon rhsmcertd.service loaded active running Enable periodic update of entitlement certificates. rpcbind.service loaded active running RPC bind service rsyslog.service loaded active running System Logging Service sshd.service loaded active running OpenSSH server daemon systemd-journald.service loaded active running Journal Service systemd-logind.service loaded active running Login Service systemd-udevd.service loaded active running udev Kernel Device Manager tuned.service loaded active running Dynamic System Tuning Daemon vgauthd.service loaded active running VGAuth Service for open-vm-tools vmtoolsd.service loaded active running Service for virtual machines hosted on VMware zabbix-agent.service loaded active running Zabbix Agent LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 26 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'.
最新发布
03-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
OSZAR »