Bug 1971057

Summary: Service systemd-time-wait-sync doesn't start
Product: [Fedora] Fedora Reporter: Jorge Martínez López <jorgeml>
Component: IoTAssignee: Peter Robinson <pbrobinson>
Status: CLOSED EOL QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: jorgeml, me, redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: armv7hl   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-25 18:20:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jorge Martínez López 2021-06-11 18:53:12 UTC
Description of problem:

I'm running Fedora IoT on a Raspberry Pi 3B. I am experiencing a race condition where the system clock leaps (as NTP syncs) while a container (Pi-hole) is starting so that causes the software within the container to fail (but the container is still running).

Ideally I would like to make the container service to be dependant on systemd-time-wait-sync so the container won't start until the system clock had the time to be set by systemd-timesyncd.

Unfortunately the systemd-timesyncd service does not start correctly.


Version-Release number of selected component (if applicable):
systemd-248.3-1.fc34.armv7hl

How reproducible:
Always

Steps to Reproduce:
1. systemctl start systemd-time-wait-sync.service
2.
3.

Actual results:

[root@aldebaran ~]# systemctl start systemd-time-wait-sync.service
Job for systemd-time-wait-sync.service failed because the control process exited with error code.
See "systemctl status systemd-time-wait-sync.service" and "journalctl -xeu systemd-time-wait-sync.service" for details.

