Closed BurlyLuo closed 1 month ago
was not able to reproduce the error, root password is properly injected in my testing
[root@vm ~]# ps -ef | grep yum
root 1710 1708 0 04:03 ? 00:00:00 /usr/libexec/platform-python /usr/bin/yum -y install qemu-guest-agent
root 4860 4813 0 04:06 pts/1 00:00:00 grep --color=auto yum
[root@vm ~]#
[root@vm ~]#
[root@vm ~]#
[root@vm ~]#
[root@vm ~]# kill -9 1710
[root@vm ~]# /usr/libexec/platform-python /usr/bin/yum -y install qemu-guest-agent
Last metadata expiration check: 0:00:01 ago on 2024年09月30日 星期一 04时07分23秒.
Package qemu-guest-agent-15:6.2.0-49.module_el8+991+097e156d.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@vm ~]# ps -ef | grep yum
root 13400 4813 0 04:07 pts/1 00:00:00 grep --color=auto yum
[root@vm ~]#
[root@vm ~]# /usr/libexec/platform-python /usr/bin/yum -y install qemu-guest-agent
block! From the above logs. we can see that if kill the /usr/libexec/platform-python /usr/bin/yum -y install qemu-guest-agent
process. the cmds can be execed as expected. [cmds='[rm -rf /etc/yum.repos.d/* && pkill yum ; curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo ; pkill yum && yum -y install net-tools pciutils wget lrzsz ; wget http://192.168.2.100/kvm/tools/lseth -P /usr/bin/ && chmod +x /usr/bin/lseth]]
kcli create vm -i centos8stream -P memory=4096 -P disks=[50] -P rootpassword=hive -P nets="[{'name':'brnet','ip':'192.168.2.96','netmask':'24','gateway':'192.168.2.1'},{'name':'vppdpdk5'},{'name':'vppdpdk8'},{'name':'vppdpdk9'}]" -P cpupinning=['{"vcpus": "0", "hostcpus": "0"}','{"vcpus": "1", "hostcpus": "1"}','{"vcpus": "2", "hostcpus": "2"}','{"vcpus": 3, "hostcpus": 3}'] -P numcpus=4 -P cmds='[rm -rf /etc/yum.repos.d/* && pkill yum ; curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo ; pkill yum && yum -y install net-tools pciutils wget lrzsz ; wget http://192.168.2.100/kvm/tools/lseth -P /usr/bin/ && chmod +x /usr/bin/lseth]' vm
The issue is probably that your network lacks internet connectivity, causing the qemu-guest-agent install to fail.
This package is needed in order to properly report the ip for bridged networks, but in commit https://github.com/karmab/kcli/commit/a8c64f4f2714daf31a21fd4d41f5d25afdf0c0b4 , I've introduced the variable guestagent
so that you can disable this behaviour.
The issue is probably that your network lacks internet connectivity, causing the qemu-guest-agent install to fail. This package is needed in order to properly report the ip for bridged networks, but in commit a8c64f4 , I've introduced the variable
guestagent
so that you can disable this behaviour.
Okay.
[[ kcli create vm -i centos8stream -P memory=4096 -P disks=[50] -P rootpassword=hive -P guestagent=False -P nets="[{'name':'brnet','ip':'192.168.2.96','netmask':'24','gateway':'192.168.2.1'},{'name':'vppdpdk5'},{'name':'vppdpdk8'},{'name':'vppdpdk9'}]" -P cpupinning=['{"vcpus": "0", "hostcpus": "0"}','{"vcpus": "1", "hostcpus": "1"}','{"vcpus": "2", "hostcpus": "2"}','{"vcpus": 3, "hostcpus": 3}'] -P numcpus=4 -P cmds='[rm -rf /etc/yum.repos.d/* ; curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo ; yum -y install net-tools pciutils wget lrzsz ; wget http://192.168.2.100/kvm/tools/lseth -P /usr/bin/ && chmod +x /usr/bin/lseth]' vm ]]
-P guestagent=False
[root@vm ~]# find / -name runcmd
/var/lib/cloud/instances/vm/scripts/runcmd
[root@vm ~]# cat /var/lib/cloud/instances/vm/scripts/runcmd
#!/bin/sh
echo root:hive | chpasswd
rm -rf /etc/yum.repos.d/* ; curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo ; yum -y install net-tools pciutils wget lrzsz ; wget http://192.168.2.100/kvm/tools/lseth -P /usr/bin/ && chmod +x /usr/bin/lseth
sed -i 's/.*PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config
systemctl restart sshd
[root@vm ~]#