hostctl removes multi-value domain aliases when adding any domain
alcroito opened this issue · comments
Describe the bug
My ubuntu 22.04 system has the following lines in /etc/hosts by default
127.0.1.1 customhost.mydomain.com customhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
Whenever hostctl is invoked to add any domain, all the aliases after the domain get removed
hostctl add domains awesome my-awesome-ui.project.loc my-awesome-api.project.loc
and the resulting file ends up
127.0.1.1 customhost.mydomain.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost
##################################################################
# Content under this line is handled by hostctl. DO NOT EDIT.
##################################################################
# profile.on awesome
127.0.0.1 my-awesome-ui.project.loc
127.0.0.1 my-awesome-api.project.loc
# end
now every time run I sudo su
i get an message sudo: unable to resolve host customhost: Name or service not known
because the customhost entry gets removed.
Expected behavior
default profile aliases that are not managed via hostctl should not be removed.
System (please complete the following information):
- OS: Linux
- Version: Ubuntu 22.04