CentOS 7 开机延迟解决办法

 

遇到这种情况 , 开机延迟 ,  可以用下面的办法来查看 , 寻找到问题的源头 , 来看看到的是怎么回事

[root@DaMoWang ~]# dmesg |grep udev    #显示系统的启动信息 , 从中过滤udev
[    1.088863] systemd[1]: Listening on udev Control Socket.
[    1.088869] systemd[1]: Starting udev Control Socket.
[    1.088889] systemd[1]: Listening on udev Kernel Socket.
[    1.088893] systemd[1]: Starting udev Kernel Socket.
[root@DaMoWang ~]# journalctl -k |grep udev   #查看系统本次启动的日志 , 从中过滤udev
7月 18 23:41:55 DaMoWang.localdomain systemd[1]: Listening on udev Control Socket.
7月 18 23:41:55 DaMoWang.localdomain systemd[1]: Starting udev Control Socket.
7月 18 23:41:55 DaMoWang.localdomain systemd[1]: Listening on udev Kernel Socket.
7月 18 23:41:55 DaMoWang.localdomain systemd[1]: Starting udev Kernel Socket.

 

 

这看不出有什么问题 , 下面来一项一项的找 , 看看到底等待的是哪个服务

 

[root@DaMoWang ~]# systemd-analyze blame     #查看每个服务的启动耗时
      2min 586ms systemd-udev-settle.service
         30.258s NetworkManager-wait-online.service
         18.640s mysqld.service
         14.771s tuned.service
         12.301s named.service
         11.617s postfix.service
         11.201s polkit.service
         10.604s ModemManager.service
         10.135s dev-mapper-centos\x2droot.device
          9.747s lvm2-monitor.service
          8.636s systemd-logind.service
          8.626s rpcbind.service
          8.621s sysstat.service
          8.589s gssproxy.service
          8.588s named-setup-rndc.service
          8.495s avahi-daemon.service
          8.477s rhel-dmesg.service
          7.612s httpd.service
          6.934s chronyd.service
          6.524s abrt-ccpp.service
          5.783s vdo.service
          5.039s network.service
          3.982s auditd.service
          3.306s boot.mount
          3.027s systemd-tmpfiles-setup-dev.service
          2.927s NetworkManager.service
          2.670s systemd-udevd.service
          2.292s lvm2-pvscan@8:2.service
          2.272s rhel-readonly.service
          2.019s lvm2-pvscan@8:33.service
          1.797s lvm2-pvscan@8:65.service
          1.788s dmraid-activation.service
          1.761s lvm2-pvscan@8:49.service
          1.679s lvm2-pvscan@8:17.service
          1.462s sshd.service
          1.327s rhel-domainname.service
          1.267s plymouth-read-write.service
          1.213s systemd-[email protected]
          1.212s rsyslog.service
           880ms systemd-tmpfiles-setup.service
           817ms dev-hugepages.mount
           761ms systemd-remount-fs.service
           759ms sys-kernel-debug.mount
           758ms dev-mqueue.mount
           696ms nfs-config.service
           686ms rhel-import-state.service
           644ms kmod-static-nodes.service
           585ms systemd-journald.service
           488ms systemd-user-sessions.service

#下面还有很多服务 , 不过不需要看 , 只需要找到时间最长的那个服务就可以了

 

 

 

 

通过运行 systemd 分析,发现 systemd-udev-setle.service 是造成延迟的原因 

 

[root@DaMoWang ~]# systemctl mask systemd-udev-settle     #屏蔽掉这个服务
Created symlink from /etc/systemd/system/systemd-udev-settle.service to /dev/null.

  

转载于:https://www.cnblogs.com/bigdevilking/p/9333514.html

你可能感兴趣的:(CentOS 7 开机延迟解决办法)