Optimizing boot time (~50s is a long time)

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
dietpifan
Posts: 8
Joined: Sun Feb 26, 2017 2:44 pm

Optimizing boot time (~50s is a long time)

Post by dietpifan »

I'm using DietPi on a pi Zero for a project that requires it to boot asap. I have some scripts I want to execute immediately once the pi is started, and the faster it can get to rc.local and execute the scripts the better. Are there any ways of optimizing the boot time? I've increased the ARM Initial Turbo setting in dietpi-config to 60 (max). It now takes about 50 seconds to boot and run, which honestly is kind of a long boot time.

Any suggestions of unneeded startup items to remove? Any better way of executing startup scripts, e.g. creating a service out of it, perhaps? But I don't know if it will execute earlier than putting it in rc.local...

Any suggestions are welcome!
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Optimizing boot time (~50s is a long time)

Post by Fourdee »

dietpifan wrote:It now takes about 50 seconds to boot and run, which honestly is kind of a long boot time.
Hi,

This is far too long, should be < 20 seconds, is this with or without your additional script being executed?

One the main culprits is WiFi and DHCP, try using a static IP for the adapter to improve boot times.
Any better way of executing startup scripts, e.g. creating a service out of it, perhaps?
Service would be ideal. Can you link the script your running? i'll take a look.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
dietpifan
Posts: 8
Joined: Sun Feb 26, 2017 2:44 pm

Re: Optimizing boot time (~50s is a long time)

Post by dietpifan »

I created a service out of it and now it takes less than 20secs until SSH becomes available! I'm surprised it made that much of a difference.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Optimizing boot time (~50s is a long time)

Post by Fourdee »

dietpifan wrote:I created a service out of it and now it takes less than 20secs until SSH becomes available! I'm surprised it made that much of a difference.
Good to hear :)

SystemD launches threads for services when not using type=oneshot, (eg: starts 10+ services at once) would explain the improved boot time.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Post Reply