[9/9] base-files: default hostname to localhost

Submitted by Qi.Chen@windriver.com on Nov. 23, 2018, 2:16 a.m. | Patch ID: 156556

Details

Message ID 2464d115a8d3ee0391900838ddb1c2269dfd1a97.1542939066.git.Qi.Chen@windriver.com
State New
Headers show

Commit Message

Qi.Chen@windriver.com Nov. 23, 2018, 2:16 a.m.
Previously we default hostname to be ${MACHINE}, but there's no entry
in /etc/hosts, and `hostname -f' command fails. So change it to
'localhost'.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/base-files/base-files_3.0.14.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
index 6e75652..3a0eb4e 100644
--- a/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -60,13 +60,13 @@  conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
              ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
              ${sysconfdir}/default"
 
-# By default the hostname is the machine name. If the hostname is unset then a
+# By default the hostname is 'localhost'. If the hostname is unset then a
 # /etc/hostname file isn't written, suitable for environments with dynamic
 # hostnames.
 #
 # The hostname can be changed outside of this recipe by using
 # hostname_pn-base-files = "my-host-name".
-hostname = "${MACHINE}"
+hostname = "localhost"
 
 BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
 

Comments

Richard Purdie Nov. 23, 2018, 11:38 p.m.
On Fri, 2018-11-23 at 10:16 +0800, Chen Qi wrote:
> Previously we default hostname to be ${MACHINE}, but there's no entry
> in /etc/hosts, and `hostname -f' command fails. So change it to
> 'localhost'.
> 
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>  meta/recipes-core/base-files/base-files_3.0.14.bb | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

This is not the correct way to fix this, we should be adding the
correct entry to /etc/hosts...

Cheers,

Richard