2

After waking up (after Power Off/Log Out > Suspend) the system time is wrong (either in the future or past).

$ systemctl restart systemd-timesyncd.service

makes it right again. Is there a way to run systemctl automatically after each Suspend? Below is what I see right after waking up (before running systemctl)

$ sudo systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-06-14 14:57:45 EEST; 2 days left
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 6853 (systemd-timesyn)
     Status: "Initial synchronization to time server 91.198.10.4:123 (0.debian.pool.ntp.org)."
      Tasks: 2 (limit: 3678)
     Memory: 1.0M
        CPU: 116ms
     CGroup: /system.slice/systemd-timesyncd.service
             └─6853 /lib/systemd/systemd-timesyncd

Jun 14 14:57:45 ambler systemd[1]: Starting Network Time Synchronization... Jun 14 14:57:45 ambler systemd[1]: Started Network Time Synchronization. Jun 11 18:57:46 ambler systemd-timesyncd[6853]: Initial synchronization to time server 91.198.10.4:123 (0.debian.pool.ntp.org).

Using:

AMD A6-5400K APU with Radeon Version E7792AMS V2.2.
Debian GNU/Linux 11 (bullseye)
GNOME Version 3.38.5

UPDATE

On the next date of my post was the update of the system. I thought the problem was gone. It happened again today (2022-02-22).

$ sudo systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-06-17 17:18:24 EEST; 4 days ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 342 (systemd-timesyn)
     Status: "Initial synchronization to time server 31.28.161.68:123 (0.debian.pool.ntp.org)."
      Tasks: 2 (limit: 3678)
     Memory: 1.3M
        CPU: 377ms
     CGroup: /system.slice/systemd-timesyncd.service
             └─342 /lib/systemd/systemd-timesyncd

Jun 17 17:18:24 ambler systemd[1]: Starting Network Time Synchronization... Jun 17 17:18:24 ambler systemd[1]: Started Network Time Synchronization. Jun 17 17:18:55 ambler systemd-timesyncd[342]: Initial synchronization to time server 162.159.200.123:123 (2.debian.pool.ntp.org). Jun 18 11:01:56 ambler systemd-timesyncd[342]: Initial synchronization to time server 31.172.141.230:123 (0.debian.pool.ntp.org). Jun 18 18:44:17 ambler systemd-timesyncd[342]: Initial synchronization to time server 91.236.251.12:123 (0.debian.pool.ntp.org). Jun 19 11:32:05 ambler systemd-timesyncd[342]: Initial synchronization to time server 91.219.60.18:123 (0.debian.pool.ntp.org). Jun 20 11:17:16 ambler systemd-timesyncd[342]: Initial synchronization to time server 45.87.155.41:123 (0.debian.pool.ntp.org). Jun 21 11:04:00 ambler systemd-timesyncd[342]: Initial synchronization to time server 31.28.161.68:123 (0.debian.pool.ntp.org). (.venv39) vlz@ambler:~/.../ymail$ date Tue 21 Jun 2022 11:21:22 PM EEST (.venv39) vlz@ambler:~/.../ymail$ sudo systemctl restart systemd-timesyncd.service (.venv39) vlz@ambler:~/.../ymail$ date Wed 22 Jun 2022 10:27:46 AM EEST

UPDATE II

The problem is still there. Had to check date after each reasume/suspend

$ date Tue 28 Jun 2022 07:12:22 PM EEST $ systemctl status systemd-timesyncd.service ● systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2022-06-21 23:22:10 EEST; 6 days ago Docs: man:systemd-timesyncd.service(8) Main PID: 29744 (systemd-timesyn) Status: "Idle." Tasks: 2 (limit: 3678) Memory: 1.1M CPU: 284ms CGroup: /system.slice/systemd-timesyncd.service └─29744 /lib/systemd/systemd-timesyncd $ systemctl restart systemd-timesyncd.service $ date Sat 25 Jun 2022 11:15:02 AM EEST

UPDATE III

I'm at my wits end. Right now (no suspend/resume anywhere near) discovered that the Internet connection (through Wi-Fi) gone. I tried to reconnect , the Wi-Fi password (the right one) was rejected. I suspended the system, then resumed. All was normal again. What was that? That must be somehow connected to the date gaps I reported first in this post.

UPDATE IV

Internet access disappears and regained again with suspend/resume. Found that /proc/modules is empty.

$ sudo lshw -c network
  *-network                 
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: enp1s0
       version: 06
       serial: 44:8a:5b:22:34:11
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.10.0-15-amd64 firmware=rtl8168e-3_0.0.4 03/27/12 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:16 ioport:e000(size=256) memory:d0004000-d0004fff memory:d0000000-d0003fff
  *-network
       description: Wireless interface
       physical id: 1
       bus info: usb@1:4
       logical name: wlx2cd05ae20794
       serial: 2c:d0:5a:e2:07:94
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=ath9k_htc driverversion=5.10.0-15-amd64 firmware=1.4 ip=192.168.1.15 link=yes multicast=yes wireless=IEEE 802.11

