{"id":6686,"date":"2017-05-08T12:37:31","date_gmt":"2017-05-08T04:37:31","guid":{"rendered":"http:\/\/rmohan.com\/?p=6686"},"modified":"2017-05-08T12:37:31","modified_gmt":"2017-05-08T04:37:31","slug":"centos-rhel-7-systemd-analyze-command-to-find-booting-time-delays","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6686","title":{"rendered":"CentOS \/ RHEL 7 : systemd-analyze command to find booting time delays"},"content":{"rendered":"<p>Question : My system is taking a lot of time to boot. How can I find out which services are taking long time to start?<\/p>\n<p>Answer :<\/p>\n<p>systemd-analyze command can be utilized to find out information about how much each service took to start. systemd-analyze time can provide overall information about how long it took system to start. Here is a command out which clearly shows the time taken by kernel, initrd and userspace while booting.<\/p>\n<p># systemd-analyze time<br \/>\nStartup finished in 1.267s (kernel) + 6.798s (initrd) + 1min 2.139s (userspace) = 1min 10.205s<br \/>\nTo find out, how much time each unit took to start, run systemd-analyze blame.<\/p>\n<p># systemd-analyze blame<br \/>\n         24.728s dev-mapper-centos\\x2droot.device<br \/>\n         15.135s kdump.service<br \/>\n         14.670s plymouth-quit-wait.service<br \/>\n         14.210s firewalld.service<br \/>\n          9.835s accounts-daemon.service<br \/>\n          7.383s ModemManager.service<br \/>\n          7.259s libvirtd.service<br \/>\n          7.257s systemd-logind.service<br \/>\n          7.177s ksm.service<br \/>\n          7.081s gssproxy.service<br \/>\n          7.067s avahi-daemon.service<br \/>\n          7.062s rsyslog.service<br \/>\n          7.039s abrt-ccpp.service<br \/>\nAs you see the output is sorted according to the time taken by each unit, you can easily find out which service is taking more time during booting and can dig down deeper to analyze the issue.<\/p>\n<p>At certain steps, the boot cannot proceed until all dependencies for unit are satisfied. To see units at these critical points run systemd-analyze critical-chain.<\/p>\n<p># systemd-analyze critical-chain<br \/>\nThe time after the unit is active or started is printed after the &#8220;@&#8221; character.<br \/>\nThe time the unit takes to start is printed after the &#8220;+&#8221; character.<\/p>\n<p>graphical.target @1min 2.102s<br \/>\n??multi-user.target @1min 2.102s<br \/>\n  ??abrt-vmcore.service @1min 1.228s +872ms<br \/>\n    ??kdump.service @46.090s +15.135s<br \/>\n      ??remote-fs.target @46.086s<br \/>\n        ??remote-fs-pre.target @46.083s<br \/>\n          ??iscsi-shutdown.service @45.951s +99ms<br \/>\n            ??network.target @45.944s<br \/>\n              ??network.service @44.959s +975ms<br \/>\n                ??NetworkManager.service @38.653s +689ms<br \/>\n                  ??firewalld.service @24.439s +14.210s<br \/>\n                    ??basic.target @23.850s<br \/>\n                      ??sockets.target @23.849s<br \/>\n                        ??cups.socket @23.847s<br \/>\n                          ??sysinit.target @23.618s<br \/>\n                            ??systemd-update-utmp.service @23.603s +13ms<br \/>\n                              ??auditd.service @22.959s +643ms<br \/>\n                                ??systemd-tmpfiles-setup.service @22.726s +230ms<br \/>\n                                  ??rhel-import-state.service @22.431s +294ms<br \/>\n                                    ??local-fs.target @22.428s<br \/>\n                                      ??boot.mount @19.675s +2.126s<br \/>\n                                        ??dev-disk-by\\x2duuid-7de2053c\\x2d44d7\\x2d4f33\\x2db522\\x2d81dee2f6b69b.device @19.652s<br \/>\nSVG graphic image can be plot which contains detailing about system services start time, highlighting the time they spent on initialization. Make sure you have enabled graphical display mode or have x-windows enabled in order to see the plot.<\/p>\n<p># systemd-analyze plot > plot.svg<br \/>\n# eog plot.svg<br \/>\nHere is a snip from sample plot on my CentOS 7 machine. Zoom in to check the waterfall clearly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Question : My system is taking a lot of time to boot. How can I find out which services are taking long time to start?<\/p>\n<p>Answer :<\/p>\n<p>systemd-analyze command can be utilized to find out information about how much each service took to start. systemd-analyze time can provide overall information about how long it took [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6686"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6686"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6686\/revisions"}],"predecessor-version":[{"id":6687,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6686\/revisions\/6687"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}