Skip to content

self.wait_write("hostnamectl set-hostname %s" % (self.hostname)) not work #429

@BurlyLuo

Description

@BurlyLuo
2025-12-16 12:03:16,349: vrnetlab       DEBUG writing to serial console: 'hostnamectl set-hostname sonic1'
2025-12-16 12:03:16,349: vrnetlab       INFO waiting for '#' on serial console
2025-12-16 12:03:16,544: vrnetlab       INFO read from serial console: ' hostnamectl set-hostname sonic1
root@sonic:~#'
2025-12-16 12:03:16,544: vrnetlab       DEBUG writing to serial console: 'sleep 1'
2025-12-16 12:03:16,544: vrnetlab       INFO waiting for '#' on serial console
2025-12-16 12:03:17,540: vrnetlab       INFO read from serial console: ' sleep 1
**root@sonic:~#'**
2025-12-16 12:03:17,541: vrnetlab       DEBUG writing to serial console: 'printf '127.0.0.1\tsonic1\n' >> /etc/hosts'
2025-12-16 12:03:17,541: vrnetlab       INFO waiting for '#' on serial console
2025-12-16 12:03:17,603: vrnetlab       INFO read from serial console: ' printf '127.0.0.1\tsonic1\n' >> /etc/hosts
root@sonic:~#'
2025-12-16 12:03:17,603: vrnetlab       DEBUG writing to serial console: 'sleep 1'
2025-12-16 12:03:17,603: launch         INFO completed bootstrap configuration
2025-12-16 12:03:17,603: launch     TRACE    Backup file /config/config_db.json not found
2025-12-16 12:03:17,604: launch         INFO Startup complete in: 0:00:53.830442

self.wait_write("sudo -i", "$")

even with sudo -i 1st. but it's still not take effect.

[root@rowan> ~]# ds
CONTAINER ID   IMAGE                                 COMMAND                  STATUS                        NAMES
0ac5ca80e85e   192.168.2.100:5000/nettool            "/sbin/tini -g -- /e…"   Up About a minute             clab-vs-net2
825037d7e7b0   192.168.2.100:5000/sonic-vpp:latest   "/launch.py --userna…"   Up About a minute (healthy)   clab-vs-sonic2
82c8b6bbd7cc   192.168.2.100:5000/sonic-vpp:latest   "/launch.py --userna…"   Up About a minute (healthy)   clab-vs-sonic1
146fa6eb3d17   192.168.2.100:5000/nettool            "/sbin/tini -g -- /e…"   Up About a minute             clab-vs-net1
[root@rowan> ~]# ssh admin@82c8b6bbd7cc
The authenticity of host '82c8b6bbd7cc (172.20.20.2)' can't be established.
RSA key fingerprint is SHA256:Ed5y54y041typlbxi+PPUEM8ugM3jaLwvYazwi7bWj8.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '82c8b6bbd7cc' (RSA) to the list of known hosts.
Debian GNU/Linux 12 \n \l

Linux sonic 6.1.0-29-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.123-1 (2025-01-02) x86_64
You are on
  ____   ___  _   _ _  ____
 / ___| / _ \| \ | (_)/ ___|
 \___ \| | | |  \| | | |
  ___) | |_| | |\  | | |___
 |____/ \___/|_| \_|_|\____|

-- Software for Open Networking in the Cloud --

Unauthorized access and/or use are prohibited.
All access and/or use are subject to monitoring.

Help:    https://sonic-net.github.io/SONiC/

Last login: Tue Dec 16 12:03:14 2025
admin@sonic:~$ 

we can see the hostname is still: admin@sonic:~$
2025-12-16 12:03:16,349: vrnetlab DEBUG writing to serial console: 'hostnamectl set-hostname sonic1'
from logs. it should be sonic1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions