1

I get a problem when install ntp (offline install) because the conflict with time-daemon of systemd-timesyncd.

# dpkg -i ntp_4.2.8p12+dfsg-3ubuntu4.20.04.1_amd64.deb
dpkg: regarding ntp_4.2.8p12+dfsg-3ubuntu4.20.04.1_amd64.deb containing ntp:
 ntp conflicts with time-daemon
  systemd-timesyncd provides time-daemon and is present and installed.

dpkg: error processing archive ntp_4.2.8p12+dfsg-3ubuntu4.20.04.1_amd64.deb (--install): conflicting packages - not installing ntp Errors were encountered while processing: ntp_4.2.8p12+dfsg-3ubuntu4.20.04.1_amd64.deb

any suggest to fix this?

Tks

  • 2
    You cannot have systemd-timesyncd and ntp (which provides the ntp daemon) installed simultaneously because they both use the ntp ports ande protocols. You need to pick one or the other, you can't have both. – Thomas Ward Oct 05 '22 at 03:46
  • so i have to remove systemd-timesyncd, i try to do it but not success.

    '

    – Quang Nguyen Oct 05 '22 at 03:54
  • Why are you using dpkg to install a downloaded version of ntp instead of simply using apt to install the version from the official repository? – mchid Oct 05 '22 at 03:59
  • because the server not connect to internet – Quang Nguyen Oct 05 '22 at 04:01
  • NTP recommends p15 version. Downloaded from https://support.ntp.org/Main/SoftwareDownloads or it links to https://doc.ntp.org/downloads/ and I have done it on my system that still has systemd-timesyncd installed on it. My instructions are for the p12 NTP, but they are the same installation steps but with p15 instead of p12. https://askubuntu.com/questions/1123106/how-to-update-to-latest-ntp-patch-4-2-8p12-on-ubuntu-18-04/1123111#1123111 I would definitely recommend doing it from source. – Terrance Oct 05 '22 at 04:07
  • tks u sir, let me try it – Quang Nguyen Oct 05 '22 at 04:12
  • If the server is not connected to the internet, how do you expect the time synchronization to work? Do you have another server that is connected to the internet or connected to satellite GPS that will provide the time sync? Both NTP and timesyncd require a connection to another server to sync. – Terrance Oct 05 '22 at 12:03
  • 1
    that's right, the server is connected to NTP Server and i want to synchronize time to that NTP Server – Quang Nguyen Oct 06 '22 at 02:01
  • And in all the discussion how to install ntp offline, please do not forget that since 18.04 one should use chrony instead => https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes#Chrony – Christian Ehrhardt Jan 23 '23 at 09:08

3 Answers3

1

ERROR: The following packages have unmet dependencies: chrony: Conflicts: time-daemon ntp: Conflicts: time-daemon

Also face same error in PopOs/Ubuntu. I just ran this line (in terminal) and my problem solved.

sudo apt remove systemd-timesyncd
Kaiyom
  • 11
  • 2
0

NOTE: It would probably be best to obtain a copy of systemd-timesyncd just in case you want to reinstall later.

If you don't have build-essential installed to compile from source as described by @Terrance in the comments, and if you want to remove systemd-timesyncd and install ntp you can use apt instead of dpkg to install the downloaded .deb file and handle the dependency/conflict automatically.

The only difference between dpkg and apt is that you need to use the full path to the downloaded file when using apt. Assuming the downloaded file is in your current directory, you would use:

apt install ./ntp_4.2.8p12+dfsg-3ubuntu4.20.04.1_amd64.deb

or

apt install "./ntp_4.2.8p12+dfsg-3ubuntu4.20.04.1_amd64.deb"
mchid
  • 43,546
  • 8
  • 97
  • 150
  • i try to install ntp p15 but it's still not working
    p# dpkg -i ntp_4.2.8p15+dfsg-1_amd64.deb
    dpkg: regarding ntp_4.2.8p15+dfsg-1_amd64.deb containing ntp:
     ntp conflicts with time-daemon
      systemd-timesyncd provides time-daemon and is present and installed.
    
    dpkg: error processing archive ntp_4.2.8p15+dfsg-1_amd64.deb (--install):
     conflicting packages - not installing ntp
    Errors were encountered while processing:
     ntp_4.2.8p15+dfsg-1_amd64.deb
    
    – Quang Nguyen Oct 05 '22 at 10:07
  • Problem with apt install: apt install /ntp_4.2.8p15+dfsg-1_amd64.deb You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: aptitude : Depends: aptitude-common (= 0.8.12-1ubuntu4) but it is not installed Depends: libboost-iostreams1.71.0 but it is not installed Depends: libsigc++-2.0-0v5 (>= 2.8.0) but it is not installed Depends: libxapian30 (>= 1.4.14~) but it is not installed Recommends: libparse-debianchangelog-perl but it is not installed – Quang Nguyen Oct 05 '22 at 10:40
  • so i think the best way now is connect server to internet to update apt and install ntp? – Quang Nguyen Oct 05 '22 at 10:45
  • @QuangNguyen Yeah, that would be ideal if possible. If it's not possible to connect to the internet, you could download each of those packages into a single directory and then run sudo apt install ./*.deb or sudo apt install "./*.deb" and it should install all the packages at once. I guess it comes down to if it's easier to download each of those packages or easier to connect the server to the internet. Although, connecting the server to the internet does give you the opportunity to do upgrades (which can fix some bugs), install other packages, etc. – mchid Oct 07 '22 at 02:25
  • Of course, the other option would be to uninstall systemd-timesyncd using dpkg -r systemd-timesyncd None of the dependencies listed in your error message are related to ntp so theoretically, you should be able to uninstall systemd-timesyncd and install ntp, assuming there are no more dependencies tied to systemd-timesyncd. – mchid Oct 07 '22 at 02:33
  • And of course, just use dpkg -i ntp_4.2.8p12+dfsg-3ubuntu4.20.04.1_amd64.deb to install ntp. – mchid Oct 07 '22 at 02:35
0

Tks all for the help, i finally fix it:

  • Connect to internet, still can not install ntp
  • Using command 'apt --fix-broken install' as suggest --> it remove systemd-timesyncd and install ntp