Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

Witty Pi 3 Mini daemon not running on startup

8 Posts
2 Users
0 Likes
50 Views
(@rtyagi2)
Posts: 5
Active Member
Topic starter
 

Using Raspberry Pi 3 Model B Plus (os version "Raspbian GNU/Linux 11 (bullseye)"), Witty Pi version 3.53. Witty Pi 3 Mini Firmware ID 0x22

I followed the instructions in the Witty Pi 3 Mini documentation for setup (Witty Pi 2 User Manual). I'm able to power the board on and off using the power switch, execute ./wittypi.sh, and set a schedule script from the selection

I've been trying to use the schedule script feature. I've copied one of the sample schedule scripts and made it so that it shuts the device off after 2 minutes and turns it back on after 2 minutes. I only made this script to test the scheduling feature but when the scheduled shutdown time arrived nothing happened, the raspberry pi did not power off and continued to display and function on my monitor as normal.

Trying different schedules, and resetting data between tests and I wasn't able to figure anything out, scheduling a shut down manually in wittypi.sh also didn't work.

Upon running $ps -a, I see there is no instance of the daemon running, curious, I try to manually run the daemon using $sudo ./daemon.sh after a reset and then setting a schedule. Upon executing daemon.sh, the pi powers off right away, not on shut off time. However, it then starts up at the originally scheduled start up time on its own. 

Checking the scheduled shutdown and startup time in wittypi.sh, it shows the old shutdown and startup times, the startup time that was just used. Upon startup, the scheduled times were not automatically rescheduled. Again, $ps -a shows no daemon. Running $sudo ./daemon.sh outputs the following text-

pi@raspberrypi:~/wittypi $ sudo ./daemon.sh
Witty Pi daemon (v3.53) is started.
./daemon.sh: line 19: warning: command substitution: ignored null byte in input
Running on Raspberry Pi 3 Model B Plus Rev 1.3
cat: /home/pi/wittypi/tmp/BUILD-DATA: No such file or directory
umount: /home/pi/wittypi/tmp: target is busy.
Firmware ID: 0x22
Current Vout=4.96, Iout=0.25
Send out the SYS_UP signal via GPIO-17 pin.
Synchronizing time between system and Witty Pi...
Writing RTC time to system...
Done 🙂
Internet detected, apply network time to system and Witty Pi...
Applying network time to system...
Done 🙂
Writing system time to RTC...
Done 🙂
Pending for incoming shutdown command...

After this, there is an entry for daemon and python3 after using $ps -a

Checking wittypi.sh again, and the scheduled times have been rescheduled, but now even with the daemon manually running it passes by the scheduled time. Restarting the daemon by halting the manually started one and running another results in a similar situation where shut off occurs as soon as the daemon has been run manually, but then starts back up on the scheduled start up time.

Is there something incorrect about my setup? How can I ensure the daemon will run by default? I tried to enter it into the afterStartup.sh file but that doesn't seem to result in the daemon being a running process. 

 
Posted : 17/12/2024 10:24 pm
(@admin)
Posts: 507
Member Admin
 

Witty Pi 3 and Witty Pi 3 Mini have been discontinued for more than 2 years, and we have stopped updating their firmware and are not actively updating their software.

The issue you mentioned most probably is due to the gpio-util.sh not compatible with the version of OS. If you check the software repository for Witty Pi 4, you can see we recently switched back to the wiringPi and drop the gpio-util.sh. 

My suggestion is to install wiringPi manually in your OS, and then comment out the usage of gpio-util.sh (here and here).

 
Posted : 18/12/2024 9:33 am
(@rtyagi2)
Posts: 5
Active Member
Topic starter
 

I installed wiringPi and commented out both of the usages of gpio-util.sh as shown and still the problem persists. Upon startup, there doesn't seem to be any daemon running and scheduled times are not rescheduled. Do I need to include wiringPi somehow to substitute gpio-util.sh? Or is there anything I may have missed?

 
Posted : 18/12/2024 10:01 pm
(@admin)
Posts: 507
Member Admin
 

@rtyagi2 you may check if the daemon.sh has been properly registered to run on boot.

The "/etc/init.d/wittypi" file should exist and be executable, you can run "update-rc.d wittypi defaults" to make sure it will run on boot.

As long as it gets executed, it will write log to the wittyPi.log file, which you can check and see if there something goes wrong. Checking the boot log (run "dmesg") can also see if daemon.sh throws some errors.

 
Posted : 19/12/2024 2:09 pm
(@rtyagi2)
Posts: 5
Active Member
Topic starter
 

I went ahead and verified the file did exist, ran the command successfully and tried everything again. It doesn't look like anything has changed. I tried to look at dmesg to see any mention of daemon.sh but wasn't able to find anything. Any tips on what an error thrown from trying to execute daemon.sh may look like? 

 

To test if the daemon had started automatically, I ran the schedule script and again waited to the scheduled shutdown time. That was unsuccessful and so I went ahead and ran the daemon manually. Same behavior as usual, it worked and shut down and started up but then again on startup the daemon was not running.

At this point I've even tried to use $crontab -e and adding a reboot command to execute the daemon script on startup to no avail, trying to just get that running on startup.

Here is the entry from the wittypi.log file

 

After the reboot I set the schedule and waited to 17:23

 

[2024-12-19 17:19:10] Copying "on_2m_every_2m.wpi" to "schedule.wpi"...

[2024-12-19 17:19:10] Running the script...

