4

So i have Ubuntu 22.04.2 LTS installed on my laptop. It takes more than 2 mins to bootup which seems too much for me. When i had installed Ubuntu on my machine a couple of months ago it didnt take this much time. Here are the logs generated by "systemd-analyze" and "system-analyze blame" respectively

isaac@Isaac-Lenovo-IdeaPad-S145-15AST:~$ systemd-analyze 

Startup finished in 4.979s (firmware) + 8.472s (loader) + 4.847s (kernel) + 1min 59.732s (userspace) = 2min 18.032s graphical.target reached after 1min 59.606s in userspace

isaac@Isaac-Lenovo-IdeaPad-S145-15AST:~$ systemd-analyze blame

1min 22.046s fstrim.service

 57.290s plymouth-quit-wait.service
 37.756s systemd-journal-flush.service
 33.487s dev-mapper-vgubuntu\x2droot.device
 31.672s apt-daily.service
 26.775s snapd.service
 23.608s logrotate.service
 21.060s networkd-dispatcher.service
 20.841s snap-bare-5.mount
 19.967s snap-core18-2714.mount
 19.579s NetworkManager-wait-online.service
 19.316s snap-core18-2721.mount
 18.666s udisks2.service
 18.013s snap-core20-1778.mount
 16.502s snap-core20-1852.mount
 13.452s snap-core22-583.mount
 13.435s ModemManager.service
 13.344s accounts-daemon.service
 13.160s dev-loop28.device
 13.022s dev-loop19.device
 12.719s dev-loop18.device
 12.715s dev-loop23.device
 12.713s dev-loop26.device

Also here are my specs

CPU : AMD® A6-9225 radeon r4, 5 compute cores 2c+3g × 2
GPU : No external. iGPU (STONEY (stoney, LLVM 15.0.6, DRM 3.42, 5.15.0-69-generic))
HDD : 1TB
RAM : 4GB 
OS  : Ubuntu 22.04.2 LTS (64 bit)
SSD : No SSD

So is there any solution to this problem? Also is there any fault in my system or do i just need to upgrade my hardware...?

[Solved] Thanks to @Archisman Panigrahi i was able to remove all the snap apps and the snap itself which decreased my bootup time at a noticable degree. Here are the logs after removing snap

isaac@Isaac-Lenovo-IdeaPad-S145-15AST:~$ systemd-analyze

Startup finished in 5.810s (firmware) + 5.990s (loader) + 5.145s (kernel) + 1min 35.600s (userspace) = 1min 52.547s
graphical.target reached after 1min 35.524s in userspace

isaac@Isaac-Lenovo-IdeaPad-S145-15AST:~$ systemd-analyze blame

49.362s plymouth-quit-wait.service
31.030s systemd-journal-flush.service
23.653s dev-mapper-vgubuntu\x2droot.device
17.721s systemd-udevd.service
16.684s networkd-dispatcher.service
15.613s NetworkManager-wait-online.service
13.481s udisks2.service
10.818s accounts-daemon.service
 8.654s ModemManager.service
 7.616s power-profiles-daemon.service
 7.567s polkit.service
 7.249s cups.service
 7.019s gdm.service
 6.680s NetworkManager.service
 6.674s bluetooth.service
 6.170s switcheroo-control.service
 6.134s thermald.service
 6.133s systemd-logind.service
 5.845s wpa_supplicant.service
 4.695s systemd-resolved.service
 3.518s rsyslog.service
 3.078s apparmor.service
 2.785s e2scrub_reap.service

  • 3
    HDDs are slow to boot from, get an SSD. – mikewhatever Apr 30 '23 at 20:25
  • 1
    Some settings to review, and more links to additional suggestions. https://askubuntu.com/questions/1284302/is-it-possible-to-make-ubuntu-20-04-boot-faster I find Kubuntu a bit faster, but still has everything I want. And SSD does make a huge difference. They are not as expensive anymore and you still can use an HDD for backup or data. – oldfred Apr 30 '23 at 21:09
  • A combination of only 4GB RAM and a slow hard disk. – popey Apr 30 '23 at 21:37
  • A previous comment I made had my server booting at 2 minutes 43 seconds. But following through and removing unnecessary snaps (like in the answer below) from the system I was able to cut down the boot time of my server with HDDs only to 1 minute 28 seconds. – Terrance May 01 '23 at 00:45
  • Old HD so why is fstrim. service active? – nobody May 01 '23 at 07:04
  • @nobody dont know why fstrim.service was active before. Though after removing snap i cant find it in the logs generated by 'systemd-analyze blame'. Feeling kinda weird... – Tenkyless May 01 '23 at 08:34
  • @Tenkyless Can you check out the updated answer, and confirm if removing the log files as I described helps to speed up? – Archisman Panigrahi May 01 '23 at 17:45
  • @ArchismanPanigrahi well i did. I didnt see any change in my bootup time. Its still around 1 min 55 sec ( 1 min 56.22s to be exact ). But i did see some noticeable change in my 'systemd-analyze blame' log. Dont know why my bootup time didnt change though. I can upload the logs if you want. – Tenkyless May 03 '23 at 03:58
  • 1
    @Tenkyless I don't think the boot speed can be improved any further (unless you disable important system services which you may not use). You don't have to upload new logs. – Archisman Panigrahi May 03 '23 at 06:36
  • @ArchismanPanigrahi ahh i see... Also is there a possibility that my fstab file is causing the bootup issue..? Except for the /boot/efi no other mount point have any UUID associated with them... Also my fstab looks kinda messed up compared to others.... – Tenkyless May 03 '23 at 07:21
  • @Tenkyless You can ask a new question about fstab – Archisman Panigrahi May 04 '23 at 03:03

1 Answers1

6

The logs say that snap events take a lot of time in boot. I too have personally experienced this issue in older computers with HDDs, where removing snap improved the boot speed considerably. Replace all snap apps with apt apps, and uninstall snapd.

Here is how to replace Firefox snap, if you use Firefox, and here is how to remove snapd altogether.


You can also disable apt-daily.service (then you will have to regularly check for updates manually, and keep your system updated).

sudo systemctl disable apt-daily.service

Also, systemd-journal-flush.service is taking a lot of time. So, clearing the systemd logs can speed up the boot process further.

sudo journalctl --flush --rotate
sudo journalctl --vacuum-size=20M

You can also safely disable NetworkManager-wait-online.service

sudo systemctl disable NetworkManager-wait-online.service
Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212
  • Great answer here! +1 However, it is yucky that Canonical Livepatch is only available via Snap. Grrrr!! But removing all the other garbage like the Snap Firefox, etc I was able to cut the boot time of my server by over half! :) – Terrance May 01 '23 at 00:47
  • OP seems to be using an old Ideapad. It is unlikely that they would need livepatch. – Archisman Panigrahi May 01 '23 at 01:16
  • 1
    My point being is that I really dislike snaps, but Canonical is making this tough on those of us that prefer LTS releases but don't want to reboot servers as often. – Terrance May 01 '23 at 01:25