AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1356425
Accepted
Rucent88
Rucent88
Asked: 2021-08-07 12:19:36 +0800 CST2021-08-07 12:19:36 +0800 CST 2021-08-07 12:19:36 +0800 CST

为什么时间不同步?

  • 772

我想要时间同步,但不是。我尝试运行以下命令,但它仍然没有同步。

# timedatectl set-ntp off
# timedatectl set-ntp on
# timedatectl status
                      Local time: Fri 2021-08-06 20:01:43 EDT
                  Universal time: Sat 2021-08-07 00:01:43 UTC
                        RTC time: Fri 2021-08-06 20:01:43
                       Time zone: America/New_York (EDT, -0400)
       System clock synchronized: no
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

编辑:更多信息

systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2021-08-07 15:26:10 EDT; 58min ago
     Docs: man:systemd-timesyncd.service(8)
  Process: 9351 ExecStart=/lib/systemd/systemd-timesyncd (code=exited, status=238/STATE_DIRECTORY)
 Main PID: 9351 (code=exited, status=238/STATE_DIRECTORY)


# journalctl -u systemd-timesyncd
1]: systemd-timesyncd.service: Service has no hold-off time, scheduling restart.
1]: systemd-timesyncd.service: Scheduled restart job, restart counter is at 5.
1]: Stopped Network Time Synchronization.
1]: systemd-timesyncd.service: Start request repeated too quickly.
1]: systemd-timesyncd.service: Failed with result 'exit-code'.
1]: Failed to start Network Time Synchronization.

运行 Ubuntu 18.04。互联网工作,可以浏览互联网。

sync
  • 3 3 个回答
  • 4834 Views

3 个回答

  • Voted
  1. Best Answer
    Rucent88
    2021-08-08T09:55:06+08:002021-08-08T09:55:06+08:00

    显然有一个目录权限错误,它会影响多个发行版。解决方案很简单。

    $ sudo chmod 0700 /var/lib/private
    $ sudo systemctl restart systemd-timesyncd
    $ sudo timedatectl status
    

    此外,这可能需要也可能不需要:

    $ sudo rm -r /var/lib/private/systemd
    

    来源: https ://bbs.archlinux.org/viewtopic.php?id=233277

    • 2
  2. Carlos Dagorret
    2021-08-07T12:58:40+08:002021-08-07T12:58:40+08:00
    1. 检查 /etc/ntp.conf 中的 ntp 配置

    $ 猫 /etc/ntp.conf

    ...
    pool 0.ubuntu.pool.ntp.org iburst 
    pool 1.ubuntu.pool.ntp.org iburst 
    pool 2.ubuntu.pool.ntp.org iburst 
    pool 3.ubuntu.pool.ntp.org iburst 
    

    必要时编辑文件 ( nano /etc/ntp.conf)

    1. 运行以下命令重启服务

    sudo service ntp restart

    1. 最后,如果您在系统上启用了 UFW 防火墙,您将需要打开 NTP UDP 端口 123 以进行传入连接:

    $ sudo ufw allow from any to any port 123 proto udp

    • 0
  3. adasiko
    2021-08-08T08:01:37+08:002021-08-08T08:01:37+08:00

    查看日志:journalctl -u systemd-timesyncd

    我的问题是关于根距离参数(我有坏的 Windows Server 同步服务器)。将 RootDistanceMaxSec 从默认值 5 增加到 15 解决了我的问题。

    https://www.freedesktop.org/software/systemd/man/timesyncd.conf.html

    • 0

相关问题

  • 安卓手机能和 Ubuntu 同步吗?

  • 如何将我的 Ubuntu One 音乐同步到 mp3 播放器?

  • 如何使文件夹与外部 USB 硬盘保持同步?

  • 如何与我的 iPhone 3G 同步音乐?[关闭]

  • 保持多个工作站同步

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve