全球主机交流论坛

标题: 不懂就问,请大佬指点 [打印本页]

作者: 404-not-found    时间: 2019-12-7 12:37
标题: 不懂就问,请大佬指点
系统环境Debian10,某妇抢程序需要时间精准,所以用了ntp,但是ntp服务无法启动。

如下

  1. root@PH:~# apt-get install ntp
  2. 正在读取软件包列表... 完成
  3. 正在分析软件包的依赖关系树      
  4. 正在读取状态信息... 完成      
  5. 建议安装:
  6.   ntp-doc
  7. 下列【新】软件包将被安装:
  8.   ntp
  9. 升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
  10. 需要下载 761 kB 的归档。
  11. 解压缩后会消耗 2,062 kB 的额外空间。
  12. 获取:1 http://ftp.ca.debian.org/debian buster/main amd64 ntp amd64 1:4.2.8p12+dfsg-4 [761 kB]
  13. 已下载 761 kB,耗时 1秒 (1,336 kB/s)
  14. 正在选中未选择的软件包 ntp。
  15. (正在读取数据库 ... 系统当前共安装有 24680 个文件和目录。)
  16. 准备解压 .../ntp_1%3a4.2.8p12+dfsg-4_amd64.deb  ...
  17. 正在解压 ntp (1:4.2.8p12+dfsg-4) ...
  18. 正在设置 ntp (1:4.2.8p12+dfsg-4) ...
  19. Created symlink /etc/systemd/system/multi-user.target.wants/ntp.service → /lib/systemd/system/ntp.service.
  20. Job for ntp.service failed because of unavailable resources or another system error.
  21. See "systemctl status ntp.service" and "journalctl -xe" for details.
  22. invoke-rc.d: initscript ntp, action "start" failed.
  23. ● ntp.service - Network Time Service
  24.    Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
  25.    Active: failed (Result: resources)
  26.      Docs: man:ntpd(8)

  27. 12月 07 01:43:41 PH.Paleur systemd[1]: ntp.service: Failed to run 'start' task: No such file or directory
  28. 12月 07 01:43:41 PH.Paleur systemd[1]: ntp.service: Failed with result 'resources'.
  29. 12月 07 01:43:41 PH.Paleur systemd[1]: Failed to start Network Time Service.
  30. 12月 07 01:56:32 PH.Paleur systemd[1]: ntp.service: Failed to run 'start' task: No such file or directory
  31. 12月 07 01:56:32 PH.Paleur systemd[1]: ntp.service: Failed with result 'resources'.
  32. 12月 07 01:56:32 PH.Paleur systemd[1]: Failed to start Network Time Service.
  33. 12月 07 12:29:53 PH.Paleur systemd[1]: ntp.service: Failed to run 'start' task: No such file or directory
  34. 12月 07 12:29:53 PH.Paleur systemd[1]: ntp.service: Failed with result 'resources'.
  35. 12月 07 12:29:53 PH.Paleur systemd[1]: Failed to start Network Time Service.
  36. dpkg: 处理软件包 ntp (--configure)时出错:
  37. 已安装 ntp 软件包 post-installation 脚本 子进程返回错误状态 1
  38. 正在处理用于 systemd (241-7~deb10u2) 的触发器 ...
  39. 在处理时有错误发生:
  40. ntp
  41. E: Sub-process /usr/bin/dpkg returned an error code (1)
复制代码


菜鸡一个,不知道怎么处理,求大佬指点
作者: hehe    时间: 2019-12-7 12:49
提示: 作者被禁止或删除 内容自动屏蔽
作者: 404-not-found    时间: 2019-12-7 12:55
hehe 发表于 2019-12-7 12:49
Debian 10 为什么还用 ntp ?

直接从Debian8升级上来的,请问还能使用什么网络同步时间的软件吗?
作者: hehe    时间: 2019-12-7 13:02
提示: 作者被禁止或删除 内容自动屏蔽
作者: 404-not-found    时间: 2019-12-7 13:10
hehe 发表于 2019-12-7 13:02
CentOS官方嫌 ntp 在老旧硬件设备和网络不稳定的环境都会出现时间不准的问题,从 CentOS 7 开始系统内置 ...

之前Debian8我修改好时区和时间后,过几天就发现时间不对了。
所以用了ntp。
请问大佬说的这个内置的校时服务名称是?我查一下怎么使用
网上能找到的校时服务都是ntp的教程
作者: hehe    时间: 2019-12-7 13:15
提示: 作者被禁止或删除 内容自动屏蔽
作者: 404-not-found    时间: 2019-12-7 13:24
hehe 发表于 2019-12-7 13:15
不用设置,默认就是开机自动启动的

