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

autosuspend suspends Ubuntu 20.04 on startup on dual-boot system #118

Closed
madbrain76 opened this issue Nov 24, 2021 · 3 comments
Closed

autosuspend suspends Ubuntu 20.04 on startup on dual-boot system #118

madbrain76 opened this issue Nov 24, 2021 · 3 comments

Comments

@madbrain76
Copy link

madbrain76 commented Nov 24, 2021

I have a dual-boot system with both Windows 10 and Ubuntu. Each OS uses a different way of storing the time in the machine. Linux uses UTC, and Windows uses the local time-zone, which is US Pacific Time for me.

Ubuntu sets the time sometime during startup. I have set Windows up to do the same. When switching back and forth between the two, an interesting issue happens. Specifically, when I boot Windows, then boot to Ubuntu (20.04.3), autosuspend nearly instantly suspends the machine. If I reboot Ubuntu one more time, with the time already being correct from the start of the boot process, everything behaves as intended - no instant suspend.

I think there is some sort of race condition between ntp and autosuspend services on Linux. This is not just merely an inconvenience to have to restart the machine right away, it also wears out the 8 old fashioned 14TB SATA hard disks, since the machine acts mainly as a NAS.

The simplest solution is probably to figure out a way to ensure autosuspend runs after ntp. It looks like the timesyncd service is the issue. I'm not certain how to accomplish this in systemd given the many Ubuntu targets.

A better solution would be to perhaps also take a look at the hardware monotonic clock, and figure out when a big shift has happened in the clock due to a time synchronization happened, while autosuspend was already running, and take appropriate action.

@languitar
Copy link
Owner

I would expect that there are several services that can be confused by big time jumps. NTP usually tries to avoid big shifts and uses gradual fixes, but that's probably not feasible for such big differences

I think the easiest solution to your problem is to instruct Windows to use UTC for the hardware clock, too. That works pretty well: https://www.howtogeek.com/323390/how-to-fix-windows-and-linux-showing-different-times-when-dual-booting/

@madbrain76
Copy link
Author

madbrain76 commented Nov 25, 2021 via email

@languitar
Copy link
Owner

I'll close this issue for now. If there's still a problem, please reopen the issue.

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

No branches or pull requests

2 participants