From ac21a4e69fac27504b62927a20d0a6a273abb034 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Tue, 19 Sep 2023 18:41:07 +0200 Subject: init: T5239: configure system hostname prior to FRR startup On first boot after an upgrade /etc/hostname and FRR configuration is not populated. FRR determines the system hostname once during startup and does not repect changes of the hostname CLI value. Thus after an upgrade of VyOS FRR started with a hostname of debian that was propagated to peers. The commit retrieves the hostname from the CLI and presets this before FRR is initially started. --- src/init/vyos-router | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/init/vyos-router b/src/init/vyos-router index 9ef1fa335..dd07d2e4b 100755 --- a/src/init/vyos-router +++ b/src/init/vyos-router @@ -374,8 +374,11 @@ start () && chgrp ${GROUP} ${vyatta_configdir} log_action_end_msg $? - rm -f /etc/hostname - ${vyos_conf_scripts_dir}/host_name.py || log_failure_msg "could not reset host-name" + # T5239: early read of system hostname as this value is read-only once during + # FRR initialisation + tmp=$(${vyos_libexec_dir}/read-saved-value.py --path "system host-name") + hostnamectl set-hostname --static "$tmp" + ${vyos_conf_scripts_dir}/system_frr.py || log_failure_msg "could not reset FRR config" # If for any reason FRR was not started by system_frr.py - start it anyways. # This is a safety net! -- cgit v1.2.3