如何在没有互联网连接的情况下删除 ntp?

如何在没有互联网连接的情况下删除 ntp?

我被要求通过 ntp 同步 ubuntu 20。通常我使用 systemd-timesync 来完成这个任务。在这台电脑上,我执行了 timedatectrl 并得到:

$ timedatectl
               Local time: Mon 2021-03-08 10:24:24 -05
           Universal time: Mon 2021-03-08 15:24:24 UTC
                 RTC time: Mon 2021-03-08 13:23:56
                Time zone: America/Bogota (-05, -0500)
System clock synchronized: no
              NTP service: n/a
          RTC in local TZ: no

然后我看到 ntp 也安装了(顺便问一下,这是现在 ubuntu 20 的默认设置吗?)所以我下载了 systemd-timesyncd rpm 并将其移动到这台电脑然后运行:

~$ sudo dpkg -i systemd-timesyncd_245.4-4ubuntu3_amd64.deb
dpkg: regarding systemd-timesyncd_245.4-4ubuntu3_amd64.deb containing systemd-timesyncd:
 systemd-timesyncd conflicts with time-daemon
  ntp provides time-daemon and is present and installed.

dpkg: error processing archive systemd-timesyncd_245.4-4ubuntu3_amd64.deb (--install):
 conflicting packages - not installing systemd-timesyncd
Errors were encountered while processing:
 systemd-timesyncd_245.4-4ubuntu3_amd64.deb

冲突的包是 ntp 因此我尝试将其删除:

~$ sudo apt remove ntp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libevent-core-2.1-7 libevent-pthreads-2.1-7 libopts25 sntp
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  systemd-timesyncd
The following packages will be REMOVED:
  ntp
The following NEW packages will be installed:
  systemd-timesyncd
0 upgraded, 1 newly installed, 1 to remove and 256 not upgraded.
Need to get 28.1 kB of archives.
After this operation, 1,778 kB disk space will be freed.
Do you want to continue? [Y/n] y
Err:1 http://il.archive.ubuntu.com/ubuntu focal-updates/main amd64 systemd-timesyncd amd64 245.4-4ubuntu3.3
  Temporary failure resolving 'il.archive.ubuntu.com'
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/main/s/systemd/systemd-timesyncd_245.4-4ubuntu3.3_amd64.deb  Temporary failure resolving 'il.archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

以下软件包将被删除:ntp 以下新软件包将被安装:systemd-timesyncd

但是没有互联网连接,所以 apt 无法下载并安装 systemd-timesyncd,然后退出。

有什么想法可以解决这个问题吗?

答案1

我下载了systemd-timesyncd_245.4-4ubuntu3.3_amd64.deb
并将其移至/var/cache/apt/archives/
运行apt remove ntp -y

现在一切都好

相关内容