大佬,您看

  1. root@PH:~# systemctl status systemd-timesyncd
  2. ● systemd-timesyncd.service - Network Time Synchronization
  3.    Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  4.   Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
  5.            └─disable-with-time-daemon.conf
  6.    Active: failed (Result: resources) since Sat 2019-12-07 13:18:49 CST; 4min 45s ago
  7.      Docs: man:systemd-timesyncd.service(8)

  8. 12月 07 13:18:49 PH.Paleur systemd[1]: systemd-timesyncd.service: Service has no hold-off time (RestartSec=0), sched
  9. uling restart.
  10. 12月 07 13:18:49 PH.Paleur systemd[1]: systemd-timesyncd.service: Scheduled restart job, restart counter is at 5.
  11. 12月 07 13:18:49 PH.Paleur systemd[1]: Stopped Network Time Synchronization.
  12. 12月 07 13:18:49 PH.Paleur systemd[1]: systemd-timesyncd.service: Start request repeated too
  13. quickly.
  14. 12月 07 13:18:49 PH.Paleur systemd[1]: systemd-timesyncd.service: Failed with result 'resour
  15. ces'.
  16. 12月 07 13:18:49 PH.Paleur systemd[1]: Failed to start Network Time Synchronization.
复制代码

作者: hehe    时间: 2019-12-7 13:37
提示: 作者被禁止或删除 内容自动屏蔽
作者: hehe    时间: 2019-12-7 13:38
提示: 作者被禁止或删除 内容自动屏蔽
作者: 404-not-found    时间: 2019-12-7 13:48
hehe 发表于 2019-12-7 13:37
第一步:卸载 ntp
第二步:激活 systemd-timesyncd 开机自启动
第三步:重启服务器

还是和上面的报错一样

  1. root@PH:~# systemctl status systemd-timesyncd
  2. ● systemd-timesyncd.service - Network Time Synchronization
  3.    Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  4.   Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
  5.            └─disable-with-time-daemon.conf
  6.    Active: failed (Result: resources) since Sat 2019-12-07 13:39:16 CST; 7min ago
  7.      Docs: man:systemd-timesyncd.service(8)

  8. 12月 07 13:39:16 PH.Paleur systemd[1]: systemd-timesyncd.service: Service has no hold-off time (RestartSec=0), sched
  9. uling restart.
  10. 12月 07 13:39:16 PH.Paleur systemd[1]: systemd-timesyncd.service: Scheduled restart job, restart counter is at 5.
  11. 12月 07 13:39:16 PH.Paleur systemd[1]: Stopped Network Time Synchronization.
  12. 12月 07 13:39:16 PH.Paleur systemd[1]: systemd-timesyncd.service: Start request repeated too
  13. quickly.
  14. 12月 07 13:39:16 PH.Paleur systemd[1]: systemd-timesyncd.service: Failed with result 'resour
  15. ces'.
  16. 12月 07 13:39:16 PH.Paleur systemd[1]: Failed to start Network Time Synchronization.
复制代码

作者: 404-not-found    时间: 2019-12-7 13:54
hehe 发表于 2019-12-7 13:38
另外,你看一下 systemd-timesyncd 配置文件
  1. #  This file is part of systemd.
  2. #
  3. #  systemd is free software; you can redistribute it and/or modify it
  4. #  under the terms of the GNU Lesser General Public License as published by
  5. #  the Free Software Foundation; either version 2.1 of the License, or
  6. #  (at your option) any later version.
  7. #
  8. # Entries in this file show the compile time defaults.
  9. # You can change settings by editing this file.
  10. # Defaults can be restored by simply deleting this file.
  11. #
  12. # See timesyncd.conf(5) for details.

  13. [Time]
  14. #NTP=
  15. #FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
  16. #RootDistanceMaxSec=5
  17. #PollIntervalMinSec=32
  18. #PollIntervalMaxSec=2048
复制代码



是不是这个文件有问题
作者: hehe    时间: 2019-12-7 13:54
提示: 作者被禁止或删除 内容自动屏蔽
作者: hehe    时间: 2019-12-7 13:55
提示: 作者被禁止或删除 内容自动屏蔽
作者: 404-not-found    时间: 2019-12-7 14:01
hehe 发表于 2019-12-7 13:55
第 15 行,改成:

