Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time no longer updating #245

Closed
R0lleston opened this issue Feb 9, 2023 · 23 comments
Closed

Time no longer updating #245

R0lleston opened this issue Feb 9, 2023 · 23 comments

Comments

@R0lleston
Copy link

Silly me decided to update the buster os on my pi this morning, but now the clock will not update the time.

initially running the word clock.py loads the clock, sets the correct time etc, But after this the time no longer refreshes.

Before the buster package update it was working perfectly

any ideas.

@oxivanisher
Copy link
Contributor

oxivanisher commented Feb 10, 2023

I just noticed the same and did a little digging. For me, it seems that:

  • Git was probably upgraded with package updates to a version 2.30+
  • I cloned the wordclock software as user pi, but as per documentation (and also for hardware permission reasons), wordclock starts as root trough a cron job
  • The wordclock application is doing something with git trough the command line (subprocess module): git describe --tags
  • The called git command is not happy that it is run as a different user than the repo is checked out (pi/root)
  • It exits with a error message and the return code 128 ("/home/pi/rpi_wordclock/wordclock.py", line 31)

I was able to get it up and running, by running the following command as root:
git config --global --add safe.directory /home/pi/rpi_wordclock

This will add the folder where the wordclock application is installed to the git config and mark it as secure.
This ends up in /root/.gitconfig with

[safe]
        directory = /home/pi/rpi_wordclock

This will probably impact every user which installs on a new OS or does package upgrades. I can not say what the best solution is, but some that come into my mind are:

  • Calling git config --global --add safe.directory /home/pi/rpi_wordclock for root during the installation / manual (not sexy but a "quick fix")
  • Accepting the 128 error code in the subprocess call (only a workaround, does not solve the real problem and I am not sure that the subprocess call supports this anyways)
  • Rewrite the manual that everything is done as root (also not really clean IMHO, applications should managed and if possible run as user if possible)

These are my quick findings and ideas. I hope the command above helps to solve it for other people until a definitive fix is found.

@R0lleston
Copy link
Author

For us non technical sorts, why would this occur with a working system (not a clean os install) ? Is it the way the word clock has been written or the external programs that interface with it ?

@oxivanisher
Copy link
Contributor

If my analysis is correct, it is because a newer version of git was installed and this version is now more picky concerning file permissions. But this was on my system after I updated the packages, so it makes sense on my systesm.
Did my solution fix it for you?

@FrankX0
Copy link
Contributor

FrankX0 commented Feb 12, 2023

@R0lleston can you supply what is being printed in the terminal?

@R0lleston
Copy link
Author

@FrankX0 i think I might have powered down the pi a few too many times without a proper shutdown, I think I’ll need to do a full reinstall of the OS. I’ll let you know when I’ve done that

@R0lleston
Copy link
Author

@FrankX0 have reinstalled buster and loaded the word clock. Can confirm it work’s initially, but soon drops off, no longer updates time and essentially freezes up.

The connection to the app fails, and it longer updates logs when viewed from putty. The pi is still accessible via putty however

you can restart by the sudo python3 word clock.py commmand

@R0lleston
Copy link
Author

@oxivanisher tried your fix (not as root, but as user pi) worked for a bit but ultimately looked up again

@oxivanisher
Copy link
Contributor

@R0lleston if you have the same problem as me, you have to do the "fix" (more workaround) as root or it will not help.

@R0lleston
Copy link
Author

@oxivanisher ok, I’ll work out how to do that and give it a crack

@oxivanisher
Copy link
Contributor

@R0lleston I can help you with that. Connect to the wordclock and run sudo -i. After that, you should be working as root. You can exit the root shell again by running exit.

@FrankX0
Copy link
Contributor

FrankX0 commented Feb 15, 2023

@R0lleston I expect the clock application somewhere stops due to an error. Can you supply what is being printed to the terminal?

@R0lleston
Copy link
Author

1309B3C8-6776-46F6-90CA-CCB0B19B9663

@R0lleston
Copy link
Author

@FrankX0 see previous post. As mentioned previously the clock was working fine prior to an update of the Buster OS

@FrankX0
Copy link
Contributor

FrankX0 commented Feb 15, 2023

This looks fine. There is no information after "Running plugin time_default"? Also not after a few minutes?

@R0lleston
Copy link
Author

Can’t tell the exact time it dies, but it didn’t change any of the data after 3 or 4 mins. Interestingly enough it seems to keep going (more than 5 mins) if the app to change settings is open @FrankX0

@R0lleston
Copy link
Author

Ok confirmed that if I have a connection to the clock via its app it operates fine. I tested it for 1.5hrs with the app open on a chrome tab on my phone, time was constantly correct. Take away that connection and after about 5 mins the clock stops updating and the SSH drops out

@FrankX0
Copy link
Contributor

FrankX0 commented Feb 15, 2023

It seems to me the raspberry pi loses its WiFi connection.
Can you try the following from a terminal:
sudo iw dev wlan0 set power_save off

@R0lleston
Copy link
Author

@FrankX0 did the above and can confirm the issue remains

@FrankX0
Copy link
Contributor

FrankX0 commented Feb 16, 2023

I don't see why this issue would be related to the word clock application.
Can you test the network connection without running the word clock application?
Can you try Bullseye instead?

@R0lleston
Copy link
Author

@FrankX0 @oxivanisher looks like I might have found the issue. Seems that the problem occurs when an ssh connection or the app is no longer connected to the pi. A little googling indicates that python programs stop working after ssh disconnects (buggered if I can work out why this has suddenly become an issue with workclock). If you install SCREEN and then run screen python3 rpi_wordclock.py it works as it used to. Screen appears to keep programs running in the background.

@FrankX0
Copy link
Contributor

FrankX0 commented Feb 25, 2023

This is expected behaviour and not typical for the wordclock.
You might want to start the clock automatically after power on:

@bk1285
Copy link
Owner

bk1285 commented Mar 7, 2023

Thanks for looking into this, @FrankX0 @oxivanisher.

@R0lleston, I close this for now.

Best,
Bernd

@bk1285 bk1285 closed this as completed Mar 7, 2023
@HeerNMeester
Copy link
Contributor

I had the same problem after a fresh installation. I had to start the clock myself because the cronjob did not work following the ReadtheDocs 'installation' manual.
After @oxivanisher trick, the clock runs without any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants