0

Why does my pi connect to wifi automatically when using shutdown and re-plugging it in but doesn't when using reboot?

When I unplugged/shutdown and plug the pi back in, it connects normally even if I repeat this. However, when I reboot from the command line instead of shutdown, something different is happening and I can't pinpoint the problem.

I have a script in my crontab that basically checks the wifi and if it's not connected, then broadcast a static network so you can reconnect to the wifi or connect if it's the first time. This is executing, saying I'm not connected and broadcasting the static network, but only on reboot as I've said.

The script is just pinging 8.8.8.8 to see if it's connected to the internet. Otherwise, it'll copy over.

Essentially, I think there is just a difference between the two boot states, but I can't find documentation on it and maybe someone else has better knowledge. Is reboot not running something or is it faster so maybe the network doesn't have enough time to connect before it checks or does it run things in a different order?

DJSweetness
  • 95
  • 2
  • 8

1 Answers1

0

There is a difference, although I doubt this is causing your problem.

The normal Pi boot is a program which runs on the graphic core, then switches to CPU and loads the kernel. This is what happens when power is applied.

If you run poweroff (or its counterparts) the CPU shuts down, but the graphic core remains running. (This can be used to reboot by pulling pin 5 low). Any GPIO settings remain at the last setting, and in some circumstances (not all) the HDMI output continues to display the last screen (I think this only happens if something prevents the screen clearing).

reboot runs the poweroff sequence, then immediately starts the bootloader. This should not affect boot, although it is possible something connected to a GPIO pin may have some effect.

Having

Milliways
  • 59,890
  • 31
  • 101
  • 209