UPDATE V

Looks like the problem reoccur in 4 days. There was the kernel update 2 days ago

$ date
Mon 04 Jul 2022 07:21:25 PM EEST
$ sudo systemctl status systemd-timesyncd.service
[sudo] password for vlz: 
● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-06-28 11:03:08 EEST; 6 days ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 326 (systemd-timesyn)
     Status: "Idle."
      Tasks: 2 (limit: 3678)
     Memory: 1.0M
        CPU: 280ms
     CGroup: /system.slice/systemd-timesyncd.service
             └─326 /lib/systemd/systemd-timesyncd

Jun 28 11:03:08 ambler systemd[1]: Starting Network Time Synchronization... Jun 28 11:03:08 ambler systemd[1]: Started Network Time Synchronization. Jun 28 11:03:39 ambler systemd-timesyncd[326]: Initial synchronization to time server 185.102.185.67:123 (2.debian.pool.ntp.org). Jun 29 11:27:24 ambler systemd-timesyncd[326]: Initial synchronization to time server 162.159.200.1:123 (0.debian.pool.ntp.org). Jun 30 11:18:38 ambler systemd-timesyncd[326]: Initial synchronization to time server 91.236.251.180:123 (0.debian.pool.ntp.org). $ systemctl restart systemd-timesyncd.service $ date Fri 01 Jul 2022 11:37:54 AM EEST

UPDATE VI

systemctl restart doesn't fix the time, but systemctl status does.

$ date
Tue 05 Jul 2022 07:43:54 PM EEST
$ systemctl restart systemd-timesyncd.service
$ date
Tue 05 Jul 2022 07:44:55 PM EEST
$ sudo systemctl status systemd-timesyncd.service
[sudo] password for vlz: 
● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-07-05 19:44:50 EEST; 3 days left
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 40834 (systemd-timesyn)
     Status: "Initial synchronization to time server 62.149.0.30:123 (0.debian.pool.ntp.org)."
      Tasks: 2 (limit: 3678)
     Memory: 1.1M
        CPU: 66ms
     CGroup: /system.slice/systemd-timesyncd.service
             └─40834 /lib/systemd/systemd-timesyncd

Jul 05 19:44:50 ambler systemd[1]: Starting Network Time Synchronization... Jul 05 19:44:50 ambler systemd[1]: Started Network Time Synchronization. Jul 05 19:45:00 ambler systemd-timesyncd[40834]: Timed out waiting for reply from 91.198.10.4:123 (0.debian.pool.ntp.org). Jul 02 11:45:00 ambler systemd-timesyncd[40834]: Initial synchronization to time server 62.149.0.30:123 (0.debian.pool.ntp.org). $ date Sat 02 Jul 2022 11:51:01 AM EEST

UPDATE VII Got the following error:

$ sudo hwclock --get
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument

Is it somehow connected to the original problem?

UPDATE 10/26

GNOME 3 title bar: Power off/Log Out -> Suspend occasionally reboots the system. First time when it happened I thought I pressed the wrong line. Then I would double checked each time and ascertained that the error is not mine.

UPDATE 10/27

Suspend/Resume related to realtek wifi adapter I use (firmware-realtek_20210315-3_all.deb). From time to time it stops working (becomes disconnected):

$ nmcli device | grep wlx
wlx2cd05ae20794          wifi      disconnected  --         
p2p-dev-wlx2cd05ae20794  wifi-p2p  disconnected  --

Surprisingly, Suspend/Resume restores realtek normal function. System restart does too, but this is more understandable.

UPDATE 11/15

Rarer (I hope) than before yet still sometimes the system time after suspend/resume is wrong. However, quite soon the time gets to readjust itself without me running systemctl. I don't remember having seen such "self-readjusting" before. Very like one of recent updated did that.

UPDATE 1/20/23

Even stranger. Many

$ sudo systemctl restart systemd-timesyncd.service 
$ sudo systemctl restart systemd-timesyncd.service 
$ sudo systemctl restart systemd-timesyncd.service 
$ date
Mon 23 Jan 2023 08:46:01 AM EET

restarts had no effect. After that I suspended the machine again and wakeup. The time was right.

# before suspend
$ date
Mon 23 Jan 2023 08:47:23 AM EET
# when wakeup
$ date
Fri 20 Jan 2023 12:48:24 PM EET

UPDATE 5/9/23

`sudo sync' still remembers the password, though since I had suspended the machine lasted many hours. If this in not a feature, it can't be related to drained CMOS battery

UPDATE 8/22/23 The problem still exist. Sometimes the time after resume is OK. Sometimes Suspend reboots or crash the machine, I tried and failed to find whether is was crash or not. What I found for sure is that depends on the WiFi adapter I use. The machine has

RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller

with which crash has never happened. For quite a while I was working with USB TL-WN821N. Crashes(?) happened with it quite often. Every second or third "Suspend" restarts the machine. How did I find that? broke a couple of days ago. The system sees it no more and I had to use RTL.

0 Answers0