0

I shifted from Windows 8 to ubuntu about 3 weeks ago. I have to experience very slow booting. I don't have a dual boot or something else. Plus I have tried to clean install ubuntu but nothing changed by it. My PC is Lenovo 15-ay542tu with 8gb ram and 1TB HDD.

Here is the output from systemd-analyze blame:

 53.630s plymouth-quit-wait.service                           
    23.830s systemd-journal-flush.service                        
    20.806s snapd.service                                        
    17.253s networkd-dispatcher.service                          
    16.563s dev-sda2.device                                      
    15.555s libvirtd.service                                     
    15.205s NetworkManager-wait-online.service                   
    13.684s apport-autoreport.service                            
    13.634s udisks2.service                                      
     9.339s accounts-daemon.service                              
     8.641s dev-loop17.device                                    
     8.478s dev-loop10.device                                    
     8.475s dev-loop15.device                                    
     8.475s dev-loop16.device                                    
     8.455s dev-loop19.device                                    
     8.448s dev-loop18.device                                    
     8.307s dev-loop20.device                                    
     7.500s dev-loop8.device                                     
     7.235s dev-loop4.device                                     
     7.195s ModemManager.service                                 
     7.123s dev-loop9.device                                     
     7.099s dev-loop12.device                                    
     6.948s dev-loop13.device                                    
     6.890s dev-loop14.device                                    
     6.876s polkit.service                                       
     6.808s dev-loop11.device                                    
     6.761s dev-loop7.device                                     
     6.580s avahi-daemon.service                                 
     6.578s bluetooth.service                                    
     6.500s NetworkManager.service                               
     6.303s dev-loop2.device                                     
     6.191s switcheroo-control.service                           
     6.179s thermald.service                                     
     6.176s systemd-logind.service                               
     6.173s systemd-machined.service                             
     6.156s wpa_supplicant.service                               
     6.132s fwupd.service                                        
     5.977s dev-loop3.device                                     
     5.957s dev-loop5.device                                     
     5.790s dev-loop1.device                                     
     5.749s dev-loop6.device                                     
     5.115s bolt.service                                         
     4.925s dev-loop0.device                                     
     4.382s ufw.service                                          
     4.002s systemd-resolved.service                             
     3.159s grub-common.service                                  
     2.911s grub-initrd-fallback.service                         
     2.840s gpu-manager.service                                  
     2.740s systemd-udevd.service                                
     2.406s gdm.service                                          
     2.168s apparmor.service                                     
     1.682s apport.service                                       
     1.654s rsyslog.service                                      
     1.529s motd-news.service                                    
     1.498s e2scrub_reap.service                                 
     1.294s snap-android\x2dstudio-91.mount                      
     1.261s snapd.apparmor.service                               
     1.228s snap-canonical\x2dlivepatch-95.mount                 
     1.227s snap-code-39.mount                                   
     1.195s snap-code-40.mount                                   
     1.152s snap-core-9665.mount                                 
     1.151s snap-core-9804.mount                                 
      964ms snap-core18-1880.mount                               
      886ms snap-core18-1885.mount                               
      864ms snap-discord-112.mount                               
      847ms systemd-tmpfiles-setup.service                       
      834ms systemd-fsck@dev-disk-by\x2duuid-7D17\x2d84A2.service
      833ms systemd-udev-trigger.service                         
      784ms systemd-sysctl.service                               
      753ms upower.service                                       
      748ms systemd-tmpfiles-setup-dev.service                   
      720ms snap-figma\x2dlinux-70.mount                         
      719ms snap-gnome\x2d3\x2d28\x2d1804-128.mount              
      654ms systemd-random-seed.service                          
      632ms snap-gnome\x2d3\x2d34\x2d1804-24.mount               
      599ms snap-gnome\x2d3\x2d34\x2d1804-36.mount               
      590ms systemd-journald.service                             
      572ms keyboard-setup.service                               
      551ms systemd-modules-load.service                         
      512ms swapfile.swap                                        
      500ms snap-gtk\x2dcommon\x2dthemes-1506.mount              
      499ms snap-intellij\x2didea\x2dcommunity-246.mount         
      497ms snap-snap\x2dstore-433.mount                         
      467ms snap-snap\x2dstore-467.mount                         
      451ms systemd-sysusers.service                             
      388ms libvirt-guests.service                               
      380ms plymouth-start.service                               
      369ms lm-sensors.service                                   
      367ms snapd.seeded.service                                 
      348ms systemd-rfkill.service                               
      331ms systemd-timesyncd.service                            
      297ms modprobe@drm.service                                 
      294ms qemu-kvm.service                                     
      253ms dev-hugepages.mount                                  
      252ms dev-mqueue.mount                                     
      251ms systemd-user-sessions.service                        
      251ms sys-kernel-debug.mount                               
      249ms sys-kernel-tracing.mount                             
      249ms kerneloops.service                                   
      247ms blk-availability.service                             
      235ms snap-snapcraft-5279.mount                            
      231ms kmod-static-nodes.service                            
      230ms lvm2-monitor.service                                 
      228ms geoclue.service                                      
      206ms user@1000.service                                    
      189ms plymouth-read-write.service                          
      188ms pppd-dns.service                                     
      186ms setvtrgb.service                                     
      185ms colord.service                                       
      184ms snap-snapd-8790.mount                                
      183ms boot-efi.mount                                       
      181ms snap-snapcraft-5308.mount                            
      179ms systemd-backlight@backlight:intel_backlight.service  
      153ms console-setup.service                                
      112ms systemd-update-utmp.service                          
      104ms snap-snapd-8542.mount                                
      103ms systemd-remount-fs.service                           
      102ms rtkit-daemon.service                                 
       88ms systemd-tmpfiles-clean.service                       
       82ms hddtemp.service                                      
       78ms alsa-restore.service                                 
       38ms user-runtime-dir@1000.service                        
       23ms systemd-update-utmp-runlevel.service                 
       20ms openvpn.service                                      
        7ms sys-fs-fuse-connections.mount                        
        4ms sys-kernel-config.mount                              
        3ms libvirtd.socket                                      
        1ms snapd.socket                                         
      585us clean-mount-point@media-parag-My\x20Files.service

