rpi_wordclock icon indicating copy to clipboard operation
rpi_wordclock copied to clipboard

Auto-startup not working with RPi Zero WH

Open ghostkills12 opened this issue 1 year ago • 8 comments

Hi,

I've made the wordclock and is fully functional when booted from a laptop via ssh. However, when I change the crontab to get wordclock.py to start automatically on boot nothing happens. I still need to boot the wordclock manually via ssh. I've also tried other ways like cron, rc.local, or systemd service, but I am not familiar with any of those techniques and can't get them to work either. I am using a Raspberry Pi Zero WH.

ghostkills12 avatar Jan 19 '24 08:01 ghostkills12

Hi ghostkills12,

i had similar issues, but I just forgot the "sudo" in sudo crontab -e and @reboot sudo python3 /home/pi/rpi_wordclock/wordclock.py. I just activated a "non-sudo" crontab, which resulted in nothing...Did you check that already?

MichaelSeitz98 avatar Jan 19 '24 08:01 MichaelSeitz98

HI Michael! I made sure to use sudo in crontab (and booting it via ssh), so that is not the issue. Thanks for your quick response though!

Cheers, Jurre

ghostkills12 avatar Jan 19 '24 10:01 ghostkills12

Please check #172. Maybe it helps.

FrankX0 avatar Jan 21 '24 12:01 FrankX0

Thanks for the reply FrankXO! Unfortunately, the solution you suggested didn't work. I've looked into the crontab logs, which shows the following:

  git config --global --add safe.directory /home/wordclock/rpi_wordclock

Traceback (most recent call last): File "/home/wordclock/rpi_wordclock/wordclock.py", line 201, in word_clock = wordclock() File "/home/wordclock/rpi_wordclock/wordclock.py", line 31, in init self.currentGitHash = subprocess.check_output(["git", "describe", "--tags"], cwd=self.basePath).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['git', 'describe', '--tags']' returned non-zero exit status 128.

ghostkills12 avatar Jan 22 '24 21:01 ghostkills12

It looks like the code is trying to read the version from the git information, but it cannot find it (exit code 128). Can you comment-out lines 31 and 32 in wordclock.py and try again?

FrankX0 avatar Jan 22 '24 21:01 FrankX0

That did the trick! Awesome FrankXO, your help is much appreciated :D

ghostkills12 avatar Jan 22 '24 22:01 ghostkills12

This will happen more and more to all new installs. Please see this PR with a fix: https://github.com/bk1285/rpi_wordclock/pull/250

Your problem is with the new git version and a "not so clean way" to start the wordclock trough cron as root when it gets installed as user. See my comments in https://github.com/bk1285/rpi_wordclock/issues/245, they will help you with your current problem.

oxivanisher avatar Jan 22 '24 22:01 oxivanisher

Thank you for the tip oxivanisher. I completely agree that running the wordclock as root is not a clean way and that the issues with this quick fix may rise again in future updates. I'll have a good look at those PR's tomorrow!

ghostkills12 avatar Jan 22 '24 22:01 ghostkills12