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

Avoid spamming the log when /dev/rtc does not exist #2801

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

afbjorklund
Copy link
Member

For instance the Raspberry Pi does not have any real-time clock, so rely on network time synchronization instead (systemd-timesyncd).


Currently you get a warning every 10 seconds in the guestagent log

2024-10-24T16:01:43.502852+00:00 keylimepi lima-guestagent[726]: time="2024-10-24T16:01:43Z" level=warning msg="fixSystemTimeSkew: lookup error: open /dev/rtc: no such file or directory"
2024-10-24T16:01:53.512171+00:00 keylimepi lima-guestagent[726]: time="2024-10-24T16:01:53Z" level=warning msg="fixSystemTimeSkew: lookup error: open /dev/rtc: no such file or directory"

But it only needs to be logged once, that there is no /dev/rtc file.

AkihiroSuda
AkihiroSuda previously approved these changes Oct 25, 2024
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Oct 25, 2024

For instance the Raspberry Pi does not have any real-time clock, so rely on network time synchronization instead (systemd-timesyncd).

Are you trying to use Raspberry Pi as a remote non-virtual machine guest with your PR #2000?

@afbjorklund
Copy link
Member Author

afbjorklund commented Oct 25, 2024

It is a zero, so it doesn't have so many options. For the bigger Raspberry Pi, you can add* a battery RTC as well.

* The Raspberry Pi 5 does feature a RTC by default, but then again the 4-5 (and 400) are more like a small ARM PC.

For instance the Raspberry Pi does not have any real-time clock,
so rely on network time synchronization instead (systemd-timesyncd).

Signed-off-by: Anders F Björklund <[email protected]>
@afbjorklund afbjorklund changed the title Avoid warning message when /dev/rtc does not exist Avoid spamming the log when /dev/rtc does not exist Oct 25, 2024
@@ -324,6 +324,11 @@ const deltaLimit = 2 * time.Second

func (a *agent) fixSystemTimeSkew() {
for {
ok, err := timesync.HasRTC()
if !ok {
logrus.Warnf("fixSystemTimeSkew: error: %s", err.Error())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use logrus.WithError

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add it, just didn't know if it was required (the other code is not using it yet)

@AkihiroSuda AkihiroSuda added this to the v1.0 milestone Oct 25, 2024
@AkihiroSuda AkihiroSuda merged commit 1a07d5f into lima-vm:master Oct 30, 2024
28 checks passed
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

Successfully merging this pull request may close these issues.

2 participants