Webiopi not running python script on boot or reboot

Skip to first unread message


Feb 11, 2021, 4:56:06 PM2/11/21
to WebIOPi
Hi guys,
I recently had my SD card fail (running for multiple years) so I needed to reinstall everything. Previously I have had no issues with webiopi or my python script etc. Using a Pi b+ for a small watering system.

A few days ago, I installed Raspbian (buster - version ID:10)  and Webipi v 0.7.1. I set up everything as per my previous setup as I had my files backed up (python / HTML etc).

However here's the thing - everything works perfectly, except for when my Pi boots up the first time. It seems like my python script doesn't run - i.e. - the webpage loads, GPIO buttons work etc - just the script side doesn't.
Using terminal, if I stop the webiopi service using sudo /etc/init.d/webiopi stop --> restart it immediately with sudo /etc/init.d/webiopi start.....everything works!

Any ideas why it seems like the python script isn't being called @ boot or reboot??


Feb 13, 2021, 4:14:47 AM2/13/21
to WebIOPi

Matt Pelosi

Feb 13, 2021, 6:52:45 AM2/13/21
to web...@googlegroups.com
Thankyou for the reply - however it seems like it's still not working correctly - maybe I did something wrong?
Here is the steps I was able to follow given the link provided;

User neuralassembly created a patch (support for buster) - https://github.com/neuralassembly/raspi2/ 
- I followed the install instructions, no issues
- used the new commands as per below (in particular, the start at boot command)
sudo webiopi -d -c /etc/webiopi/config   // to debug
sudo systemctl start webiopi                // to start in background
sudo systemctl stop webiopi                // stop 
sudo systemctl enable webiopi             // to start at boot
sudo systemctl disable webiopi            // to cancel start at boot 
tail -f -n 50 /var/log/webiopi                  // view running log info

still no luck! 
I then proceeded to cancel webiopi on boot via old and new commands - then restarted the boot with the new command. Not working unfortunately.

Lastly, I tried again using the instructions from Peter / Freenove ---here, again within your linked thread. Installed no probs, but still wont work.

Sorry to be a pain but I think I am at a dead end. Any thoughts? 

You received this message because you are subscribed to a topic in the Google Groups "WebIOPi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/webiopi/_WnE6bZjMxQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to webiopi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/webiopi/43084c84-0ff7-4284-88f2-49ef6e150c42n%40googlegroups.com.


Feb 15, 2021, 2:33:22 AM2/15/21
to WebIOPi
Have you checked that file /etc/systemd/system/webiopi.service is present?


Feb 15, 2021, 4:18:04 PM2/15/21
to WebIOPi
Yeah it's there (see attached). Again, it seems like its not an issue of starting the webiopi service, its just only on boot the python script isn't called. (I.e. on boot, everything works except the python part - executing the commands in the screenshot [stop service, start service] will fix)

Not sure


Feb 16, 2021, 2:41:54 AM2/16/21
to WebIOPi
From https://www.raspberrypi.org/documentation/linux/usage/systemd.md:

Some things to be aware of:
  • The order in which things are started is based on their dependencies — this particular script should start fairly late in the boot process, after a network is available (see the After section).
  • You can configure different dependencies and orders based on your requirements.

I cannot say I had to do something to make it work for myself, cause earlier I didn't manage to update my B+ from Wheezy to Jessie due to another issue.


Feb 16, 2021, 8:17:05 PM2/16/21
to WebIOPi
Thanks so much for the reply's - this was most helpful. Unfortunately I didn't get too far with this and before I messed something up I decided to implement a workaround.
I ended up using Crontab to schedule a once a day 'stop-start'. It's not ideal, but it works. This way, in the event of a power outage or restart, I know that by days end the webiopi service will be calling my script again.

I'll keep looking for answers but at least have this work around
Thanks again!

Don Peace

Dec 21, 2021, 3:55:17 PM12/21/21
to WebIOPi
I hit this problem a while back when moving to Buster and pursued it via this group before the conversation eventually came to a dead end and I decided I just had to live with the (admittedly small) inconvenience or stick with earlier versions of Raspbian for my legacy systems.
Then came Bullseye and the issue re-emerged.
And so I found this thread.
I've also gone for the Crontab solution but I didn't want to restart webiopi at timed intervals because there may be occasions when I've stopped it for a reason and don't want Crontab jumping in and restarting it. I only want Crontab to start it when the Pi first boots (or reboots).
Crontab allows us to do this with @reboot
So @reboot sudo service webiopi restart
However this didn't get webiopi started!
The solution is to make it pause for a short while before executing the restart
Create a crontab with $ sudo crontab -e

add the command

@reboot sleep 20;sudo service webiopi restart

So I now have webiopi starting at boot on a Pi3 running Bullseye
I guess you would call this a workaround - but it's one that I'm perfectly happy to adopt.
A 20 seconds pause may be overkill. It may well work with smaller values but in my case 20 seconds works fine.
Reply all
Reply to author
0 new messages