Here is the output from systemd-analyze critical chain

The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

graphical.target @1min 31.593s └─multi-user.target @1min 31.593s └─libvirt-guests.service @53.289s +388ms └─libvirtd.service @37.692s +15.555s └─network.target @37.655s └─NetworkManager.service @31.155s +6.500s └─dbus.service @31.150s └─basic.target @30.972s └─sockets.target @30.972s └─libvirtd-ro.socket @30.972s └─libvirtd.socket @30.967s +3ms └─sysinit.target @30.781s └─systemd-timesyncd.service @30.449s +331ms └─systemd-tmpfiles-setup.service @29.579s +847ms └─systemd-journal-flush.service @5.748s +23.830s └─systemd-journald.service @5.156s +590ms └─systemd-journald.socket @5.149s └─system.slice @5.128s └─-.slice @5.128s

Here is the output from systemd-analyze

Startup finished in 15.485s (firmware) + 4.343s (loader) + 3.662s (kernel) + 1min 31.784s (userspace) = 1min 55.275s 
graphical.target reached after 1min 31.593s in userspace

Please suggest something, I don't know what to do.

Parag Katoch
  • 1,213

1 Answers1

1

Option 1: Tweak the settings of various services to improve the boot time

I'll give you some tips for systemd-journal-flush.service and libvirtd.service.

1. systemd-journal-flush.service:

One of the main culprits for your slow boot time is systemd-journal-flush.service.

Check to see the size of your journal:

journalctl --disk-usage

It's probably gotten really big for some reason.

You can verify how long it took to flush the journal with this:

journalctl -b --unit systemd-journald.service

You can reduce the size of your journal using the vacuum options, for example:

journalctl --vacuum-size=100M --vacuum-time=5d --vacuum-files=5

Then check your disk usage to see if journal has gotten smaller:

journalctl --disk-usage

You can make certain journal size limitations permanent:

Edit /etc/systemd/journald.conf to use auto as the Storage option and adjust the max file size, max number of files stored, or the maximum size of the journal (SystemMaxUse).

sudo nano /etc/systemd/journald.conf

For example, add these lines:

Storage=auto
SystemMaxUse=1G
SystemMaxFileSize=100M
SystemMaxFiles=5

See the definitions of these settings here.

2. Libvirtd

Another contributor to your long boot time is libvirtd.service, which is taking 15 seconds.

Are you using a virtual machine? If not, you could disable this service from starting at boot.

sudo systemctl disable libvirtd

You may also need to disable the guests:

sudo systemctl disable libvirt-guests

Option 2: Upgrade to an SSD

You are going to see a vast improvement in boot times by swapping out the 1 TB 5400 RPM hard drive with an SSD.

  • I get this on --disk-usuage
    "Archived and active journals take up 984.1M in the file system."

    and this on .service command "/run/log/journal/14e5cbd5a34b40e1a9ec194d13f7c7ef) is 8.0M, max 78.5M, 70.5M free. shing to /var/log/journal/14e5cbd5a34b40e1a9ec194d13f7c7ef is 20.148414s for 837 entries. var/log/journal/14e5cbd5a34b40e1a9ec194d13f7c7ef) is 976.1M, max 4.0G, 3.0G free."

    I use android studio so should I disable libvirtd ?

    – Parag Katoch Aug 20 '20 at 07:01
  • 1
    Go ahead and clean out the journal using the vacuum command. You could start out a little less aggressive, for example: journalctl –vacuum-size=500M. You could still try disabling libvirtd from automatically starting on boot, and then startlibvirtd when you need android studio, for example: sudo systemctl start libvirtd. – jksinton Aug 20 '20 at 11:36
  • I didn't saw much change on startup time 47.289s plymouth-quit-wait.service 16.859s apport-autoreport.service 15.857s snapd.service 13.820s NetworkManager-wait-online.service 13.183s networkd-dispatcher.service 12.114s dev-sda2.device 12.111s fwupd.service 8.771s udisks2.service 7.889s accounts-daemon.service – Parag Katoch Aug 20 '20 at 13:42
  • Try disabling NetworkManager-wait-online.service using this guide. – jksinton Aug 20 '20 at 14:05
  • When I disabled libvirtd, next boot process got interrupted. Ubuntu logo kept flashing forever. Reenabled it from recovery mode and boot was successful once more – Joseph Bani Aug 20 '22 at 10:03