Dietpi-autostart doesn't work in certain boot cases

I setup a custom script to run at startup, and it’s working fine with normal restarts.
The problem is, when the electricity goes off, like for a blackout, and the Raspberry restarts, the script is not ran.
You could try yourself by unplugging your Raspberry and plug it back on. It won’t work.
Any ideas?

You could have filled our template we have on the troubleshooting section. At least we would know what system you are running.

How do you setup your script exactly? Usually there should be no difference between a reboot and a could start as both times the same process are done. Does your script is accessing any external storage or similar?

I’m running on a Raspberry Pi Model 4B, 4 GB of RAM, ROM is a 32 GB micro-sd.
My process creates a screen, then it runs a Python file in a given path, then it repeats this for three times for three different files.
These files are in the micro-sd, so the same disk as the system one. I don’t have any external disks.

And how did you setup your script to run on boot?

Using dietpi-autostart feature with auto-login. Like doing sudo dietpi-autostart, then selecting 17 (Or 14, I don’t remember precisely), it opens the script I need to edit and then I put there my commands.
The problem is that it actually works on normal rebootsz, but not in the case I mentioned earlier.

would it be possible to perform both reboot scenarios and post following afterwards after each reboot has been done.

systemctl status dietpi-autostart_custom
journalctl -u dietpi-autostart_custom

Sorry for the late answer. I thought I solved but I didn’t in the end lol.

Normal reboot:

First command:
Unit dietpi-autostart_custom.service could not be found.

Second command:
– Journal begins at Fri 2022-10-21 21:03:07 BST, ends at Fri 2022-10-21 21:11:42 BST. –
– No entries –

Electricity off reboot:

First command:
Failed to connect to bus: No such file or directory

Second command:
– Journal begins at Wed 2022-12-21 00:17:02 GMT, ends at Wed 2022-12-21 18:41:58 GMT. –
– No entries –