Booting up OctoPi fast(er)

OctoPrint is awesome, but especially if you use a Rasperry Pi 0 you want to make it boot up as quickly as possible. Here’s what you can do. I compiled this from different sources on the internet, e.g. this.
Warning: Make sure you have OctoPrint up and running and make a backup of your SD card before editing you settings, so you can flash it back if anything goes wrong!


Tuning config.txt

Edit your /boot/config.txt and use / add the following setting:

# Turn off the optional hardware interfaces you don't need
dtparam=i2c_arm=off
dtparam=i2s=off
dtparam=spi=off

# Disable audio (to not load snd_bcm2835)
dtparam=audio=off

[pi3]
# Disable bluetooth, if you're not using it
dtoverlay=pi3-disable-bt
#Disable Wifi, if you're not using it
dtoverlay=pi3-disable-wifi

[all]
# Disable RPi camera if you're not using it
# enable raspicam
# Do not boot to GUI
# start_x=1
# We're not starting a GUI. Make sure OctoPrint can use all the memory
gpu_mem=32
# Disable UART
enable_uart=0
# Disable the color splash at boot
disable_splash=1
# Set boot delay from the default 1s to 0s
boot_delay=0
# Force 30s of initial turbo mode
initial_turbo=30
# Overclock SD card. Check with sudo cat /sys/kernel/debug/mmc0/ios
# Be careful with this, as it can corrupt your SD card
#dtparam=sd_overclock=80

For overclocking your RPi, see this. For overclocking your SD card, see this.

Tuning kernel parameters

Edit /boot/cmdline.txt and add the following kernel parameters to the end:

quiet plymouth.enable=0

Disabling unused services

Use “systemd-analyze blame” to see which services are started when booting and how long they take to start. Then disable services you don’t need with “sudo systemctl disable <SERVICENAME>“. I disabled:

  • change-hostname.service – Used to change host name using a .txt file in /boot. Not needed after you have configured OctoPi correctly.
  • change-password.service – Used to change host name using a .txt file in /boot. Not needed after you have configured OctoPi correctly.
  • wifi-country.service – Set the WiFi country. Not needed after you have configured OctoPi correctly.
  • triggerhappy.service – Use special keyboard keys.
  • hciuart.service – Bluetooth service. Disable only if you’re not using Bluetooth!

You can probably disable these too:

  • raspi-config.service – Call raspi-config. I suspect this is only needed on the first boot when configuring the Pi.
  • apt-daily.service – Look for Debian updates using “apt update”. Disable if you’re manually managing system updates. Note that OctoPrint will still update on its own.
  • keyboard-setup.service – Careful with this. This disables keyboard input from e.g. USB keyboards. Use only if you have configured and are using SSH to log into you Pi!

I you want to dig further you can use “systemd-analyze critical-chain” to see how long it took for the system to spawn all services and what stage took how long. Or use “systemd-analyze critical-chain octoprint.service” to see how long it took OctoPrint to start up. The systemd docs show some more analysis options.

Optional: Disable HDMI

To save some power (~25-30mA) you can disable HDMI and some other functions. For that, edit /etc/rc.local and add this before the final “exit 0”:

# Disable HDMI to save some power
tvservice -o

Published by HorstBaerbel

Software developer by trade and interest, but I venture into the electronics- and diy-world from time to time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with WordPress.com
Get started
%d bloggers like this: