• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL 7 : systemd-analyze command to find booting time delays

by admin

Question : My system is taking a lot of time to boot. How can I find out which services are taking long time to start?

Answer :

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.

# systemd-analyze time
Startup finished in 1.267s (kernel) + 6.798s (initrd) + 1min 2.139s (userspace) = 1min 10.205s

To find out, how much time each unit took to start, run systemd-analyze blame.

# systemd-analyze blame
         24.728s dev-mapper-centosx2droot.device
         15.135s kdump.service
         14.670s plymouth-quit-wait.service
         14.210s firewalld.service
          9.835s accounts-daemon.service
          7.383s ModemManager.service
          7.259s libvirtd.service
          7.257s systemd-logind.service
          7.177s ksm.service
          7.081s gssproxy.service
          7.067s avahi-daemon.service
          7.062s rsyslog.service
          7.039s abrt-ccpp.service

As 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.

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.

# systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @1min 2.102s
└─multi-user.target @1min 2.102s
  └─abrt-vmcore.service @1min 1.228s +872ms
    └─kdump.service @46.090s +15.135s
      └─remote-fs.target @46.086s
        └─remote-fs-pre.target @46.083s
          └─iscsi-shutdown.service @45.951s +99ms
            └─network.target @45.944s
              └─network.service @44.959s +975ms
                └─NetworkManager.service @38.653s +689ms
                  └─firewalld.service @24.439s +14.210s
                    └─basic.target @23.850s
                      └─sockets.target @23.849s
                        └─cups.socket @23.847s
                          └─sysinit.target @23.618s
                            └─systemd-update-utmp.service @23.603s +13ms
                              └─auditd.service @22.959s +643ms
                                └─systemd-tmpfiles-setup.service @22.726s +230ms
                                  └─rhel-import-state.service @22.431s +294ms
                                    └─local-fs.target @22.428s
                                      └─boot.mount @19.675s +2.126s
                                        └─dev-disk-byx2duuid-7de2053cx2d44d7x2d4f33x2db522x2d81dee2f6b69b.device @19.652s

SVG 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.

# systemd-analyze plot > plot.svg
# eog plot.svg

Here is a snip from sample plot on my CentOS 7 machine. Zoom in to check the waterfall clearly.

systemd-analyze plot

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to backup/restore configuration using authconfig
  2. Linux OS Service ‘network’
  3. How To Force User/Group Ownership Of Files On A Samba Share
  4. cryptcat Command Examples in Linux
  5. nmap Command Examples in Linux
  6. How to Count lines in a file in UNIX/Linux
  7. Error: Can’t open display: hostname:x.y when running xclock
  8. How to Configure Automatic Package Updates on the Server in CentOS/RHEL 8
  9. gnome-screenshot: command not found
  10. CentOS / RHEL 7 : How to setup yum repository using locally mounted DVD

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright