Improving my Boot Time in Arch Linux
I was investigating and issue with duplicity when I stumbled with systemd-analyze.
So I started to see what was contributing for my boot time and after that I started too see how to improved.
This is by no means a guide, but just what I changed to improve.
You can use sudo systemd-analyze blame to see load time for every programs that loads at boot time and sudo systemd-analyze critical-chain to basically see the critical programs that you could focus on.
The results, or how you interpret them depends on your system and what you need to load.
My critical-chain (before)
1sudo systemd-analyze critical-chain
1The time when unit became active or started is printed after the "@" character.
2The time the unit took to start is printed after the "+" character.
3
4graphical.target @19.908s
5└─multi-user.target @19.908s
6 └─cups-browsed.service @19.908s
7 └─org.cups.cupsd.service @19.606s +299ms
8 └─network-online.target @19.598s
9 └─network.target @19.597s
10 └─dhcpcd@eno1.service @2.841s +16.755s
11 └─basic.target @2.828s
12 └─sockets.target @2.827s
13 └─snapd.socket @2.826s +792us
14 └─sysinit.target @2.820s
15 └─systemd-timesyncd.service @2.321s +498ms
16 └─systemd-tmpfiles-setup.service @2.210s +48ms
17 └─local-fs.target @2.203s
18 └─var-lib-snapd-snap-core18-1880.mount @1.603s +598ms
19 └─dev-loop10.device @2.200s +38ms
From this I saw 2 things to focus:
- I’m not really using snaps right now
- dhcpcd is taking 16s ou the 19s
Disabling ou removing programs you don’t need
By looking at your results, if you see something your are not really using you can disable the service ou remove the program.
In my case I removed snapd.
1yay -Rns snapd
Replacing dhcpcd with systemd-networkd
Digging around I saw somebody suggesting using systemd-networkd instead of dhcpcd. I gave it a try.
I disabled the service (including NetworkManager):
1sudo systemctl disable dhcpcd@eno1.service
2sudo systemctl disable NetworkManager-wait-online
3sudo systemctl disable NetworkManager
Also removed nm-applet from my startup list in i3.
1# exec --no-startup-id nm-applet
Enabling systemd-networkd
As always check the wiki for more details.
You must create a configuration file for each of your network cards. In my case I’m only using a wired connection.
1sudo vi /etc/systemd/network/20-wired.network
1[Match]
2Name=eno1
3
4[Network]
5DHCP=yes
And the enable the service:
1sudo systemctl enable systemd-networkd
2sudo systemctl enable systemd-resolved
I also installed a notification service:
1yay -S networkd-notify-git
And added it to my i3 startup list:
1exec --no-startup-id networkd-notify
My critical-chain (after)
It’s better for sure and I learned a few new things.
1sudo systemd-analyze critical-chain
1The time when unit became active or started is printed after>
2The time the unit took to start is printed after the "+" cha>
3
4graphical.target @9.564s
5└─multi-user.target @9.564s
6 └─cups-browsed.service @9.563s
7 └─org.cups.cupsd.service @9.402s +159ms
8 └─network-online.target @9.400s
9 └─systemd-networkd-wait-online.service @1.533s +7.86>
10 └─systemd-networkd.service @1.046s +484ms
11 └─systemd-udevd.service @502ms +535ms
12 └─systemd-tmpfiles-setup-dev.service @470ms +2>
13 └─kmod-static-nodes.service @383ms +13ms
14 └─systemd-journald.socket @377ms
15 └─system.slice @367ms
16 └─-.slice @367ms