[root@aldebaran ~]# systemctl start systemd-time-wait-sync.service
Job for systemd-time-wait-sync.service failed because the control process exited with error code.
See "systemctl status systemd-time-wait-sync.service" and "journalctl -xeu systemd-time-wait-sync.service" for details.
[root@aldebaran ~]# systemctl status systemd-time-wait-sync.service
× systemd-time-wait-sync.service - Wait Until Kernel Time Synchronized
     Loaded: loaded (/usr/lib/systemd/system/systemd-time-wait-sync.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Fri 2021-06-11 19:51:25 BST; 23s ago
       Docs: man:systemd-time-wait-sync.service(8)
    Process: 4471 ExecStart=/usr/lib/systemd/systemd-time-wait-sync (code=exited, status=1/FAILURE)
   Main PID: 4471 (code=exited, status=1/FAILURE)
        CPU: 43ms

Jun 11 19:51:25 aldebaran systemd[1]: Starting Wait Until Kernel Time Synchronized...
Jun 11 19:51:25 aldebaran systemd-time-wait-sync[4471]: Failed to add a watch for /run/systemd/: Permission denied
Jun 11 19:51:25 aldebaran systemd[1]: systemd-time-wait-sync.service: Main process exited, code=exited, status=1/FAILURE
Jun 11 19:51:25 aldebaran systemd[1]: systemd-time-wait-sync.service: Failed with result 'exit-code'.
Jun 11 19:51:25 aldebaran systemd[1]: Failed to start Wait Until Kernel Time Synchronized.

Jun 11 19:51:25 aldebaran systemd[1]: Starting Wait Until Kernel Time Synchronized...
░░ Subject: A start job for unit systemd-time-wait-sync.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit systemd-time-wait-sync.service has begun execution.
░░ 
░░ The job identifier is 3236.
Jun 11 19:51:25 aldebaran systemd-time-wait-sync[4471]: Failed to add a watch for /run/systemd/: Permission denied
Jun 11 19:51:25 aldebaran systemd[1]: systemd-time-wait-sync.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit systemd-time-wait-sync.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Jun 11 19:51:25 aldebaran systemd[1]: systemd-time-wait-sync.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit systemd-time-wait-sync.service has entered the 'failed' state with result 'exit-code'.
Jun 11 19:51:25 aldebaran systemd[1]: Failed to start Wait Until Kernel Time Synchronized.
░░ Subject: A start job for unit systemd-time-wait-sync.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit systemd-time-wait-sync.service has finished with a failure.
░░ 
░░ The job identifier is 3236 and the job result is failed.


Expected results:

The service to run.

Additional info:

Comment 1 Peter Robinson 2021-06-12 12:29:03 UTC
The default time sync service in Fedora, and hence also Fedora IoT, is chrony so I would suggest waiting on that. There's issues with systemd-timesyncd so we don't currently support it as a primary time sync service. I've no idea why it's failing. I suspect if you want to use it you likely need to disable chronyd

Comment 2 Jorge Martínez López 2021-06-12 16:48:17 UTC
Thanks Peter, I disabled systemd-timesyncd and re-enabled chrony, however I'm getting the same result:

× systemd-time-wait-sync.service - Wait Until Kernel Time Synchronized
     Loaded: loaded (/usr/lib/systemd/system/systemd-time-wait-sync.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Sat 2021-06-12 17:45:59 BST; 8s ago
       Docs: man:systemd-time-wait-sync.service(8)
    Process: 13952 ExecStart=/usr/lib/systemd/systemd-time-wait-sync (code=exited, status=1/FAILURE)
   Main PID: 13952 (code=exited, status=1/FAILURE)
        CPU: 44ms

Jun 12 17:45:59 aldebaran systemd[1]: Starting Wait Until Kernel Time Synchronized...
Jun 12 17:45:59 aldebaran systemd-time-wait-sync[13952]: Failed to add a watch for /run/systemd/: Permission denied
Jun 12 17:45:59 aldebaran systemd[1]: systemd-time-wait-sync.service: Main process exited, code=exited, status=1/FAILURE
Jun 12 17:45:59 aldebaran systemd[1]: systemd-time-wait-sync.service: Failed with result 'exit-code'.
Jun 12 17:45:59 aldebaran systemd[1]: Failed to start Wait Until Kernel Time Synchronized.

Comment 3 Ralf Ertzinger 2021-08-02 11:57:15 UTC
One of the problems here is that getting a reliable time-sync.target with chrony is difficult. chrony doesn't support systemd-time-wait-sync directly (or systemd-time-wait-sync doesn't support chrony, or the kernel doesn't reliably support either, things are very muddy here), so for chrony there's chrony-wait.service which will also pull in time-sync.target. However, chrony-wait.service only waits for three minutes for time sync to happen.

As far as my testing goes, the only way to get somewhat reliable time-sync.target in the face of NTP servers that might not be availabe during system boot (maybe because the network hasn't established yet) is to use systemd-timesyncd and systemd-time-wait-sync.

This should probably be a ticket against the selinux policies.

Comment 4 Ben Cotton 2022-05-12 16:22:48 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 5 Jorge Martínez López 2022-05-14 08:01:25 UTC
Still happening on F36:

[root@aldebaran ~]# systemctl start systemd-time-wait-sync.service
Job for systemd-time-wait-sync.service failed because the control process exited with error code.
See "systemctl status systemd-time-wait-sync.service" and "journalctl -xeu systemd-time-wait-sync.service" for details.
[root@aldebaran ~]# systemctl status systemd-time-wait-sync.service
× systemd-time-wait-sync.service - Wait Until Kernel Time Synchronized
     Loaded: loaded (/usr/lib/systemd/system/systemd-time-wait-sync.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Sat 2022-05-14 07:59:03 UTC; 21s ago
       Docs: man:systemd-time-wait-sync.service(8)
    Process: 200784 ExecStart=/usr/lib/systemd/systemd-time-wait-sync (code=exited, status=1/FAILURE)
   Main PID: 200784 (code=exited, status=1/FAILURE)
        CPU: 19ms

May 14 07:59:03 aldebaran.lan systemd[1]: Starting systemd-time-wait-sync.service - Wait Until Kernel Time Synchronized...
May 14 07:59:03 aldebaran.lan systemd-time-wait-sync[200784]: Failed to add a watch for /run/systemd/: Permission denied
May 14 07:59:03 aldebaran.lan systemd[1]: systemd-time-wait-sync.service: Main process exited, code=exited, status=1/FAILURE
May 14 07:59:03 aldebaran.lan systemd[1]: systemd-time-wait-sync.service: Failed with result 'exit-code'.
May 14 07:59:03 aldebaran.lan systemd[1]: Failed to start systemd-time-wait-sync.service - Wait Until Kernel Time Synchronize>
[root@aldebaran ~]#

Comment 6 Fabio Alessandro Locati 2022-12-17 16:33:55 UTC
I've opened https://github.com/fedora-selinux/selinux-policy/pull/1526 that fixes the problem, at least in my case!

Comment 7 Ben Cotton 2023-04-25 16:42:51 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 8 Ludek Smid 2023-05-25 18:20:09 UTC
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16.

Fedora Linux 36 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.