Score:2

Ubuntu slow boot and practical freeze for about 5-10 minutes, then it works correctly

us flag

I've been using Ubuntu for a while, for some reason, though, from some point on, it started to boot very slowly, about 2 minutes. Systemd-analyze output is:

Startup finished in 7.911s (firmware) + 5.078s (loader) + 6.034s (kernel) + 1min 28.681s (userspace) = 1min 47.704s 
graphical.target reached after 1min 2.054s in userspace

Systemd-analyze blame is:

1min 2.056s man-db.service                                                           
35.463s udisks2.service                                                          
25.140s NetworkManager-wait-online.service                                       
16.481s networkd-dispatcher.service                                              
12.920s dev-sda6.device                                                          
12.440s accounts-daemon.service                                                  
11.782s systemd-journal-flush.service                                            
11.096s logrotate.service                                                        
 9.849s ModemManager.service                                                     
 8.955s polkit.service                                                           
 8.374s snapd.service                                                            
 8.130s avahi-daemon.service                                                     
 8.128s bluetooth.service                                                        
 8.114s NetworkManager.service                                                   
 8.018s iio-sensor-proxy.service                                                 
 7.410s switcheroo-control.service                                               
 7.400s systemd-logind.service                                                   
 7.397s thermald.service                                                         
 6.710s wpa_supplicant.service                                                   
 6.115s snapd.seeded.service                                                     
 5.476s [email protected]                                                        
 5.302s dev-loop3.device                                                         
 5.249s mnt-84D85686D8567700.mount                                               
 4.658s dev-loop8.device                                                         
 4.651s gdm.service                                                              
 4.218s dev-loop7.device                                                         
 3.913s grub-common.service                                                      
 3.885s dev-loop4.device                                                         
 3.694s gpu-manager.service                                                      
 3.506s tlp.service                                                              
 3.332s dev-loop6.device                                                         
 3.289s dev-loop5.device                                                         
 3.222s dev-loop0.device                                                         
 3.043s dev-loop2.device                                                         
 3.019s dev-loop1.device                                                         
 2.916s cpufreqd.service                                                         
 2.729s loadcpufreq.service                                                      
 2.674s apt-daily-upgrade.service                                                
 2.649s apport.service                                                           
 2.298s upower.service                                                           
 2.245s fwupd.service                                                            
 2.199s apparmor.service                                                         
 2.109s systemd-fsck@dev-disk-by\x2duuid-DCCD\x2d34F3.service                    
 2.046s preload.service                                                          
 1.884s secureboot-db.service                                                    
 1.866s systemd-tmpfiles-setup.service                                           
 1.677s lm-sensors.service                                                       
 1.606s mnt-82B0CEE6B0CEE031.mount                                               
 1.586s rsyslog.service                                                          
 1.458s systemd-resolved.service                                                 
 1.445s systemd-udevd.service                                                    
 1.423s e2scrub_reap.service                                                     
 1.423s fstrim.service                                                           
 1.265s snap-core-11606.mount                                                    
 1.163s snap-chromium-1732.mount                                                 
 1.148s snapd.apparmor.service                                                   
 1.127s systemd-sysctl.service                                                   
 1.115s systemd-modules-load.service                                             
 1.005s grub-initrd-fallback.service                                             
  995ms snap-auto\x2dcpufreq-71.mount                                            
  964ms snap-gtk\x2dcommon\x2dthemes-1515.mount                                  
  959ms systemd-backlight@backlight:intel_backlight.service                      
  954ms systemd-random-seed.service                                              
  929ms snap-core20-1081.mount                                                   
  929ms kerneloops.service                                                       
  914ms binfmt-support.service                                                   
  873ms keyboard-setup.service                                                   
  872ms [email protected]                                            
  845ms setvtrgb.service                                                         
  797ms snap-gnome\x2d3\x2d28\x2d1804-161.mount                                  
  788ms snap-jdownloader2-17.mount                                               
  762ms pppd-dns.service                                                         
  753ms systemd-tmpfiles-setup-dev.service                                       
  686ms snap-core18-2128.mount                                                   
  667ms openvpn.service                                                          
  642ms systemd-user-sessions.service                                            
  618ms systemd-sysusers.service                                                 
  564ms colord.service                                                           
  520ms boot-efi.mount                                                           
  492ms snap-snapd-12883.mount                                                   
  471ms systemd-udev-trigger.service                                             
  443ms hddtemp.service                                                          
  377ms ufw.service                                                              
  330ms dev-disk-by\x2duuid-21455d02\x2d8efb\x2d4566\x2d8474\x2d74ed32541dc7.swap
  310ms systemd-journald.service                                                 
  281ms systemd-timesyncd.service                                                
  265ms apport-autoreport.service                                                
  245ms dev-mqueue.mount                                                         
  245ms sys-kernel-debug.mount                                                   
  244ms sys-kernel-tracing.mount                                                 
  244ms dev-hugepages.mount                                                      
  238ms kmod-static-nodes.service                                                
  237ms [email protected]                                                     
  225ms systemd-remount-fs.service                                               
  187ms console-setup.service                                                    
  183ms proc-sys-fs-binfmt_misc.mount                                            
  166ms [email protected]                                                       
  156ms systemd-backlight@leds:dell::kbd_backlight.service                       
  109ms systemd-update-utmp.service                                              
   87ms snapd.socket                                                             
   34ms snap-auto\x2dcpufreq-72.mount                                            
   27ms snap-snapd-13170.mount                                                   
   23ms alsa-restore.service                                                     
   20ms sys-fs-fuse-connections.mount                                            
   20ms sys-kernel-config.mount                                                  
   17ms plymouth-read-write.service                                              
   17ms [email protected]                                           
   14ms systemd-tmpfiles-clean.service                                           
   11ms cpufrequtils.service                                                     
    9ms systemd-update-utmp-runlevel.service                                     
    8ms dev-loop10.device                                                        
    2ms rtkit-daemon.service                                                     
    2ms dev-loop9.device                                                         
    2ms e2scrub_all.service                                                      
    1ms plymouth-quit-wait.service                                               
  289us clean-mount-point@media-j-Seagate\x20Expansion.service        

Systemd-analyze critical chain:

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 2.054s
└─udisks2.service @26.590s +35.463s
  └─basic.target @25.113s
    └─sockets.target @25.108s
      └─snapd.socket @25.011s +87ms
        └─sysinit.target @24.746s
          └─snapd.apparmor.service @23.595s +1.148s
            └─apparmor.service @21.394s +2.199s
              └─local-fs.target @21.392s
                └─run-user-1000-gvfs.mount @1min 11.515s
                  └─run-user-1000.mount @58.284s
                    └─swap.target @19.048s
                      └─dev-disk-by\x2duuid-21455d02\x2d8efb\x2d4566\x2d8474\x2d74ed32541dc7.s>
                        └─dev-sda7.device @18.715s

Even so, the slow boot isn't the worst problem. The worst problem is that, after booting, it takes about five minutes to actually be usable. It's laggy, it freezes, it takes ages to open a program, and when it opens, let's say Firefox, it lags, it says 'Firefox is frozen, do you want to wait or force close?' if open two tabs or so. Then the updater, which takes minutes to open, appears, and after a while it starts to function normally and pretty fast. Any ideas? Could it be the updater running? How can I disable it and open it when I want? Thanks. This is my neofetch:

j@j-Inspiron-17-7779
--------------------
OS: Ubuntu 20.04.3 LTS x86_64
Host: Inspiron 17-7779
Kernel: 5.11.0-27-generic
Uptime: 24 mins
Packages: 2424 (dpkg), 17 (flatpak), 10 (snap)
Shell: bash 5.0.17
Resolution: 1920x1080
DE: GNOME
WM: Mutter
WM Theme: Adwaita
Theme: Yaru-light [GTK2/3]
Icons: Yaru [GTK2/3]
Terminal: gnome-terminal
CPU: Intel i7-7500U (4) @ 3.500 GHz
GPU: NVIDIA GeForce 940MX
GPU: Intel HD Graphics 620
Memory: 3414MiB / 15880MiB

Disks: [![Partition 3 and 4 were mounted at startup. I'll quit 3 since I don't want it anymore mounted, but 4 is for files so I need it mounted at start-up.][1]][1]

cat /etc/fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda6 during installation
UUID=0523d920-7cab-41b3-a0c0-341c5de2fce1 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=DCCD-34F3  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/sda7 during installation
UUID=21455d02-8efb-4566-8474-74ed32541dc7 none            swap    sw              0       0
/dev/disk/by-uuid/82B0CEE6B0CEE031 /mnt/82B0CEE6B0CEE031 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Windows 0 0
/dev/disk/by-uuid/84D85686D8567700 /mnt/84D85686D8567700 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Datos 0 0

free -h:

              total        used        free      shared  buff/cache   available
Mem:           15Gi       2,9Gi       2,8Gi       646Mi       9,7Gi        11Gi
Swap:         3,3Gi          0B       3,3Gi

swapon -s:

Filename                Type        Size    Used    Priority
/dev/sda7                               partition   3458044 0   -2
j@j-Inspiron-17-7779:~$ 

After unmounting at start:

