在 ubuntu 16.04 上安装 Chrony 时出错

在 ubuntu 16.04 上安装 Chrony 时出错

在 Ubuntu 16.04 上安装时出错chrony,安装失败并出现错误,错误如下所示。请帮助我修复该问题以便chrony成功安装和配置。

root@ip-10-200-0-188:~# apt-get install chrony

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages were automatically installed and are no longer required:

  libopts25 linux-aws-headers-4.4.0-1057 linux-aws-headers-4.4.0-1060
  linux-aws-headers-4.4.0-1061 linux-aws-headers-4.4.0-1062
  linux-aws-headers-4.4.0-1065 linux-aws-headers-4.4.0-1066
  linux-aws-headers-4.4.0-1069 linux-aws-headers-4.4.0-1070
  linux-aws-headers-4.4.0-1072 linux-aws-headers-4.4.0-1074
  linux-aws-headers-4.4.0-1075 linux-aws-headers-4.4.0-1077
  linux-aws-headers-4.4.0-1079 linux-aws-headers-4.4.0-1083
  linux-aws-headers-4.4.0-1084 linux-aws-headers-4.4.0-1085
  linux-aws-headers-4.4.0-1087 linux-aws-headers-4.4.0-1088
  linux-aws-headers-4.4.0-1090 linux-aws-headers-4.4.0-1092
  linux-aws-headers-4.4.0-1094 linux-aws-headers-4.4.0-1095
  linux-aws-headers-4.4.0-1096 linux-aws-headers-4.4.0-1098
  linux-aws-headers-4.4.0-1099 linux-aws-headers-4.4.0-1100
  linux-aws-headers-4.4.0-1101 linux-headers-4.4.0-1057-aws
  linux-headers-4.4.0-1060-aws linux-headers-4.4.0-1061-aws
  linux-headers-4.4.0-1062-aws linux-headers-4.4.0-1065-aws
  linux-headers-4.4.0-1066-aws linux-headers-4.4.0-1069-aws
  linux-headers-4.4.0-1070-aws linux-headers-4.4.0-1072-aws
  linux-headers-4.4.0-1074-aws linux-headers-4.4.0-1075-aws
  linux-headers-4.4.0-1077-aws linux-headers-4.4.0-1079-aws
  linux-headers-4.4.0-1083-aws linux-headers-4.4.0-1084-aws
  linux-headers-4.4.0-1085-aws linux-headers-4.4.0-1087-aws
  linux-headers-4.4.0-1088-aws linux-headers-4.4.0-1090-aws
  linux-headers-4.4.0-1092-aws linux-headers-4.4.0-1094-aws
  linux-headers-4.4.0-1095-aws linux-headers-4.4.0-1096-aws
  linux-headers-4.4.0-1098-aws linux-headers-4.4.0-1099-aws
  linux-headers-4.4.0-1100-aws linux-headers-4.4.0-1101-aws
  linux-image-4.4.0-1057-aws linux-image-4.4.0-1060-aws
  linux-image-4.4.0-1061-aws linux-image-4.4.0-1062-aws
  linux-image-4.4.0-1065-aws linux-image-4.4.0-1066-aws
  linux-image-4.4.0-1069-aws linux-image-4.4.0-1070-aws
  linux-image-4.4.0-1072-aws linux-image-4.4.0-1074-aws
  linux-image-4.4.0-1075-aws linux-image-4.4.0-1077-aws
  linux-image-4.4.0-1079-aws linux-image-4.4.0-1083-aws
  linux-image-4.4.0-1084-aws linux-image-4.4.0-1085-aws
  linux-image-4.4.0-1087-aws linux-image-4.4.0-1088-aws
  linux-image-4.4.0-1090-aws linux-image-4.4.0-1092-aws
  linux-image-4.4.0-1094-aws linux-image-4.4.0-1095-aws
  linux-image-4.4.0-1096-aws linux-image-4.4.0-1098-aws
  linux-image-4.4.0-1099-aws linux-image-4.4.0-1100-aws
  linux-image-4.4.0-1101-aws linux-modules-4.4.0-1077-aws
  linux-modules-4.4.0-1079-aws linux-modules-4.4.0-1083-aws
  linux-modules-4.4.0-1084-aws linux-modules-4.4.0-1085-aws
  linux-modules-4.4.0-1087-aws linux-modules-4.4.0-1088-aws
  linux-modules-4.4.0-1090-aws linux-modules-4.4.0-1092-aws
  linux-modules-4.4.0-1094-aws linux-modules-4.4.0-1095-aws
  linux-modules-4.4.0-1096-aws linux-modules-4.4.0-1098-aws
  linux-modules-4.4.0-1099-aws linux-modules-4.4.0-1100-aws
  linux-modules-4.4.0-1101-aws

