diff --git a/build_debian.sh b/build_debian.sh index ba716003530..76bcbba7b84 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -210,7 +210,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in vim \ tcpdump \ dbus \ - ntp \ ntpstat \ openssh-server \ python \ diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index f78d4c2d146..46c243148b9 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -120,6 +120,10 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $python_debs_path/python-sonic-utilities_*. # in bash.bashrc, so we copy a version of the file with it enabled here. sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ +# Install NTP version 4.2.6 this way until required fix is available for Jessie. +sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/ntp_4.2.6*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # Install SONiC Device Data (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-device-data_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f diff --git a/rules/ntp.mk b/rules/ntp.mk new file mode 100644 index 00000000000..668e663ce94 --- /dev/null +++ b/rules/ntp.mk @@ -0,0 +1,14 @@ +# ntp_4.2.6.p5+dfsg-7+deb8u2.deb + +NTP_VERSION_MAJOR = 4.2.6 +NTP_VERSION_SUFFIX = .p5+dfsg +NTP_VERSION_SUFFIX_NUM = 7+deb8u2 +NTP_VERSION_FULL = $(NTP_VERSION_MAJOR)$(NTP_VERSION_SUFFIX)-$(NTP_VERSION_SUFFIX_NUM) +NTP_VERSION = $(NTP_VERSION_MAJOR)$(NTP_VERSION_SUFFIX) + +export NTP_VERSION NTP_VERSION_FULL + +NTP = ntp_$(NTP_VERSION_FULL)_amd64.deb +$(NTP)_SRC_PATH = $(SRC_PATH)/ntp +SONIC_MAKE_DEBS += $(NTP) +SONIC_STRETCH_DEBS += $(NTP) diff --git a/slave.mk b/slave.mk index 63829be0791..d84112e731e 100644 --- a/slave.mk +++ b/slave.mk @@ -533,6 +533,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(LINUX_KERNEL) \ $(SONIC_DEVICE_DATA) \ $(PYTHON_CLICK) \ + $(NTP) \ $(LIBPAM_TACPLUS) \ $(LIBNSS_TACPLUS)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile index 717ee25419d..16f2c9914ff 100644 --- a/sonic-slave-stretch/Dockerfile +++ b/sonic-slave-stretch/Dockerfile @@ -212,7 +212,12 @@ RUN apt-get update && apt-get install -y \ python3-pytest \ python3-colorama \ # For initramfs - bash-completion + bash-completion \ +# For ntp + autogen \ + libopts25-dev \ + pps-tools \ + dh-apparmor # For linux build RUN apt-get -y build-dep linux diff --git a/src/ntp/Makefile b/src/ntp/Makefile new file mode 100644 index 00000000000..0475320d8c1 --- /dev/null +++ b/src/ntp/Makefile @@ -0,0 +1,28 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e + +MAIN_TARGET = ntp_$(NTP_VERSION_FULL)_amd64.deb + +NTP_URL = http://cdn-fastly.deb.debian.org/debian/pool/main/n/ntp + +DSC_FILE = ntp_$(NTP_VERSION_FULL).dsc +DSC_FILE_URL = $(NTP_URL)/$(DSC_FILE) + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf ntp-$(NTP_VERSION) + dget -u $(DSC_FILE_URL) + + pushd ntp-$(NTP_VERSION) + + git init + git add -f * + git commit -m "original source files" + + stg init + stg import -s ../patch/series + + dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + mv $* $(DEST)/ diff --git a/src/ntp/patch/0001-donot-disable-reader-kernel-enobufs.patch b/src/ntp/patch/0001-donot-disable-reader-kernel-enobufs.patch new file mode 100644 index 00000000000..f44701e6764 --- /dev/null +++ b/src/ntp/patch/0001-donot-disable-reader-kernel-enobufs.patch @@ -0,0 +1,31 @@ +commit 1534de6d3ef2d188d1e2697f7180786ee5a8a9dc +Author: Praveen Chaudhary +Date: Sat Feb 2 20:12:53 2019 -0800 + + [ntp_io.c]: Do not disable reader for error ENOBUFS. + + Signed-off-by: Praveen Chaudhary + +diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c +index f2a2404..fe5c94d 100644 +--- a/ntpd/ntp_io.c ++++ b/ntpd/ntp_io.c +@@ -4430,10 +4430,14 @@ process_routing_msgs(struct asyncio_reader *reader) + cnt = read(reader->fd, buffer, sizeof(buffer)); + + if (cnt < 0) { +- msyslog(LOG_ERR, +- "i/o error on routing socket %m - disabling"); +- remove_asyncio_reader(reader); +- delete_asyncio_reader(reader); ++ if (errno == ENOBUFS) { ++ msyslog(LOG_ERR, "routing socket reports: %m"); ++ } else { ++ msyslog(LOG_ERR, ++ "i/o error on routing socket %m - disabling"); ++ remove_asyncio_reader(reader); ++ delete_asyncio_reader(reader); ++ } + return; + } + diff --git a/src/ntp/patch/series b/src/ntp/patch/series new file mode 100644 index 00000000000..c5fa8dfb7ba --- /dev/null +++ b/src/ntp/patch/series @@ -0,0 +1 @@ +0001-donot-disable-reader-kernel-enobufs.patch