mirror of
https://github.com/niellun/FastCarPlay.git
synced 2026-06-11 02:47:47 +02:00
Optimise boot
+93
-2
@@ -71,7 +71,7 @@ Review the configuration and write the image to the SD card. Wait for the proces
|
||||

|
||||
|
||||
# 2 Partitioning
|
||||
> [!NOTE]
|
||||
> [!TIP]
|
||||
>This optional step prepares the system for an overlay filesystem, allowing the core system to run in read-only mode while keeping the user directory writable. It also creates a Linux swap partition. If you don’t need an overlay setup, you can skip this and boot the Pi normally. The SD card partitions will be expanded automatically on first boot.
|
||||
|
||||
In this step we create additional SD-card partitions for **swap** and the **home folder**. This allows the OS partition to run in read-only mode using an **overlay filesystem**, reducing write operations and improving stability and protection. At the same time, data can still be written to **/home** without disabling the overlay for persistent files or frequent updates.
|
||||
@@ -158,7 +158,8 @@ lsblk
|
||||

|
||||
|
||||
# 3 WPA-Supplicant
|
||||
To connect to the internet, we will use **wpa-supplicant**. It is lighter than NetworkManager and will also be used later for scripting.
|
||||
> [!TIP]
|
||||
> To connect to the internet, we will use **wpa-supplicant**. It is lighter than NetworkManager and will also be used later for scripting. You can use other methods of connection but this will be needed for Wifi scripts (step 10)
|
||||
|
||||
First, set the Wi-Fi country in the Raspberry Pi configuration:
|
||||
``` shell
|
||||
@@ -269,6 +270,96 @@ Now you can connect to your raspberry pi with ssh, replace 10.0.0.10 with ip of
|
||||
ssh carplay@10.0.0.10
|
||||
```
|
||||
# 4 Optimise boot
|
||||
> [!TIP]
|
||||
> We want the system to start as quickly as possible and minimize running services to conserve limited RAM. To achieve this, we can disable services that are not needed for our setup.
|
||||
|
||||
Check which services are taking the longest to start and check enabled service:
|
||||
```
|
||||
systemd-analyze blame
|
||||
systemctl list-unit-files --type=service
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> This is a list of services I disabled on my Raspberry Pi. Adjust it according to your own needs, and add or remove services based on your system, usage, and observed boot times.
|
||||
|
||||
## Disabling services
|
||||
|
||||
**Network wait service** (delays boot until network is fully online):
|
||||
```
|
||||
sudo systemctl disable systemd-networkd-wait-online.service
|
||||
sudo systemctl mask systemd-networkd-wait-online.service
|
||||
```
|
||||
|
||||
Raspberry Pi bootstrap and cloud services (not needed after first boot if we do not use cloud management):
|
||||
```
|
||||
sudo systemctl disable cloud-config.service
|
||||
sudo systemctl disable cloud-final.service
|
||||
sudo systemctl disable cloud-init-local.service
|
||||
sudo systemctl disable cloud-init-main.service
|
||||
sudo systemctl disable cloud-init-network.service
|
||||
```
|
||||
|
||||
**ModemManager** (if you don’t use a cellular modem):
|
||||
```
|
||||
sudo systemctl disable ModemManager.service
|
||||
```
|
||||
|
||||
**Avahi Daemon** (used for mDNS/Bonjour, unnecessary in headless setups):
|
||||
```
|
||||
sudo systemctl disable avahi-daemon.service
|
||||
```
|
||||
|
||||
**Polkit** (authorization framework, often unnecessary in CLI-only setups):
|
||||
```
|
||||
systemctl mask polkit.service
|
||||
```
|
||||
|
||||
**Bluetooth service** (manages Bluetooth hardware; unnecessary if you don’t use Bluetooth):
|
||||
```
|
||||
sudo systemctl disable bluetooth.service
|
||||
```
|
||||
|
||||
**Regenerate_ssh_host_keys** (used to generate new SSH host keys, usually on first boot or after re-imaging). Disabling it prevents automatic regeneration of SSH host keys at boot. It’s safe to disable once the initial keys are generated:
|
||||
```
|
||||
sudo systemctl disable regenerate_ssh_host_keys.service
|
||||
```
|
||||
|
||||
**Rpi-eeprom-update** (checks for and applies Raspberry Pi firmware/bootloader updates at boot):
|
||||
```
|
||||
sudo systemctl disable rpi-eeprom-update.service
|
||||
```
|
||||
|
||||
**E2scrub_reap** (performs LVM/ext4 metadata scrubs; mostly unnecessary on SD cards):
|
||||
```
|
||||
sudo systemctl disable e2scrub_reap.service
|
||||
```
|
||||
|
||||
**Sshswitch** (manages automatic switching of SSH access modes on Raspberry Pi OS). Disabling it stops the system from automatically enabling or switching SSH access at boot. This is safe on systems where SSH configuration is static or manually managed:
|
||||
```
|
||||
sudo systemctl disable sshswitch.service
|
||||
```
|
||||
|
||||
**Keyboard-setup** (configures keyboard layout at boot, not needed on headless):
|
||||
```
|
||||
systemctl disable keyboard-setup.service
|
||||
```
|
||||
|
||||
## Additional tweaks
|
||||
|
||||
Since we are running a fixed set of software and already configured a swap file on the SD card, we can remove ZRam swap to speed up boot:
|
||||
```
|
||||
sudo apt purge rpi-swap
|
||||
sudo apt autoremove
|
||||
```
|
||||
|
||||
Disable boot messages on the screen. This is not just reduce boot time a bit but also needed for system to start nicely without revealing everything underline. Edit cmdline.txt:
|
||||
```
|
||||
sudo nano /boot/firmware/cmdline.txt
|
||||
```
|
||||
Add the following to the end:
|
||||
```
|
||||
quiet splash fastboot
|
||||
```
|
||||
|
||||
# 5 Minimal desktop
|
||||
|
||||
|
||||
Reference in New Issue
Block a user