更改以后

  1. root@PH:~# systemctl restart systemd-timesyncd
  2. Job for systemd-timesyncd.service failed because of unavailable resources or another system error.
  3. See "systemctl status systemd-timesyncd.service" and "journalctl -xe" for details.
  4. root@PH:~# systemctl status systemd-timesyncd.service
  5. ● systemd-timesyncd.service - Network Time Synchronization
  6.    Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  7.   Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
  8.            └─disable-with-time-daemon.conf
  9.    Active: failed (Result: resources) since Sat 2019-12-07 14:00:24 CST; 3s ago
  10.      Docs: man:systemd-timesyncd.service(8)

  11. 12月 07 14:00:24 PH.Paleur systemd[1]: systemd-timesyncd.service: Service has no hold-off time (RestartSec=0), sched
  12. uling restart.
  13. 12月 07 14:00:24 PH.Paleur systemd[1]: systemd-timesyncd.service: Scheduled restart job, restart counter is at 5.
  14. 12月 07 14:00:24 PH.Paleur systemd[1]: Stopped Network Time Synchronization.
  15. 12月 07 14:00:24 PH.Paleur systemd[1]: systemd-timesyncd.service: Start request repeated too
  16. quickly.
  17. 12月 07 14:00:24 PH.Paleur systemd[1]: systemd-timesyncd.service: Failed with result 'resour
  18. ces'.
  19. 12月 07 14:00:24 PH.Paleur systemd[1]: Failed to start Network Time Synchronization.
  20. root@PH:~# journalctl -xe
  21. -- Logs begin at Sat 2019-12-07 13:39:15 CST, end at Sat 2019-12-07 14:00:24 CST. --
  22. 12月 07 13:39:15 PH.Paleur kernel: Linux version 4.19.0-6-amd64 ([email protected].
  23. org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11)
  24. 12月 07 13:39:15 PH.Paleur kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-4.19.0-6-amd64 root=UUID=4984a3df-70a6-4e6
  25. 6-a914-d36d2b2ee82a ro quiet
  26. 12月 07 13:39:15 PH.Paleur kernel: Disabled fast string operations
  27. 12月 07 13:39:15 PH.Paleur kernel: x86/fpu: x87 FPU will use FXSAVE
  28. 12月 07 13:39:15 PH.Paleur kernel: BIOS-provided physical RAM map:
  29. 12月 07 13:39:15 PH.Paleur kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009dbff] usable
  30. 12月 07 13:39:15 PH.Paleur kernel: BIOS-e820: [mem 0x000000000009dc00-0x000000000009ffff] reserved
  31. 12月 07 13:39:15 PH.Paleur kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
  32. 12月 07 13:39:15 PH.Paleur kernel: BIOS-e820: [mem 0x0000000000100000-0x000000001fffcfff] usable
  33. 12月 07 13:39:15 PH.Paleur kernel: BIOS-e820: [mem 0x000000001fffd000-0x000000001fffffff] reserved
  34. 12月 07 13:39:15 PH.Paleur kernel: BIOS-e820: [mem 0x00000000fffbc000-0x00000000ffffffff] reserved
  35. 12月 07 13:39:15 PH.Paleur kernel: NX (Execute Disable) protection: active
  36. 12月 07 13:39:15 PH.Paleur kernel: SMBIOS 2.4 present.
  37. 12月 07 13:39:15 PH.Paleur kernel: DMI: Red Hat KVM, BIOS 0.5.1 01/01/2007
  38. 12月 07 13:39:15 PH.Paleur kernel: Hypervisor detected: KVM
  39. 12月 07 13:39:15 PH.Paleur kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00
  40. 12月 07 13:39:15 PH.Paleur kernel: kvm-clock: cpu 0, msr f9e4001, primary cpu clock
  41. 12月 07 13:39:15 PH.Paleur kernel: kvm-clock: using sched offset of 95782066144338 cycles
  42. 12月 07 13:39:15 PH.Paleur kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_i
  43. dle_ns: 881590591483 ns
  44. 12月 07 13:39:15 PH.Paleur kernel: tsc: Detected 2199.998 MHz processor
  45. 12月 07 13:39:15 PH.Paleur kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reser
  46. ved
  47. 12月 07 13:39:15 PH.Paleur kernel: e820: remove [mem 0x000a0000-0x000fffff] usable
  48. 12月 07 13:39:15 PH.Paleur kernel: last_pfn = 0x1fffd max_arch_pfn = 0x400000000
  49. 12月 07 13:39:15 PH.Paleur kernel: MTRR default type: write-back
  50. 12月 07 13:39:15 PH.Paleur kernel: MTRR fixed ranges enabled:
  51. 12月 07 13:39:15 PH.Paleur kernel:   00000-9FFFF write-back
  52. 12月 07 13:39:15 PH.Paleur kernel:   A0000-BFFFF uncachable
  53. 12月 07 13:39:15 PH.Paleur kernel:   C0000-FFFFF write-protect
复制代码





欢迎光临 全球主机交流论坛 (https://loc.888543.xyz/) Powered by Discuz! X3.4