-
Bug
-
Resolution: Expected Behavior
-
Normal
-
None
-
None
-
None
The aliases line entries in the /etc/conf.d/hostname file are copied multiple times into the /etc/hosts file when the service hostname is restartet. Example:
/etc/conf.d/hostname
# Set to the fully qualified domain name (e.g. "mybox.example.com") of this # machine, if it has one, otherwise set to the machine name (e.g. "mybox"). # This hostname will be automatically added to /etc/hosts for the 127.0.0.1 and # ::1 addresses. # Set to the hostname of this machine hostname="farout" # If your local system has other aliases for your local interfaces, you can # add them here. These will also be added to /etc/hosts for 127.0.0.1 and ::1: # Add aliases for other hosts to /etc/hosts directly. The networking scripts # automatically generate the localhost lines only. aliases=" 192.168.0.1 router" # Set to the NIS domain name of this machine, if it has one, otherwise leave # commented out. #nisdomainname="localdomain.com"
/etc/hosts before restart:
# Local Host Database # # This AUTOMATICALLY-GENERATED file describes a number of aliases-to-address # mappings for the local hosts that share this file. # # In the presence of the domain name service or NIS, this file may not be # consulted at all; see /etc/host.conf for the resolution order. # # DO NOT EDIT THIS FILE BY HAND; YOUR CHANGES WILL BE OVERWRITTEN #
Then we restart the hostname service with rc-service hostname restart results in /etc/hosts looking like this:
# Local Host Database # # This AUTOMATICALLY-GENERATED file describes a number of aliases-to-address # mappings for the local hosts that share this file. # # In the presence of the domain name service or NIS, this file may not be # consulted at all; see /etc/host.conf for the resolution order. # # DO NOT EDIT THIS FILE BY HAND; YOUR CHANGES WILL BE OVERWRITTEN # 127.0.0.1 farout localhost localhost.localdomain 192.168.0.1 router ::1 farout localhost localhost.localdomain 192.168.0.1 router
Having multiple entries in the alias line like:
# Set to the fully qualified domain name (e.g. "mybox.example.com") of this # machine, if it has one, otherwise set to the machine name (e.g. "mybox"). # This hostname will be automatically added to /etc/hosts for the 127.0.0.1 and # ::1 addresses. # Set to the hostname of this machine hostname="farout" # If your local system has other aliases for your local interfaces, you can # add them here. These will also be added to /etc/hosts for 127.0.0.1 and ::1: # Add aliases for other hosts to /etc/hosts directly. The networking scripts # automatically generate the localhost lines only. aliases=" 192.168.0.1 router 192.168.0.11 farout myadmin pf www local jardin 192.168.0.12 nas 192.168.0.17 epson" # Set to the NIS domain name of this machine, if it has one, otherwise leave # commented out. #nisdomainname="localdomain.com"
leads to a multiplication of entries in the /etc/hosts file after a few restarts of hostname.
Using openrc-0.35.0_beta1 and net-tools-1.60_p20161110235919