因为ubuntu起来的时候没有把host和IP的对应关系加进去,导致sudo命令timeout, 可以在nova boot VM 的时候通过cloud_init文件带进去.
问题:
sudo: unable to resolve host (none)
解决
- vi cloud_init_1.txt
#cloud-config
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True
bootcmd:
- echo $(hostname -I | cut -d\ -f1) $(hostname) | sudo tee -a /etc/hosts
- 在nova boot 以–user-data cloud_init_1.txt参数带进去