This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
sonic-buildimage/files/image_config
Prabhu Sreenivasan ff137a8e56 [baseimage]: Avoid removing localhost entry from /etc/hosts file (#2452)
- What I did
This fix removes the possibility of 'localhost' entry getting removed from /etc/hosts file by hostname-config service.

Without this change, whenever we change the hostname from 'localhost' to any other name on the config_db.json and reload the config, /etc/hosts file will only have the new hostname on it. But there are multiple sonic utilities (eg: swssconfig) which relies on the hard coded 'localhost' name and they tend to stop working.

- How I did it
Added a new check on hostname-config.sh script to avid blindly deleting the line containing the old hostname from /etc/hosts file. Now it will delete the old hostname only if its not localhost or when the hostname is not changing.

- How to verify it

Bring up SONiC on a device with hostname as localhost
Edit /etc/sonic/config_db.json to update the 'hostname' filed under DEVICE_METADATA from "hostname" : "localhost" --> "hostname" : "sonic"
run config reload -y to reflect the hostname change done on config_db.json file.
cat /etc/hosts and check whether both 127.0.0.1 localhost and 127.0.0.1 sonic entry are present on the file.
ping localhost should work fine.
- Description for the changelog
Make hostname-config service more robust in handling SONiC hostname change from localhost to anything else.
2019-10-29 15:42:04 +00:00
..
apt [baseimage]: Download picocom version 3.1-2 from stretch-backports; No longer build from source (#1946) 2018-08-17 17:38:20 -07:00
asn [BGPD]: add bgp dynamic neighbor configuration (#708) 2017-06-21 18:52:50 -07:00
bash [baseimage]: Increase TMOUT for serial port connections to 15 minutes (#3032) 2019-06-19 19:07:36 +00:00
caclmgrd [caclmgrd] Don't crash if we find empty/null rule_props (#2475) 2019-01-25 21:10:52 +00:00
cron.d [core_cleanup] Fix issue where core_cleanup job runs too frequently (#3659) 2019-10-24 17:04:16 +00:00
ebtables [ebtables] install ebtables in base image and install filter rules 2019-05-06 22:13:03 +00:00
environment [image]: Update login message (#706) 2017-06-14 15:18:02 -07:00
hostcfgd Install Iptables rules to set TCPMSS for 'lo' interface (#3452) 2019-09-19 01:08:44 +00:00
hostname [baseimage]: Avoid removing localhost entry from /etc/hosts file (#2452) 2019-10-29 15:42:04 +00:00
interfaces [sonic boot] disable dhcp during boot up, until updategraph service is running (#2316) 2018-11-29 08:34:22 -08:00
logrotate [logrotate] Enhance robustness (#2942) 2019-05-29 00:53:13 +00:00
monit [baseimage]: fix monit configuration (#3448) 2019-09-13 06:08:30 +00:00
ntp [201811][ntp] removed undefined filter (#3594) 2019-10-11 19:46:14 -07:00
platform [first boot] sync file system after moving/copying files (#3550) 2019-10-02 21:04:39 +00:00
process-reboot-cause [DELL] S6100 Add PowerCycle Support for Last Reset Reason (#3402) 2019-09-09 22:33:32 -07:00
rsyslog [rsyslog]: use # to separate container name and program name in syslog message (#1918) 2018-08-12 22:23:58 -07:00
snmp Remove extra trailing newlines at EOF (#804) 2017-07-12 20:54:37 -07:00
sudoers [sudoers] Add /usr/bin/teamshow to READ_ONLY_CMDS (#2846) 2019-05-01 15:51:13 +00:00
systemd [services] Restart SwSS service upon unexpected critical process exit (#2845) (#2852) 2019-07-29 18:10:26 -07:00
updategraph [updategraph] enhance update graph handling (#3549) 2019-10-02 21:04:39 +00:00
warmboot-finalizer [control plane assistant] stop control plane assistant after warm reboot (#3337) 2019-08-15 20:28:42 +00:00