-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid removing localhost entry from /etc/hosts file #2452
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lguohan
approved these changes
Jan 18, 2019
thank you for this fix! |
seiferteric
pushed a commit
to project-arlo/sonic-buildimage
that referenced
this pull request
Oct 14, 2019
…ic-net#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. Change-Id: I4599bcaade05331d737f3e70f449dd51f7c636bb
seiferteric
pushed a commit
to project-arlo/sonic-buildimage
that referenced
this pull request
Oct 14, 2019
…le (sonic-net#2452)" into broadcom_sonic
zhenggen-xu
pushed a commit
to zhenggen-xu/sonic-buildimage
that referenced
this pull request
Oct 17, 2019
…ic-net#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. RB=1534557 G=lnos-reviewers R=pchaudhary,pmao,rmolina,samaity,sfardeen,zxu A=
yxieca
pushed a commit
that referenced
this pull request
Oct 29, 2019
- 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.
stephenxs
added a commit
to stephenxs/sonic-buildimage
that referenced
this pull request
Nov 8, 2022
d5a6da31 Do not configure physical attributes on port channels in portconfig (sonic-net#2456) 48ee7722 Change db_migrator major version on master branch from version 3 to 4 (sonic-net#2470) f3746163 [GCU] Fix JsonPointerFilter bug (sonic-net#2477) 58dbb3e6 YANG Validation for ConfigDB Updates: TACPLUS, TACPLUS_SERVER, AAA, VLAN_SUB_INTERFACE tables + decorated validated_mod_entry (sonic-net#2452) 062f18a0 fix show interface neighbor expected empty issue (sonic-net#2465) 569edf3b Fix display disorder problem of show mirror_session (sonic-net#2447) daaf0ffc Disable "tag as local" when reboot (sonic-net#2451) 6621120b Fix sudo sfputil show error-status on a multiasic platform issue (sonic-net#2373) e8b1dcdf Add IP remove warnings for VRF commands (sonic-net#2351) 40cc8e11 [scripts/generate_dump] add information to tech-support file (sonic-net#2357) 8473517e Revert "[config reload]: On dual ToR systems, cache ARP and FDB table (sonic-net#2460) Signed-off-by: Stephen Sun <stephens@nvidia.com>
yxieca
pushed a commit
that referenced
this pull request
Nov 11, 2022
#12639) * Advance submodule sonic-utilities d5a6da31 Do not configure physical attributes on port channels in portconfig (#2456) 48ee7722 Change db_migrator major version on master branch from version 3 to 4 (#2470) f3746163 [GCU] Fix JsonPointerFilter bug (#2477) 58dbb3e6 YANG Validation for ConfigDB Updates: TACPLUS, TACPLUS_SERVER, AAA, VLAN_SUB_INTERFACE tables + decorated validated_mod_entry (#2452) 062f18a0 fix show interface neighbor expected empty issue (#2465) 569edf3b Fix display disorder problem of show mirror_session (#2447) daaf0ffc Disable "tag as local" when reboot (#2451) 6621120b Fix sudo sfputil show error-status on a multiasic platform issue (#2373) e8b1dcdf Add IP remove warnings for VRF commands (#2351) 40cc8e11 [scripts/generate_dump] add information to tech-support file (#2357) 8473517e Revert "[config reload]: On dual ToR systems, cache ARP and FDB table (#2460) Signed-off-by: Stephen Sun <stephens@nvidia.com> * Advance sonic-platform-common aa86083 Fix issue: rounding float value for txpower and rxpower (#320) 2052a63 Fix issue: copper cable should not display DOM information (#318) cf4c6af CmisApi::get_application_advertisement catch AttributeError as well (#316) Signed-off-by: Stephen Sun <stephens@nvidia.com> Signed-off-by: Stephen Sun <stephens@nvidia.com>
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- 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
localhost
/etc/sonic/config_db.json
to update the 'hostname' filed underDEVICE_METADATA
from"hostname" : "localhost"
-->"hostname" : "sonic"
config reload -y
to reflect the hostname change done on config_db.json file.cat /etc/hosts
and check whether both127.0.0.1 localhost
and127.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.- A picture of a cute animal (not mandatory but encouraged)