Raspberry Pi 3/4 faster boot time in few easy steps

If you are struggling with slow boot time on your Raspberry Pi, follow those simple steps and tricks

Raspberry Pi OS is debian based OS targeting for those devices, assuming you already know what you are doing, after logging to SSH we can start optimising boot elements for fast and quiet boot of your Raspberry Pi. I’m using RPi 4 in web kiosk mode.

Eliminate boot service you don’t need from Raspberry Pi

First of all, diagnose the issue by following command
~$ systemd-analyze

this will output some general timing, like:

Startup finished in 2.947s (kernel) + 17.969s (userspace) = 20.917s

Not so good huh?

We can be more specific about timings using instruction „blame” to find out who needs to blame for those nasty timings, so:
~$ systemd-analyze blame

this will output some specific boot elements, like:

9.297s raspapd.service
1.547s dev-mmcblk0p2.device
1.412s raspi-config.service
1.065s lighttpd.service
1.007s rpi-eeprom-update.service
741ms dhcpcd.service
568ms netfilter-persistent.service
514ms log2ram.service
504ms systemd-udev-trigger.service
497ms dphys-swapfile.service
495ms keyboard-setup.service
436ms systemd-fsck@dev-disk-by\x2dpartuuid-028d1236\x2d01.service
435ms networking.service
327ms systemd-timesyncd.service
315ms wpa_supplicant.service
295ms systemd-journald.service
260ms rsyslog.service
249ms ssh.service
210ms systemd-fsck-root.service
204ms rng-tools.service
203ms systemd-logind.service
196ms dnsmasq.service
195ms systemd-remount-fs.service
180ms user@1000.service
163ms systemd-udevd.service
142ms hostapd.service
129ms triggerhappy.service
126ms systemd-tmpfiles-setup.service
124ms fake-hwclock.service
86ms systemd-journal-flush.service
etc. [...]

So I already know what to blame, in this case AP Interface (hotspot/access point web ui) eat 9 seconds. I don’t like other services as well, most important – I don’t need them in my use case. How to disable unwanted?

sudo systemctl disable raspapd.service
sudo systemctl disable raspi-config.service
sudo systemctl disable keyboard-setup.service
sudo systemctl disable dphys-swapfile.service
sudo systemctl disable avahi-daemon.service
sudo systemctl disable sys-kernel-debug.mount
sudo systemctl disable raspi-config.service
sudo systemctl disable systemd-udev-trigger.service
sudo systemctl disable rpi-eeprom-update.service
sudo systemctl disable rsyslog.service
sudo systemctl disable systemd-journald.service
sudo systemctl disable systemd-fsck-root.service
sudo systemctl disable systemd-logind.service
sudo systemctl disable bluetooth.service
sudo systemctl disable hciuart.service

Your list can vary – use with caution or google out specific services and compare to your needs before disabling.

Overclock Raspberry Pi

edit /boot/config.txt

sudo nano /boot/config.txt

after info about overclocking, add two commands:
#uncomment to overclock the arm. 700 MHz is
the default.
over_voltage=2
arm_freq=1750

Please use active fan cooling or big radiator for CPU in this case.

Overclock RPi SD card

also edit /boot/config.txt

# Overclock the SD Card from 50 to 100MHz
# This can only be done with at least a UHS Class 1 card
dtoverlay=sdtweak,overclock_50=100
# Set the bootloader delay to 0 seconds. The default is 1s if not specified.
boot_delay=0

#uncomment to overclock the arm. 700 MHz is the default.
over_voltage=2
arm_freq=1750

Speed up tricks for headless installation

/boot/config.txt
# Disable bluetooth RPi 4
dtoverlay=disable-bt

/boot/cmdline.txt – after default line add parameters for quite boot and speed up process for KIOSK MODE
noatime nodiratime data=writeback quiet splash logo.nologo vt.global_cursor_default=0 loglevel=0

If your dhcpcd.service is taking long to boot

You can assign static IP address if your env. allows for that.

In addition, try to edit /etc/dhcpcd.conf – at the end add:
noarp
ipv4only
noipv6

If you have other simple idea how to speed up boot process, please share your knowledge in comments section.

Musisz się zalogować, aby móc dodać komentarz.
Menu