How to speed up boot time on lubuntu
Solution 1
In addition to cmak.fr
I looked into What is the use of systemd-journal-flush.service?
sudo nano /etc/systemd/journald.conf
In the journal section uncomment and alter:
Storage=auto
SystemMaxFileSize=1G
SystemMaxFiles=5
Save & reboot.
keyboard-setup.service taking too long in startup (20+sec)
sudo gedit /lib/systemd/system/keyboard-setup.service
changed
TimeoutStartSec=10sec
Ubuntu 15.04 network manager causing slow boot
sudo nano /lib/systemd/system/NetworkManager-wait-online.service
edit from 30 to 15
[Service]
Type=oneshot
ExecStart=/usr/bin/nm-online -s -q --timeout=30
sudo update-grub
Now
$ systemd-analyze critical-chain
graphical.target @59.292s
└─multi-user.target @59.291s
└─kerneloops.service @59.278s +12ms
└─network-online.target @59.277s
└─NetworkManager-wait-online.service @52.596s +6.681s
└─NetworkManager.service @45.820s +6.773s
└─dbus.service @45.792s
└─basic.target @45.790s
└─sockets.target @45.790s
└─snapd.socket @45.745s +44ms
└─sysinit.target @45.743s
└─swap.target @45.543s
└─dev-disk-by\x2duuid-f01c80a9\x2d4d4b\x2d4e60\x2dbeb0\x2d
└─dev-disk-by\x2duuid-f01c80a9\x2d4d4b\x2d4e60\x2dbeb0\x
and
$ systemd-analyze time
Startup finished in 4.770s (kernel) + 59.301s (userspace) = 1min 4.072s
graphical.target reached after 59.292s in userspace
From 7min 13.089s
to 1min 4.072s
a huge improvement, if anyone has any more improvements that I am not aware of please do share.
Solution 2
1. Journal size limit
The time consuming systemd-journal-flush.service
can be tweaked by a journal size limit.
Edit the Journal config file
sudo nano /etc/systemd/journald.conf
# uncomment and configure the value
SystemMaxUse=50M
# personnaly i use 2M ;)
# Then restart the journald service
sudo systemctl restart systemd-journald
1.1 Journal clean up
sudo journalctl --rotate
sudo journalctl --vacuum-time=1s
For information, the journal size is given by this command:
journalctl --disk-usage
2. Startup applications
Another step to speed up userspace load delay is to disable some startup applications
See how to show all of them : https://help.ubuntu.com/community/ShowHiddenStartupApplications
sudo sed -i "s/NoDisplay=true/NoDisplay=false/g" /etc/xdg/autostart/*.desktop
See how to open the Startup Applications applet : https://help.ubuntu.com/stable/ubuntu-help/startup-applications.html
gnome-session-properties
If you dont mind, disabling Backup Monitor
and Updates Notifier
will save boot time.
Solution 3
Here's my contribution to this little Show & Tell:
$ systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.
graphical.target @2.490s
└─multi-user.target @2.489s
└─snapd.service @1min 34.450s +153ms
└─basic.target @2.227s
└─sockets.target @2.226s
└─snapd.socket @2.205s +13ms
└─sysinit.target @2.197s
└─systemd-update-utmp.service @2.136s +54ms
└─systemd-tmpfiles-setup.service @2.116s +9ms
└─local-fs.target @2.108s
└─run-user-1000-gvfs.mount @1min 26.644s
└─run-user-1000.mount @1min 25.977s
└─local-fs-pre.target @192ms
└─systemd-remount-fs.service @172ms +10ms
└─systemd-fsck-root.service @110ms +39ms
└─systemd-fsckd.socket @109ms
└─-.slice @81ms
Compare this 2.49 seconds to SDC's answer of 59.29 seconds which has extra time consuming features I've removed from my boot-up:
└─kerneloops.service @59.278s +12ms
└─network-online.target @59.277s
└─NetworkManager-wait-online.service @52.596s +6.681s
└─NetworkManager.service @45.820s +6.773s
└─dbus.service @45.792s
└─snapd.socket @45.745s +44ms
└─swap.target @45.543s
└─dev-disk-by\x2duuid-f01c80a9\x2d4d4b\x2d4e60\x2dbeb0\x2d
└─dev-disk-by\x2duuid-f01c80a9\x2d4d4b\x2d4e60\x2dbeb0\x
Key features:
- Remove Network Manager Wait from startup.
- Remove snapd Refresh Service from startup.
Systemd Journal Control enhancements
$ cat /etc/systemd/journald.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See journald.conf(5) for details.
[Journal]
#Storage=auto
# Aug 4 2018 - recommended: https://www.freedesktop.org/software/systemd/man/journald.conf.html
storage=persistent
The notable details are in bold.
Because journalctl
files are not longer flushed at startup I have them setup to be vacuumed once a month:
Often I want to know what happened when the system crashed and I had to reboot. By default journalctl
files don't show you the previous boots though. So I turned on multi-boot history:
That's all for today. I'll try to remember to update this answer going forward.
Related videos on Youtube
Santhosh Dhaipule Chandrakanth
Updated on September 18, 2022Comments
-
Santhosh Dhaipule Chandrakanth over 1 year
New to linux and ubuntu. I have shared my laptop info. Boot up time is sooooo slowwwww. Even lauch of firefox takes long time.
Can anyone help me figure out how to optimize my system?
Using Lubuntu (Ubuntu Version)
Command
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic
Command
$ sudo lshw -short H/W path Device Class Description ====================================================== system Aspire A515-51G (0000000000000000) /0 bus Charmander_KL /0/0 memory 128KiB BIOS /0/4 processor Intel(R) Core(TM) i5-8250U CPU @ 1.60 /0/4/5 memory 256KiB L1 cache /0/4/6 memory 1MiB L2 cache /0/4/7 memory 6MiB L3 cache /0/d memory 4GiB System Memory /0/d/0 memory 4GiB SODIMM DDR4 Synchronous Unbuffer /0/d/1 memory [empty] /0/100 bridge Xeon E3-1200 v6/7th Gen Core Processo /0/100/2 display UHD Graphics 620 /0/100/14 bus Sunrise Point-LP USB 3.0 xHCI Control /0/100/14/0 usb1 bus xHCI Host Controller /0/100/14/0/5 communication Bluetooth wireless interface /0/100/14/0/7 multimedia HD WebCam /0/100/14/1 usb2 bus xHCI Host Controller /0/100/15 generic Sunrise Point-LP Serial IO I2C Contro /0/100/15.1 generic Sunrise Point-LP Serial IO I2C Contro /0/100/16 communication Sunrise Point-LP CSME HECI #1 /0/100/17 storage Sunrise Point-LP SATA Controller [AHC /0/100/1c bridge Sunrise Point-LP PCI Express Root Por /0/100/1c/0 display GP108M [GeForce MX150] /0/100/1c.4 bridge Sunrise Point-LP PCI Express Root Por /0/100/1c.4/0 generic RTL8411B PCI Express Card Reader /0/100/1c.4/0.1 enp2s0f1 network RTL8111/8168/8411 PCI Express Gigabit /0/100/1c.5 bridge Sunrise Point-LP PCI Express Root Por /0/100/1c.5/0 wlp3s0 network Dual Band Wireless-AC 3168NGW [Stone /0/100/1f bridge Intel(R) 100 Series Chipset Family LP /0/100/1f.2 memory Memory controller /0/100/1f.3 multimedia Sunrise Point-LP HD Audio /0/100/1f.4 bus Sunrise Point-LP SMBus /0/1 scsi0 storage /0/1/0.0.0 /dev/sda disk 1TB WDC WD10SPZX-21Z /0/1/0.0.0/1 /dev/sda1 volume 927GiB EXT4 volume /0/1/0.0.0/2 /dev/sda2 volume 3970MiB Extended partition /0/1/0.0.0/2/5 /dev/sda5 volume 3970MiB Linux swap volume
Used this command
$ systemd-analyze critical-chain The time after the unit is active or started is printed after the "@" character. The time the unit takes to start is printed after the "+" character. graphical.target @1min 6.870s └─multi-user.target @1min 6.870s └─kerneloops.service @1min 6.842s +26ms └─network-online.target @1min 6.836s └─NetworkManager-wait-online.service @58.305s +8.529s └─NetworkManager.service @48.794s +9.507s └─dbus.service @48.775s └─basic.target @48.690s └─sockets.target @48.690s └─snapd.socket @48.620s +69ms └─sysinit.target @48.618s └─systemd-timesyncd.service @48.458s +159ms └─systemd-tmpfiles-setup.service @47.215s +1.185s └─systemd-journal-flush.service @5.764s +41.448s └─systemd-remount-fs.service @4.325s +1.438s └─systemd-journald.socket @4.229s └─system.slice @4.229s └─-.slice @4.170s
Saw this post Can we talk about the boot time on Ubuntu 18.04?
Ran
$ systemd-analyze time Startup finished in 4.907s (kernel) + 7min 8.181s (userspace) = 7min 13.089s graphical.target reached after 1min 6.870s in userspace
Ran
$ service --status-all | grep '+' | wc -l 27
-
Santhosh Dhaipule Chandrakanth almost 5 years
SystemMaxUse=
1 Min 27 Sec,SystemMaxUse=5M
1 Min 24 Sec andSystemMaxUse=50M
1 Min 24 Sec -
Rinzwind almost 5 yearsMind adding what the hardware specs are? make, model. cpu and harddisk should be enough. I have a HP omen with SSD as boot. Startup finished in 4.734s (firmware) + 454ms (loader) + 2.071s (kernel) + 2.998s (userspace) = 10.258s. Now adding your tweaks. Be right back :D
-
Rinzwind almost 5 yearsThat got bad D: Startup finished in 5.863s (firmware) + 471ms (loader) + 2.080s (kernel) + 17.499s (userspace) = 25.916s graphical.target reached after 2.732s in userspace. Hmmm :P
-
Rinzwind almost 5 yearsah! the software updater was the cause. Startup finished in 4.751s (firmware) + 453ms (loader) + 1.955s (kernel) + 2.793s (userspace) = 9.953s graphical.target reached after 2.788s in userspace. I LOVE YOU :=D Keyboard did not have a delay in it so only the other 2 used.
-
Rinzwind almost 5 yearsdid #1. No startup apps I can nuke (only have lidclose). Startup finished in 4.889s (firmware) + 445ms (loader) + 2.018s (kernel) + 2.751s (userspace) = 10.105s. graphical.target reached after 2.746s in userspace. Better on g.t so me happy :) :) +1!
-
WinEunuuchs2Unix almost 5 yearsYour
dev-disk-by
entries are truncated and we can't see the time they are taking up. -
Santhosh Dhaipule Chandrakanth almost 5 years@Rinzwind Acer Aspire 5
-
Santhosh Dhaipule Chandrakanth almost 5 years
systemctl list-dependencies graphical.target
list few services includingmulti-user.target
, this in turn has100
services aslist-dependencies
😱 both taking same time59.292s
will investigate further on how i can reduce these as well in my free time