Ubuntu 16.04慢启动(apt-daily.service)

我的靴子非常慢,我不知道为什么。

$ 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 

此外,在启动过程中,我看到一条消息,上面写着:

 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最慢减慢启动速度。 关于如何解决这个问题的任何想法?

我有Ubuntu MATE 16.04。

这是Debian bug#844453 。 apt-daily.service不应该在启动期间运行,而是在之后的一段时间内运行。

要解决此问题,请执行sudo systemctl edit apt-daily.timer并将以下文本粘贴到编辑器窗口中:

 # apt-daily timer configuration override [Timer] OnBootSec=15min OnUnitActiveSec=1d AccuracySec=1h RandomizedDelaySec=30min 

这会改变触发apt-daily.service的“计时器”, apt-daily.service在启动后15分钟到45分钟之间的随机时间运行,之后每天运行一次。 有关这意味着什么的其他(不是很好的,唉)解释,请参阅systemd.timer手册页 。

如果它是桌面,打开它并断开连接然后重新连接所有HDD电缆,包括MB。

如果做不到这一点,听起来你的硬盘超时了。 立即备份所有数据。

刻录Ubuntu的Live网络安装以适应您的系统,启动到尝试Ubuntu。 然后运行Gparted:默认情况下,它会检查HDD读取错误。 如果您备份了所有数据,也许其他人可以提供建议。

另一个答案解决了问题中的第二个文本块。

对我来说,要解决apt-daily.service永远的问题, 这个Ubuntu论坛post似乎已经奏效了。

发出这些命令作为如何编辑/etc/systemd/system.conf的示例

 sudo cp /etc/systemd/system.conf /etc/systemd/system.conf.bak 

这将成为安全的后盾。

 gksudo gedit /etc/systemd/system.conf 

寻找并更改这两行:

 #DefaultTimeoutStartSec=90s #DefaultTimeoutStopSec=90s 

我现在看起来像这样:

 DefaultTimeoutStartSec=10s DefaultTimeoutStopSec=10s 

一年来一直这样做,没有什么不好的。

删除禁用该行的前导# ,然后更改该值。