Use 'apt autoremove' to remove them.

The following additional packages will be installed:

  libtomcrypt0 libtommath0 timelimit

The following packages will be REMOVED:
  ntp

The following NEW packages will be installed:

  chrony libtomcrypt0 libtommath0 timelimit

0 upgraded, 4 newly installed, 1 to remove and 101 not upgraded.

1 not fully installed or removed.

Need to get 585 kB of archives.

After this operation, 66.6 kB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/universe amd64 timelimit amd64 1.8-1 [12.2 kB]
Get:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 libtommath0 amd64 0.42.0-1.2 [41.8 kB]
Get:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 libtomcrypt0 amd64 1.17-7ubuntu0.1 [286 kB]
Get:4 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 chrony amd64 2.1.1-1ubuntu0.1 [246 kB]

Fetched 585 kB in 0s (19.9 MB/s)
(Reading database ... 821343 files and directories currently installed.)
Removing ntp (1:4.2.8p4+dfsg-3ubuntu5.10) ...
Processing triggers for man-db (2.7.5-1) ...
Selecting previously unselected package timelimit.
(Reading database ... 821299 files and directories currently installed.)
Preparing to unpack .../timelimit_1.8-1_amd64.deb ...
Unpacking timelimit (1.8-1) ...
Selecting previously unselected package libtommath0.
Preparing to unpack .../libtommath0_0.42.0-1.2_amd64.deb ...
Unpacking libtommath0 (0.42.0-1.2) ...
Selecting previously unselected package libtomcrypt0:amd64.
Preparing to unpack .../libtomcrypt0_1.17-7ubuntu0.1_amd64.deb ...
Unpacking libtomcrypt0:amd64 (1.17-7ubuntu0.1) ...

Selecting previously unselected package chrony.

Preparing to unpack .../chrony_2.1.1-1ubuntu0.1_amd64.deb ...

Unpacking chrony (2.1.1-1ubuntu0.1) ...

Processing triggers for man-db (2.7.5-1) ...

Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.27) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up timelimit (1.8-1) ...
Setting up libtommath0 (0.42.0-1.2) ...
Setting up libtomcrypt0:amd64 (1.17-7ubuntu0.1) ...

Setting up chrony (2.1.1-1ubuntu0.1) ...

Creating '_chrony' system user/group for the chronyd daemon…

chage: /etc/passwd.16630: Permission denied

chage: cannot lock /etc/passwd; try again later.

Stopped: `/usr/bin/chage -M 99999 _chrony' returned error code 1. Exiting.

Removing user `_chrony' ...

Removing group `_chrony' ...

groupdel: group '_chrony' does not exist

adduser: `groupdel _chrony' returned error code 6. Exiting.

dpkg: error processing package chrony (--configure):

 subprocess installed post-installation script returned error exit status 1

Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.27) ...
Processing triggers for ureadahead (0.100.0-19) ...

******Errors were encountered while processing:chrony

E: Sub-process /usr/bin/dpkg returned an error code (1)******

root@ip-10-200-0-188:~#

答案1

您的问题的核心是chage: /etc/passwd.16630: Permission denied;诀窍是找出原因。

你的根文件系统是否可写?(用来mount检查 - 它应该rw在选项中有。)你是否正在运行某种安全软件,可以拒绝对通常可写的文件的写入?

有关其他故障排除建议,请查看以下主题:

