Я пытаюсь настроить NTP-сервер GPS на моем SBC под управлением Ubuntu 20.04 (без головы), но у меня проблема с конфигурацией. Когда я перезагружаюсь, я получаю следующее:
$ ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*_gateway 163.237.218.18 2 u 22 64 1 2.727 0.011 0.159
/etc/ntp.conf говорит:
pool 1.ubuntu.pool.ntp.org iburst
pool 2.ubuntu.pool.ntp.org iburst
pool 3.ubuntu.pool.ntp.org iburst
# Use Ubuntu's ntp server as a fallback.
#pool ntp.ubuntu.com
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Needed for adding pool entries
restrict source notrap nomodify noquery
# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust
# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255
# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
# GPS Serial data reference
server 127.127.28.0 minpoll 4 maxpoll 4
fudge 127.127.28.0 time1 0.0 refid GPS
# GPS PPS reference
server 127.127.28.1 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.1 refid PPS
/ etc / ntp / step-tickers
пусто
Я нашел в Интернете конфигурацию для создания «устройства» который будет работать как сервер времени GPS, и он сказал:
$ su -
# killall -9 gpsd ntpd
# gpsd -n /dev/ttyXX
# sleep 2
# ntpd -gN
# sleep 2
# cgps
и это работает
root@ubuntu:/home/zach# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
0.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000
1.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000
2.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000
3.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000
*SHM(0) .GPS. 0 l 8 16 1 0.000 -40.232 0.000
SHM(1) .PPS. 0 l - 16 0 0.000 0.000 0.000
есть идеи, почему я не могу заставить ntp читать /etc/ntp.conf при загрузке?
РЕДАКТИРОВАТЬ: Я не уверен, что gpsd запускается при запуске.
Сделал dmesg | grep gps и ничего не подошло.
Затем я написал сценарий bash с этой строкой killall. Я не думаю, что он будет работать (@startup sh в crontab), потому что он должен быть повышен.
Я пробовал использовать init.d (я действительно не знаю, что я там делаю) и получаю сообщение об ошибке audit: type = 1400 audit (1636322022.316: 45): apparmor = "DENIED" operation = "ptrace" profile = "/ usr / sbin / gpsd" pid = 2794 comm = "gpsd" required_mask = "read" denied_mask = "read" peer = "/ usr / sbin / ntpd"