1

I am looking to speed up the boot time on my Raspberry pi and systemd-random-seed is taking 20s (old Pi 1). From what I've read up this is waiting to collect entropy to generate a system random seed. I don't care whatsoever about security and I'm wondering if there is some way to hard-code this, disable it, or otherwise make it not take so ridiculously long to boot?

I tried just running systemctl disable systemd-random-seed to see what would happen and it still ran at boot, so evidently it's being started by another service or something.

I also tried adding random.trust_cpu=on to cmdline.txt based on something I read, but it seems to have done nothing.

I'm completely new to Linux and raspberry if that wasn't already obvious, so sorry if it's a dumb question a requires a dumb answer... I attempted to look through the man page and it's completely over my head (wasn't sure how to translate that into the boot process).

4
  • On what are you basing this conclusion? systemd services start asynchronously, so even if you think something is causing "slow" boot (which 20s isn't - my Pi4 takes 30sec) removing it is unlikely to make a significant difference.
    – Milliways
    Commented Nov 27, 2021 at 4:01
  • Incidentally WHY are you rebooting - I only reboot if updating firmware, other that that my Pi run 24/7?
    – Milliways
    Commented Nov 27, 2021 at 4:02
  • 1
    @Milliways I ran systemd-analyze plot and this service was by far the slowest. So far as I know that is the best way to time boot services... As to WHY, I am working on a camera controller and I want it to boot as quickly as possible because this is a set-up I will be carrying on film sets (not sitting at home or in a server room or something).
    – Spencer
    Commented Nov 27, 2021 at 4:10
  • @Milliways This guy got his boot time down to 3-4 seconds ;) himeshp.blogspot.com/2018/08/fast-boot-with-raspberry-pi.html
    – Spencer
    Commented Nov 27, 2021 at 4:19

1 Answer 1

0

Many over the years have tried to minimise boot times, and it can be done.

The best start is systemd-analyze critical-chain. Optimising anything not on the critical-chain won't help. Disabling networking is often successful.

6
  • So this means that it isn't taking any time? Why is it that when I run this the critical chain starts @31.6s - is there nothing I can do about the time before second 31?
    – Spencer
    Commented Nov 27, 2021 at 4:36
  • Also, and I do realize this is a bit off topic, can I disable systemd-timesyncd? According to my critical chain it is taking 2.3s and I don't particularly care about time...
    – Spencer
    Commented Nov 27, 2021 at 4:40
  • Everything takes time, but most run asynchronously. This is obviously limited on a single CPU system.systemd-timesyncd synchronises the clock. It is not needed, and will do nothing unless you have a network and you will still have clock - it just won't show the real time. systemd-analyze time shows kernel & userspace time.
    – Milliways
    Commented Nov 27, 2021 at 4:55
  • Ok so just to wrap this up because it isn't totally clear to me yet, it was totally false to think that systemd-random-seed was slowing my boot times? I tried systemd-analyze time and yes it shows 4s for kernel and 30s for userspace but that doesn't really help me much except to tell me that userspace is where I need to focus. But what is taking so long in userspace, that isn't in the critical chain? (which only showed about 5 seconds worth of time)
    – Spencer
    Commented Nov 27, 2021 at 5:04
  • I suggest you read man systemd-analyze and look at blame. This is complex, and I don't understand all of it. I am afraid I can't offer any concrete help for your specific problem, other than disabling everything you don't need.
    – Milliways
    Commented Nov 27, 2021 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.