I am running a python script on my Pi 3 B+ and registered it in a crontab @reboot so it is executed when booting the system. On my development Pi everything works fine, but when I clone the SD-Card and boot another Pi it takes up to 5 minutes until the python script is executed (thismeans an increase by factor 10). So I wonder if there is any known issue that may cause this behavior. I am running Raspbian Stretch (latest version).
Raspbian is using systemd as init system and to manage services and to emulate old style daemons from the deprecated SysV init system. For compatibility issues look at Compatibility with SysV. crontab is such an emulated system in particular its
@reboot function. systemd uses its own
*.timer services and Unit files to start services.
man 5 crontab you can find:
Please note that startup, as far as @reboot is concerned, is the time when the cron(8) daemon startup. In particular, it may be before some system daemons, or other facilities, were startup. This is due to the boot order sequence of the machine.
This is the reason why your script starts later on the productive installation: it does not have the same boot order of its services. And no, you can't define a boot order. On systemd with its parallel execution of starting services a boot order doesn't make sense. You have to define dependencies.
You should use a regular Unit file to start your python script. You will find many examples here on this site how to do it.