CC BY-SA 3.0 Prusa Research

Long Pi Zero boot time, on Prusa MK3

Dezider Meško

--

If you are using Pi Zero with Prusa MK3, maybe you are bothered with long boot time, and this post could help you.

My initial boot times looked like this:

pi@octopi:~ $ systemd-analyzeStartup finished in 2.585s (kernel) + 1min 25.749s (userspace) = 1min 28.334spi@octopi:~ $ systemd-analyze blame35.047s dev-mmcblk0p2.device30.796s systemd-fsck-root.service30.615s hciuart.service11.426s dhcpcd.service8.564s apt-daily.service7.550s apt-daily-upgrade.service4.814s networking.service...etc

Obviously most of the time is taken by fsck — on every boot of Pi. And it’s hardest decision to do as well. You can gain 1 minute or you can risc that with incorrect shutdown you can corrupt your filesystem without reparation on the next boot. I’ve managed to corrupt FS, so Pi wasn’t able to boot even with fsck on, so I’m taking this risc. But think twice.

If you want turn it off, change file cmdline.txt

sudo nano /boot/cmdline.txt

and change there fsck.repair=yes to fsck.repair=no

You can run fsck on next boot by creating file sudo touch /forcefsck

Source

Next is hciuart.service — it is service supporting bluetooth — if you are not using it you can:

sudo nano /boot/config.txt

and to the end add: dtoverlay=pi3-disable-bt

(you have probably there dtoverlay=pi3-miniuart-bt so just add it below it)

When I was there, I’ve disabled even audio dtparam=audio=off

and disable BT services in command line:

sudo systemctl disable hciuart.servicesudo systemctl disable bluealsa.servicesudo systemctl disable bluetooth.service

Source

Next is dhcpcd.service waiting for the network interface. You can probably configure it statically but I’ve just launch:

sudo raspi-config

and in the menu Boot Options changed Wait for Network at Boot to NO

Finally there is apt-daily and apt-daily-upgrade services

with:

sudo systemctl edit apt-daily.timer

and

sudo systemctl edit apt-daily-upgrade.timer

You can change their config to this:

# apt-daily timer configuration override[Timer]OnBootSec=15minOnUnitActiveSec=1dAccuracySec=1hRandomizedDelaySec=30min

So instead boot time, they are dooing their work random minutes later. Source.

After all this, boot time of my Pi is 18s, which I consider acceptable :-)

pi@octopi:~ $ systemd-analyzeStartup finished in 1.872s (kernel) + 16.093s (userspace) = 17.965spi@octopi:~ $ systemd-analyze blame6.146s dev-mmcblk0p2.device4.466s networking.service3.306s keyboard-setup.service3.247s dphys-swapfile.service2.536s systemd-logind.service...etc

But as usually — all these changes could have some side effects, so in case of strange issues, remember that you have changed something. And for case of FS corruption, run fsck manually or make an FS image.

--

--