Ubuntu – Ubuntu 16.04 slow boot (apt-daily.service)


My boot is horribly slow, and I don't know why.

$ systemd-analyze 
Startup finished in 10.975s (kernel) + 49.732s (userspace) = 1min 708ms
$ systemd-analyze blame 
         34.971s apt-daily.service
         20.590s snapd.refresh.service
         17.113s grub-common.service
         16.033s apport.service
         16.027s networking.service
         15.894s ondemand.service
         15.860s irqbalance.service
         15.655s speech-dispatcher.service
         11.695s ModemManager.service
          9.772s accounts-daemon.service
          8.626s NetworkManager-wait-online.service
          8.058s systemd-logind.service
          8.053s bluetooth.service
          7.944s gpu-manager.service
          7.896s alsa-restore.service
          7.892s pppd-dns.service
          7.882s rsyslog.service
          7.860s avahi-daemon.service
          7.844s dev-sda1.device
          7.842s systemd-user-sessions.service
          7.648s lightdm.service
          7.610s teamviewerd.service
          6.445s apparmor.service

Also, during boot-up, I see a message that says something like:

device descriptor read/all, error -62
ata1 softreset failed (device not ready) #most of the times
error loading journal #(sometimes)
Test WP failed, assume Write Enabled
Asking for cache data failed     #most of the times
Assuming drive cache: write through

apt-daily.service slows the boot the most. Any idea on how to tackle that?

I have Ubuntu MATE 16.04.

Best Answer

This is Debian bug #844453. apt-daily.service shouldn't be run during boot, but only some time afterward.

As a workaround, do sudo systemctl edit apt-daily.timer and paste the following text into the editor window:

# apt-daily timer configuration override

This changes the "timer" that triggers apt-daily.service to run at a random time between 15 min and 45 min after boot, and once a day thereafter. See the systemd.timer manpage for additional (not very well written, alas) explanation of what this means.