j@j-Inspiron-17-7779:~$ systemd-analyze blame
29.376s udisks2.service                                                          
26.747s systemd-journal-flush.service                                            
18.215s snapd.service                                                            
18.054s networkd-dispatcher.service                                              
16.949s NetworkManager-wait-online.service                                       
13.361s apport-autoreport.service                                                
11.996s dev-sda6.device                                                          
11.744s accounts-daemon.service                                                  
 8.674s polkit.service                                                           
 7.918s avahi-daemon.service                                                     
 7.915s bluetooth.service                                                        
 7.897s NetworkManager.service                                                   
 7.814s iio-sensor-proxy.service                                                 
 6.968s [email protected]                                                        
 6.842s switcheroo-control.service                                               
 6.829s systemd-logind.service                                                   
 6.828s thermald.service                                                         
 6.162s wpa_supplicant.service                                                   
 4.966s dev-loop3.device                                                         
 4.796s cpufreqd.service                                                         
 4.760s dev-loop9.device                                                         
 4.675s tlp.service                                                              
 4.503s dev-loop8.device                                                         
 4.453s gpu-manager.service                                                      
 4.124s secureboot-db.service                                                    
 3.996s loadcpufreq.service                                                      
 3.869s dev-loop2.device                                                         
 3.694s dev-loop7.device                                                         
 3.488s gdm.service                                                              
 3.461s dev-loop6.device                                                         
 3.445s dev-loop5.device                                                         
 3.444s dev-loop4.device                                                         
 3.162s grub-common.service                                                      
 3.147s apport.service                                                           

j@j-Inspiron-17-7779:~$ systemd-analyze
Startup finished in 7.798s (firmware) + 5.318s (loader) + 6.766s (kernel) + 1min 16.122s (userspace) = 1min 36.005s 
graphical.target reached after 1min 8.645s in userspace

I'm thinking it might be the snaps? For comparison, I've just tried copying over 3.3 GB in Ubuntu... it went at about 2 MBps and took about 10 minutes. The same thing in Linux Mint, and it took 1 minute, at 30 MBps...

So I'm honestly pretty confused, I think I won't touch it or I'll reinstall it in any case.

After mounting as instructed:

j@j-Inspiron-17-7779:~$ systemd-analyze
Startup finished in 7.881s (firmware) + 4.504s (loader) + 6.694s (kernel) + 57.510s (userspace) = 1min 16.589s 
graphical.target reached after 54.163s in userspace
j@j-Inspiron-17-7779:~$ systemd-analyze blame
25.849s snapd.service                                                            
25.055s udisks2.service                                                          
15.271s NetworkManager-wait-online.service                                       
13.105s dev-sda6.device                                                          
10.788s [email protected]                                                        
10.720s systemd-journal-flush.service                                            
 9.544s networkd-dispatcher.service                                              
 8.785s accounts-daemon.service                                                  
 8.559s apport-autoreport.service                                                
 6.585s polkit.service                                                           
 6.387s NetworkManager.service                                                   
 6.205s avahi-daemon.service                                                     
 6.200s bluetooth.service                                                        
 5.696s iio-sensor-proxy.service                                                 
 5.676s dev-loop4.device                                                         
 5.186s dev-loop8.device                                                         
 5.067s switcheroo-control.service                                               
 5.047s systemd-logind.service                                                   
 5.037s thermald.service                                                         
 4.772s wpa_supplicant.service                                                   
 4.504s dev-loop9.device                                                         
 4.215s dev-loop6.device                                                         
 3.966s systemd-tmpfiles-setup.service                                           
 3.835s gpu-manager.service                                                      
 3.801s gdm.service                                                              
 3.777s dev-loop3.device                                                         
 3.635s dev-loop7.device                                                         
 3.576s dev-loop1.device                                                         
 3.563s dev-loop2.device                                                         
 3.334s dev-loop5.device                                                         
 3.075s dev-loop0.device                                                         
 2.948s cpufreqd.service                                                         
 2.681s secureboot-db.service                                                    
 2.467s loadcpufreq.service     
heynnema avatar
ru flag
Are you mounting some external/network disks in /etc/fstab? Edit your question and show me `cat /etc/fstab` and `free -h` and `swapon -s`.
Juan M avatar
us flag
I've got two NTFS partitions mounted at startup. Though I'll quit one since I no longer need it mounted (dev/sda/3). Partition 4 will stay as it's there for files that I can use between Windows and Linux partitions. Then there's the swap (7) and of course /boot/efi at (1). And I've listed the output of those commands.
heynnema avatar
ru flag
Temporarily comment out the two NTFS mounts in /etc/fstab, reboot, and see if the problem is gone.
Juan M avatar
us flag
Well, seems like at least the freezing problem is gone. Added systemd and blame after the changes. So I simply... can't mount at start?
heynnema avatar
ru flag
Change your mounts to a variation of this... "UUID=xxxxxxxxxxxxx /media/username/Shared_Data ntfs-3g defaults 0 0". Report back.
Juan M avatar
us flag
Boot time has gone down (I added the new systemd-analyze to the post) and it's definitely not frozen at all. Seems to have solved that at least, thank you very much!
heynnema avatar
ru flag
@Raffa OP is mounting local NTFS partitions, not NFS Shares.
Raffa avatar
jp flag
Related: 1) https://askubuntu.com/a/1166492/968501 and 2) https://askubuntu.com/a/1182196
Juan M avatar
us flag
Those worked to reduce boot time by around 20 seconds, thank you! I think the next culprit is also snapd, but since I ned chromium for chromium-webdriver and auto-cpufreq, guess I'll have to leave it there. Thank you.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.