I have a script that I want my Raspberry pi zero W to run. However, it takes quite a lot of time for it to run my Python Script (around 30-40 seconds). I'm using Raspberry pi OS lite (bookworm). Requirments for the Script: recieve keyboard inputs, sending data over UART, internet conection (It does not need the internet connection initially so it can first run without it) start after at least 20 seconds after the device starts recieving power. My script runs with a custom systemd service. Configuration:

Description=My Python Script Service
After=local-fs.target sysinit.target
ExecStart=/usr/bin/python3 /home/turbo/Scripts/RasPi/"files for RP zero"/Script.py &

Also the boot times:

turbo@raspberrypi:~/ $ systemd-analyze critical-chain
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

multi-user.target @32.114s
└─getty.target @32.073s
  └─[email protected] @32.031s
    └─rc-local.service @31.600s +172ms
      └─network-online.target @31.498s
        └─NetworkManager-wait-online.service @24.998s +6.451s
          └─NetworkManager.service @21.853s +2.960s
            └─dbus.service @18.917s +1.826s
              └─basic.target @18.715s
                └─Logger.service @18.684s
                  └─sysinit.target @18.416s
                    └─systemd-timesyncd.service @15.952s +2.442s
                      └─systemd-tmpfiles-setup.service @14.754s +995ms
                        └─local-fs.target @14.475s
                          └─run-credentials-systemd\x2dtmpfiles\x2dsetup.service.mount @14.921s
                            └─local-fs-pre.target @9.194s
                              └─systemd-tmpfiles-setup-dev.service @8.555s +618ms
                                └─systemd-sysusers.service @7.821s +688ms
                                  └─systemd-remount-fs.service @5.442s +1.481s
                                    └─systemd-journald.socket @3.908s
                                      └─-.mount @3.625s
                                        └─-.slice @3.626s

Should I use some other OS for my purposes and Is there a way to speed up the execution of the script on bootup? Thanks in advance!

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented May 19 at 1:13
  • Have you tried Bookworm 32 bit; graphical.target @13.574s └─multi-user.target @13.573s ... └─-.mount @1.942s └─-.slice @1.939s ??
    – bstipe
    Commented May 23 at 17:25


Your Answer

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