问题似乎不是 xenial 上的 chrony 包本身的问题。以下是在 t2.nano 实例上全新安装的日志:

# apt-get install chrony
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libopts25
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libtomcrypt0 libtommath0 timelimit
The following packages will be REMOVED:
  ntp
The following NEW packages will be installed:
  chrony libtomcrypt0 libtommath0 timelimit
0 upgraded, 4 newly installed, 1 to remove and 0 not upgraded.
Need to get 585 kB of archives.
After this operation, 66.6 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu xenial/universe amd64 timelimit amd64 1.8-1 [12.2 kB]
Get:2 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 libtommath0 amd64 0.42.0-1.2 [41.8 kB]
Get:3 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 libtomcrypt0 amd64 1.17-7ubuntu0.1 [286 kB]
Get:4 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 chrony amd64 2.1.1-1ubuntu0.1 [246 kB]
Fetched 585 kB in 0s (817 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "en_AU.UTF-8",
    LC_MONETARY = "en_AU.UTF-8",
    LC_ADDRESS = "en_AU.UTF-8",
    LC_TELEPHONE = "en_AU.UTF-8",
    LC_NAME = "en_AU.UTF-8",
    LC_MEASUREMENT = "en_AU.UTF-8",
    LC_IDENTIFICATION = "en_AU.UTF-8",
    LC_NUMERIC = "en_AU.UTF-8",
    LC_PAPER = "en_AU.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 76650 files and directories currently installed.)
Removing ntp (1:4.2.8p4+dfsg-3ubuntu5.10) ...
Processing triggers for man-db (2.7.5-1) ...
Selecting previously unselected package timelimit.
(Reading database ... 76600 files and directories currently installed.)
Preparing to unpack .../timelimit_1.8-1_amd64.deb ...
Unpacking timelimit (1.8-1) ...
Selecting previously unselected package libtommath0.
Preparing to unpack .../libtommath0_0.42.0-1.2_amd64.deb ...
Unpacking libtommath0 (0.42.0-1.2) ...
Selecting previously unselected package libtomcrypt0:amd64.
Preparing to unpack .../libtomcrypt0_1.17-7ubuntu0.1_amd64.deb ...
Unpacking libtomcrypt0:amd64 (1.17-7ubuntu0.1) ...
Selecting previously unselected package chrony.
Preparing to unpack .../chrony_2.1.1-1ubuntu0.1_amd64.deb ...
Unpacking chrony (2.1.1-1ubuntu0.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for systemd (229-4ubuntu21.27) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Setting up timelimit (1.8-1) ...
Setting up libtommath0 (0.42.0-1.2) ...
Setting up libtomcrypt0:amd64 (1.17-7ubuntu0.1) ...
Setting up chrony (2.1.1-1ubuntu0.1) ...
Creating '_chrony' system user/group for the chronyd daemon…
locale: Cannot set LC_ALL to default locale: No such file or directory

Creating config file /etc/chrony/chrony.conf with new version
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for systemd (229-4ubuntu21.27) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
root@ip-172-31-5-4:~# chronyc -n sources
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^+ 62.141.38.69                  3   6    17    28   -497us[+1286us] +/-  199ms
^* 94.23.2.80                    2   6    17    27  -3586us[-1803us] +/-  167ms
^+ 193.106.166.105               2   6    17    27   +507us[+2290us] +/-  195ms
^+ 193.150.22.36                 2   6    17    28  +4712us[+6495us] +/-  188ms
root@ip-172-31-5-4:~# chronyc -n tracking
Reference ID    : 94.23.2.80 (94.23.2.80)
Stratum         : 3
Ref time (UTC)  : Sat Apr 25 21:14:52 2020
System time     : 0.000001804 seconds slow of NTP time
Last offset     : +0.001783259 seconds
RMS offset      : 0.001783259 seconds
Frequency       : 0.000 ppm fast
Residual freq   : +15.871 ppm
Skew            : 1000000.000 ppm
Root delay      : 0.280353 seconds
Root dispersion : 33.553082 seconds
Update interval : 2.3 seconds

相关内容