diff --git a/etc/rc.d/hostname b/etc/rc.d/hostname index 6b5d350fe2e3..148b61fd68f2 100755 --- a/etc/rc.d/hostname +++ b/etc/rc.d/hostname @@ -60,9 +60,11 @@ hostname_start() # Have we got a hostname yet? # if [ -z "${hostname}" ]; then - # Null hostname is probably OK if DHCP is in use. + # Null hostname is probably OK if DHCP is in use, + # or when hostname is already set (common for jails). # - if [ -z "`list_net_interfaces dhcp`" ]; then + if [ -z "`list_net_interfaces dhcp`" -a \ + -z "`/bin/hostname`" ]; then warn "\$hostname is not set -- see rc.conf(5)." fi return diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index c27a2134e6bc..317de23a1d9a 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2018 +.Dd March 10, 2018 .Dt RC.CONF 5 .Os .Sh NAME @@ -421,6 +421,9 @@ If .Xr dhclient 8 is used to set the hostname via DHCP, this variable should be set to an empty string. +Within a +.Xr jail 8 +the hostname is generally already set and this variable may absent. If this value remains unset when the system is done booting your console login will display the default hostname of .Dq Amnesiac .