4af3e5066d
Force "lo" interface down in interfaces-config.sh to prevent interface-config.service from failing with the following error: ``` -- The result is failed. systemd[1]: networking.service: Unit entered failed state. systemd[1]: networking.service: Failed with result 'exit-code'. interfaces-config.sh[29232]: Job for networking.service failed because the control process exited with error code. interfaces-config.sh[29232]: See "systemctl status networking.service" and "journalctl -xe" for details. interfaces-config.sh[29232]: ifdown: interface lo not configured interfaces-config.sh[29232]: RTNETLINK answers: File exists interfaces-config.sh[29232]: ifup: failed to bring up lo systemd[1]: interfaces-config.service: Main process exited, code=exited, status=1/FAILURE systemd[1]: Failed to start Update interfaces configuration. -- Subject: Unit interfaces-config.service has failed ``` Failure to bring down the interface will result in a failure to subsequently bring the interface back up.
24 lines
666 B
Bash
Executable File
24 lines
666 B
Bash
Executable File
#!/bin/bash
|
|
|
|
ifdown --force eth0
|
|
|
|
sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces
|
|
|
|
# Add usb0 interface for bfn platforms
|
|
platform=$(sonic-cfggen -H -v 'DEVICE_METADATA["localhost"]["platform"]')
|
|
if [[ "$platform" == "x86_64-accton_wedge100bf_32x-r0" || "$platform" == "x86_64-accton_wedge100bf_65x-r0" ]]; then
|
|
cat <<'EOF' >> /etc/network/interfaces
|
|
# BMC interface
|
|
auto usb0
|
|
allow-hotplug usb0
|
|
iface usb0 inet6 auto
|
|
up ifconfig usb0 txqueuelen 64
|
|
EOF
|
|
fi
|
|
|
|
[ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid
|
|
|
|
systemctl restart networking
|
|
|
|
ifdown --force lo && ifup lo
|