狂自私

导航

nfs-server启动失败:Unable to break cycle starting with nfs-server.service/start

[root@harbor ~]# systemctl status nfs-server.service
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
  Drop-In: /run/systemd/generator/nfs-server.service.d
           └─order-with-mounts.conf
   Active: inactive (dead)

4月 22 22:12:15 harbor systemd[1]: nfs-server.service: Found ordering cycle on nfs.mount/start
4月 22 22:12:15 harbor systemd[1]: nfs-server.service: Found dependency on nfs-server.service/start
4月 22 22:12:15 harbor systemd[1]: nfs-server.service: Unable to break cycle starting with nfs-server.service/start
4月 22 22:13:18 harbor systemd[1]: nfs-server.service: Found ordering cycle on nfs.mount/start
4月 22 22:13:18 harbor systemd[1]: nfs-server.service: Found dependency on nfs-server.service/start
4月 22 22:13:18 harbor systemd[1]: nfs-server.service: Unable to break cycle starting with nfs-server.service/start
[root@harbor ~]#

 

最开始我以为我遇到了某种bug,好吧,其实是我自己蠢笨而已。

请使用命令systemctl list-dependencies nfs-server.service查看nfs-server的依赖项,找到没有启动的服务,尝试去启动它,看看能否启动(一般都不行,不然为啥最终需要的服务起不来?)然后看看这个不能启动的服务的状态和报错信息。然后再因地制宜。

[root@harbor ~]# systemctl list-dependencies nfs-server.service
nfs-server.service
● ├─-.mount
● ├─auth-rpcgss-module.service
● ├─nfs-idmapd.service
● ├─nfs-mountd.service
● ├─nfs.mount
● ├─nfsdcld.service
● ├─proc-fs-nfsd.mount
● ├─rpc-statd-notify.service
● ├─rpc-statd.service
● ├─rpcbind.socket
● ├─system.slice
● ├─network-online.target
● │ └─NetworkManager-wait-online.service
● └─network.target
[root@harbor ~]#

然后查看服务nfs.mount的状态:

[root@harbor ~]# systemctl status nfs.mount
● nfs.mount - /nfs
   Loaded: loaded (/etc/fstab; generated)
   Active: failed (Result: timeout) since Mon 2024-04-22 22:11:15 CST; 3min 20s ago
    Where: /nfs
     What: 192.168.24.5:/nfs
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
    Tasks: 0 (limit: 23356)
   Memory: 692.0K
   CGroup: /system.slice/nfs.mount

4月 22 22:11:15 harbor systemd[1]: nfs.mount: Mounting timed out. Terminating.
4月 22 22:11:15 harbor systemd[1]: nfs.mount: Mount process exited, code=killed status=15
4月 22 22:11:15 harbor systemd[1]: nfs.mount: Failed with result 'timeout'.
4月 22 22:11:15 harbor systemd[1]: Failed to mount /nfs.
4月 22 22:12:15 harbor systemd[1]: nfs-server.service: Found ordering cycle on nfs.mount/start
4月 22 22:12:15 harbor systemd[1]: nfs-server.service: Found dependency on nfs-server.service/start
4月 22 22:12:15 harbor systemd[1]: nfs-server.service: Unable to break cycle starting with nfs-server.service/start
4月 22 22:13:18 harbor systemd[1]: nfs-server.service: Found ordering cycle on nfs.mount/start
4月 22 22:13:18 harbor systemd[1]: nfs-server.service: Found dependency on nfs-server.service/start
4月 22 22:13:18 harbor systemd[1]: nfs-server.service: Unable to break cycle starting with nfs-server.service/start
[root@harbor ~]# 

它再说它挂载超时。说明有什么配置项在让它去挂载某个文件系统(磁盘),检查/etc/fstab文件:

[root@harbor ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Wed Apr 10 05:06:12 2024
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/kals-root   /                       xfs     defaults        0 0
/dev/mapper/kals-backup /backup                 xfs     defaults        0 0
UUID=adca8a7e-0db9-4158-96a9-3057dbb13a3c /boot                   ext4    defaults        1 2
#/dev/mapper/kals-swap   swap                    swap    defaults        0 0
192.168.24.5:/nfs /nfs nfs defaults 0 0
[root@harbor ~]# 

TNN的,被自己气死,我怎么把这个测试配置留着了。

删除这个配置项,然后使用命令systemctl daemon-reload重新加载服务资源,nfs-server服务成功启动了。

[root@harbor ~]# systemctl status nfs-server
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
  Drop-In: /run/systemd/generator/nfs-server.service.d
           └─order-with-mounts.conf
   Active: active (exited) since Mon 2024-04-22 22:27:30 CST; 6min ago
  Process: 8078 ExecStart=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS)
  Process: 8066 ExecStart=/usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
  Process: 8065 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 8078 (code=exited, status=0/SUCCESS)

4月 22 22:27:30 harbor systemd[1]: Starting NFS server and services...
4月 22 22:27:30 harbor systemd[1]: Started NFS server and services.
[root@harbor ~]#

 

posted on 2024-04-22 22:34  狂自私  阅读(166)  评论(0编辑  收藏  举报