From ed14eb526382dffa8c414255347c70800584a907 Mon Sep 17 00:00:00 2001 From: Vivek R Date: Wed, 6 Apr 2022 06:59:47 -0700 Subject: [PATCH] [interfaces-config] "main exception: cannot find interfaces: eth0" error log avoided (#10463) - Why I did it Fixes #9628 During bootup, this error log is seen Dec 22 04:26:29 sonic interfaces-config.sh[2546]: error: main exception: cannot find interfaces: eth0 (interface was probably never up ?) This is of non-functional nature and doesn't affect the flow. - How I did it Dont take the ifdown if not needed - How to verify it Verified during reboot. Log did not appear and IP was acquired on eth0 as expected Signed-off-by: Vivek Reddy Karri --- files/image_config/interfaces/interfaces-config.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 5753bebd37..646fd7a94e 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,6 +1,8 @@ #!/bin/bash -ifdown --force eth0 +if [[ $(ifquery --running eth0) ]]; then + ifdown --force eth0 +fi # Check if ZTP DHCP policy has been installed if [ -e /etc/network/ifupdown2/policy.d/ztp_dhcp.json ]; then