Systemd-analyze boot time optimization

Hello,

I am working on getting the boot time down for the Apalis iMX6Q running TorizonCore. I am loosely following the methods described in this article Embedded Linux Boot Time Optimization - Toradex Modules but I have discovered that a command it recommends using, “systemd-analyze,” is not available from TorizonCore. As I understand it, TorizonCore uses systemd for service management, so why is the command not available? is there some way I can get it?

Thanks,

Josh

Hello @jeremias.tx,

Thank you for the quick response.

I did not realize that systemd-analyze is not a part of the core systemd package, but that being the case, it makes sense that the utility is not included with Torizon.

As for my optimization efforts: I am targeting a boot time of around 10 seconds. This is not super critical for the product, but a long boot time will have a negative impact on user experience, so we are looking to shorten it as much as possible. Prior to any optimization, I was getting boot times as long as 38 seconds.

As for my target boot time, I am not including the time it takes the application to start up. I will look at how to optimize that later, but for the moment I am just focusing on cutting back the time it takes the bootloader, kernel and systemd to do their work. Thus far I have been working on eliminating some of the services started by systemd. My biggest success so far has been disabling NetworkManager, which took off about 8 seconds. The application we are looking to run is pretty slim, so we don’t really need that many services:

  • We are running an LVDS display with capacitive touch inputs
  • We are using the UART and RS232 interfaces to communicate with peripherals
  • We are running the application as a docker container

Other than the services critical to those functions, we should be able to eliminate everything else. Any suggestions you can provide will be greatly appreciated!

Thanks!

Josh

Hi @jtrebuchon,

I’ve been discussing the topic of boot-time with the team internally and we have come to a couple of conclusions. While it is possible to achieve a boot time of 10secs or lower, the concern is whether this is doable with Torizon.

To explain, you can of course lower boot time by modifying and customizing the Linux distro. The issue is that the team feels the level of customization needed to optimize Torizon’s boot time would result in a distro that doesn’t even resemble Torizon anymore. While we haven’t yet stretched the capabilities of Torizon and explored what minimum boot time is possible, it is unlikely it would get below 10 secs.

Just to summarize I believe a big offender of this is certain services such as the Docker daemon itself which can be slow to start. Depending on your needs it might be possible to have your system show “something” before it’s fully ready, i.e. a series of splash screens before your container starts. Though this depends on your system/requirements of course.

I’ll continue to bring the boot time question up internally and let you know if other relevant information gets revealed.

Best Regards,
Jeremias

Hi @jeremias.tx,

Thank you for your efforts. Luckily by eliminating unnecessary services we have been able to get the boot time down close to 20 seconds, which is not ideal but is a big improvement from what we started with. As I said, boot time is not ultra-critical for our application, so it’s not the end of the world if we can’t get all the way down to 10 seconds. Let me know if you come up with any other tips.

Thanks!

Josh

Greetings @jtrebuchon,

The utility “systemd-analyze” is not a part of the core “systemd” package-set. I imagine this was left out of Torizon since we try to make Torizon fairly slim with no extraneous packages. Or it’s just possible we just overlooked it at the time. Either way I’ll check with the team about possibility of adding it back.

In the mean-time let’s try and tackle your core issue of boot-time optimization. I have a few questions if you don’t mind answering.

  • Do you have a target boot-time you’re trying to achieve?
  • Is there a technical/project reason you need a lower boot-time or is it more of a “nice to have” requirement?
  • In terms of your target boot-time are you also counting the time till your application starts up as part of this? Or are you strictly concerned about time from power-on to time till the Kernel is fully started?

Also that blog is a tad outdated/general. Allow me some time to find boot-time optimization methods that are more specific/relevant to Torizon.

Best Regards,
Jeremias

Hi @jtrebuchon,

Just wanted to let you know due in part to your initial request here we’ve integrated the systemd-analyze package into our BSP and therefore TorizonCore by extension. This utility will show up on future releases however if you want early access to this feature you can also use Toradex Easy Installer to access nightly builds of TorizonCore that have this feature.

Best Regards,
Jeremias

Hi @jeremias.tx,

Excellent! Thanks again for your help.

Cheers,

Josh

You are welcome.