From 0564ce48c9e5f6ca3a82194018db82b4e696d50b Mon Sep 17 00:00:00 2001 From: Prince George <45705344+prgeor@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:37:12 -0800 Subject: [PATCH] [baseimage]: Update smartmontool version >= v7.4 (#17635) Why I did it Update smartmontool verson to 7.4. This is done to prevent smartmontools service to exit with non-zero exit status on platform that does not have a SSD/disk to be monitored. Until Debian Bullseye (which had smartmontools 7.2), Debian had a patch applied that changed the default quit mode to never exit. A bug report was filed on Debian, saying that the source code patch isn't needed and could just be done via command line options, and also that smartmontools 7.3 has a new built-in option to exit with 0 if there are no monitorable devices found (which prevents systemd from treating it as a service failure). Because of that, Debian Bookworm (which also upgraded to 7.3) removed the patch and restored the default behavior of exiting with exit code 17 if there are no devices found. Smartmontools v7.3 has this issue, because of which smartd exits with non-zero exit status even with "-q" option. How I did it Update the smartmontools to version 7.4 which has the fix for exiting gracefully if no monitoring device is found Added smartd option "-q nodev0" to allow smartd to exit with status 0 if no monitoring device found --- files/build_templates/sonic_debian_extension.j2 | 3 ++- files/image_config/smartmontools/smartmontools | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 files/image_config/smartmontools/smartmontools diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 5793f6961df3..3dc242cc79a7 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -365,7 +365,8 @@ sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/restart_service # Installed smartmontools version should match installed smartmontools in docker-platform-monitor Dockerfile # TODO: are mismatching versions fine for bookworm? -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install smartmontools +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -t bookworm-backports smartmontools +sudo cp $IMAGE_CONFIGS/smartmontools/smartmontools $FILESYSTEM_ROOT/etc/default/smartmontools # Install custom-built openssh sshd sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_${OPENSSH_VERSION}_*.deb $debs_path/openssh-client_${OPENSSH_VERSION}_*.deb $debs_path/openssh-sftp-server_${OPENSSH_VERSION}_*.deb diff --git a/files/image_config/smartmontools/smartmontools b/files/image_config/smartmontools/smartmontools new file mode 100644 index 000000000000..443322992096 --- /dev/null +++ b/files/image_config/smartmontools/smartmontools @@ -0,0 +1,8 @@ +# Defaults for smartmontools initscript (/etc/init.d/smartmontools) +# This is a POSIX shell fragment + +# List of devices you want to explicitly enable S.M.A.R.T. for +# Not needed (and not recommended) if the device is monitored by smartd +#enable_smart="/dev/hda /dev/hdb" + +smartd_opts="-q nodev0" \ No newline at end of file