{"action":"created","issue":{"url":"https://api.github.com/repos/fjl/os-timesync/issues/10","repository_url":"https://api.github.com/repos/fjl/os-timesync","labels_url":"https://api.github.com/repos/fjl/os-timesync/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/fjl/os-timesync/issues/10/comments","events_url":"https://api.github.com/repos/fjl/os-timesync/issues/10/events","html_url":"https://github.com/fjl/os-timesync/issues/10","id":292728057,"number":10,"title":"linux support broken","user":{"login":"nonchip","id":601018,"avatar_url":"https://avatars2.githubusercontent.com/u/601018?v=4","gravatar_id":"","url":"https://api.github.com/users/nonchip","html_url":"https://github.com/nonchip","followers_url":"https://api.github.com/users/nonchip/followers","following_url":"https://api.github.com/users/nonchip/following{/other_user}","gists_url":"https://api.github.com/users/nonchip/gists{/gist_id}","starred_url":"https://api.github.com/users/nonchip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nonchip/subscriptions","organizations_url":"https://api.github.com/users/nonchip/orgs","repos_url":"https://api.github.com/users/nonchip/repos","events_url":"https://api.github.com/users/nonchip/events{/privacy}","received_events_url":"https://api.github.com/users/nonchip/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-01-30T10:23:09Z","updated_at":"2018-04-01T01:09:48Z","closed_at":null,"author_association":"NONE","body":"https://github.com/fjl/os-timesync/blob/master/index.js#L46 is essentially a:\r\n```ps -A -o command | grep bin/ntpd```\r\nthis fails unless the used init system/service monitor started ntpd using absolute paths (which, given the fact ntpd almost certainly is in `$PATH`, isn't required at all and usually only introduces more hassle than good, especially with systems that implement a packaged-alternative-management).\r\n\r\nplease consider searching for either just `ntpd` or, even better, parse (or at least count the lines of) the output `ntpq -p` to either check for actual drift (and therefore if the time is in sync, and not just supposed to be) or at least if `ntpq` is able to connect to a local `ntpd` with peers at all\r\n\r\nthis would at least fix the situation for ntpd, but please also be aware there are systems that just use ntpdate in a cronjob to set their internal clock every hour or so, there's nothing much you can do to detect those (except try to use ntpdate (or in the worst case, implementing ntp in js) to query a server and then compare the result to what the host thinks is \"now\"), but then again, those have all other kinds of problems (like time \"jumps\" instead of drift correction etc).\r\n\r\n-----\r\n\r\nActual example situation from one of my hosts (void linux, using runit (= not systemd) with a service file running `ntpd` without absolute path, as is default on that distro):\r\n```\r\n$ ps -AF | grep ntpd\r\nntpd       671   662  0 22258  3628   4 Jan28 ?        00:00:06 ntpd -g -u ntpd:ntpd -n\r\n$ ntpq -p\r\n     remote           refid      st t when poll reach   delay   offset  jitter\r\n==============================================================================\r\n+ole.klickmich.o 129.70.132.33    3 u  975 1024  377   12.844   -3.715   3.538\r\n*37.187.18.4 (de 193.190.230.65   2 u  934 1024  377   17.779   -0.978   0.284\r\n+ns1.tdc.akl.tel 126.11.196.147   2 u  792 1024  377  294.186   -4.806   0.542\r\n```\r\n\r\n* `checkSystemd` resolves to false, this is **correct**, since no systemd running\r\n* `checkNtpd` resolves to false, this is **incorrect**, see output above\r\n* therefore `checkLinux` **incorrectly** resolves to false (correct result propagated from `checkSystemd` but then error propagated from `checkNtpd`)\r\n* and `checkEnabled` also **incorrectly** does so (again, propagated from `checkLinux`)"},"comment":{"url":"https://api.github.com/repos/fjl/os-timesync/issues/comments/377735018","html_url":"https://github.com/fjl/os-timesync/issues/10#issuecomment-377735018","issue_url":"https://api.github.com/repos/fjl/os-timesync/issues/10","id":377735018,"user":{"login":"nonchip","id":601018,"avatar_url":"https://avatars2.githubusercontent.com/u/601018?v=4","gravatar_id":"","url":"https://api.github.com/users/nonchip","html_url":"https://github.com/nonchip","followers_url":"https://api.github.com/users/nonchip/followers","following_url":"https://api.github.com/users/nonchip/following{/other_user}","gists_url":"https://api.github.com/users/nonchip/gists{/gist_id}","starred_url":"https://api.github.com/users/nonchip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nonchip/subscriptions","organizations_url":"https://api.github.com/users/nonchip/orgs","repos_url":"https://api.github.com/users/nonchip/repos","events_url":"https://api.github.com/users/nonchip/events{/privacy}","received_events_url":"https://api.github.com/users/nonchip/received_events","type":"User","site_admin":false},"created_at":"2018-04-01T01:09:48Z","updated_at":"2018-04-01T01:09:48Z","author_association":"NONE","body":">OK, we can search for just ntpd if that works for you.\r\n\r\nthat might be the easiest option i guess. still fails for ntpdate cronjobs et al, but you can't catch every esoteric option.\r\n\r\n> Looks like it's getting harder to maintain this package over time. We already had to give up on macOS support because there is no good way to perform the check there.\r\n\r\nsadly a whole bunch of projects that really shouldn't depend on this (and also on this actually working), for example ethereum (see https://github.com/ethereum/mist/issues/397), and it's not as if THEY don't have the network infrastructure to check a simple timestamp :P\r\nalso they abuse it for \"is out of sync\" instead of \"we can't find it definitely enabled\" :P"}}
{"actor":{"display_login":"nonchip"}}