[2024-12-19 17:19:11] Schedule next shutdown at: 2024-12-19 17:23:00

[2024-12-19 17:19:11] Schedule next startup at: 2024-12-19 17:25:00

[2024-12-19 17:19:11] Done 🙂

 

No automatic shutdown so I ran the daemon myself here

 

[2024-12-19 17:26:05] Witty Pi daemon (v3.53) is started.

[2024-12-19 17:26:05] Running on Raspberry Pi 3 Model B Plus Rev 1.3

[2024-12-19 17:26:07] Firmware ID: 0x22

[2024-12-19 17:26:07] Current Vout=5, Iout=0.66

[2024-12-19 17:26:07] Send out the SYS_UP signal via GPIO-17 pin.

[2024-12-19 17:26:08] System startup as scheduled.

[2024-12-19 17:26:08] Synchronizing time between system and Witty Pi...

[2024-12-19 17:26:08] Writing RTC time to system...

[2024-12-19 17:26:09] Done 🙂

[2024-12-19 17:26:09] Internet detected, apply network time to system and Witty Pi...

[2024-12-19 17:26:09] Applying network time to system...

[2024-12-19 17:26:09] Done 🙂

[2024-12-19 17:26:09] Writing system time to RTC...

[2024-12-19 17:26:10] Done 🙂

[2024-12-19 17:26:16] Pending for incoming shutdown command...

[2024-12-19 17:26:17] Schedule next shutdown at: 2024-12-19 17:27:00

[2024-12-19 17:26:17] Schedule next startup at: 2024-12-19 17:29:00

[2024-12-19 17:26:59] Shutting down system as scheduled

[2024-12-19 17:27:00] Halting all processes and then shutdown Raspberry Pi...

 

The system then shut down as scheduled, but this is the end of the logs, doesn't look like the daemon was logged to run in wittypi.log.

I'll also add, at this point the button on the witty pi 3 mini board doesn't function to shut the pi off unless I have manually run the daemon. I don't think this was always the case and I'm unsure what has changed to cause this.

 
Posted : 19/12/2024 11:44 pm
(@admin)
Posts: 507
Member Admin
 

Posted by: @rtyagi2

the witty pi 3 mini board doesn't function to shut the pi off

I am pretty sure it was because daemon.sh didn't get executed on boot. Without daemon.sh running in the background, pressing the button (pulling GPIO-4 to GND) will do nothing. The daemon.sh will be blocked at this line, and if GPIO-4 falls down, it will go to the last line of the script and run shutdown command.

You may check if the service is properly registered with this command:

ls -l /etc/rc*.d | grep wittypi

 

You should see something like these:

lrwxrwxrwx 1 root root 17 Dec 20 12:42 K01wittypi -> ../init.d/wittypi
lrwxrwxrwx 1 root root 17 Dec 20 12:42 K01wittypi -> ../init.d/wittypi
lrwxrwxrwx 1 root root 17 Dec 20 12:42 S01wittypi -> ../init.d/wittypi
lrwxrwxrwx 1 root root 17 Dec 20 12:42 S01wittypi -> ../init.d/wittypi
lrwxrwxrwx 1 root root 17 Dec 20 12:42 S01wittypi -> ../init.d/wittypi
lrwxrwxrwx 1 root root 17 Dec 20 12:42 S01wittypi -> ../init.d/wittypi
lrwxrwxrwx 1 root root 17 Dec 20 12:42 K01wittypi -> ../init.d/wittypi

Otherwise you can redo the registration:

sudo update-rc.d wittypi remove


sudo update-rc.d wittypi defaults

 

 
Posted : 20/12/2024 1:47 pm
(@rtyagi2)
Posts: 5
Active Member
Topic starter
 

Checked out the registration information using the command, I found some results, from 12/12 but without the -> ../init.d/wittypi after each result. I went ahead and redid the registration, and it updated the results to today at the current time with the -> ../init.d/wittypi. Rebooted and tried to see if the schedule would work this time, but no success. After a reboot I run the same command to check its registration, and it didn't redo itself on startup (which I assume is normal). 

 

pi@raspberrypi:~ $ ls -l /etc/rc*.d | grep wittypi

lrwxrwxrwx 1 root root 17 Dec 20 18:44 K01wittypi -> ../init.d/wittypi

lrwxrwxrwx 1 root root 17 Dec 20 18:44 K01wittypi -> ../init.d/wittypi

lrwxrwxrwx 1 root root 17 Dec 20 18:44 S01wittypi -> ../init.d/wittypi

lrwxrwxrwx 1 root root 17 Dec 20 18:44 S01wittypi -> ../init.d/wittypi

lrwxrwxrwx 1 root root 17 Dec 20 18:44 S01wittypi -> ../init.d/wittypi

lrwxrwxrwx 1 root root 17 Dec 20 18:44 S01wittypi -> ../init.d/wittypi

lrwxrwxrwx 1 root root 17 Dec 20 18:44 K01wittypi -> ../init.d/wittypi

 
Posted : 21/12/2024 12:53 am
(@rtyagi2)
Posts: 5
Active Member
Topic starter
 

After a clean reinstall of the software, and making the changes to comment out the two gpio_utils line as indicated above, my schedules are working! The button press also works again, and upon start up, the shutdown and startup times are rescheduled. I don't know what caused my issues, maybe my fiddling around with software I didn't understand, but it seems to be working. Thank you for the help!

 
Posted : 21/12/2024 1:32 am
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.