Proxmox 使用 Template 创建虚拟机后容器不正常的问题

By | 2018-11-26

在使用 proxmox 过程中经常为了省事而使用官网上的 template 创建虚拟机(创建CT),这些有很多好处,创建速度快,模板不需要设置就可以运行正常,能随时调整虚拟机硬盘容量等!

但试过创建UBUNTU的网友可能会遇到创建后无法“正常启动”的问题,其实虚拟机已经创建完成并运行,只需在模板创建的虚拟机的“网络“中增加IP地址即可使用该虚拟机。

另外如果想在proxmox的“控制台”能正常控制该虚拟机,可以在以下网址看到相关的修改容器的方法,以便正常使用!

http://pve.proxmox.com/wiki/OpenVZ_Console#Ubuntu_12.04

具体操作步骤:
1) 先SSH到proxmox,然后执行
proxmox-ve:~# vzlist

     CTID      NPROC STATUS    IP_ADDR         HOSTNAME      
     108         23 running   192.168.9.20    ubuntu-1204.proxmox.com
     109         18 running   192.168.9.21    centos63-64.proxmox.com
     111         15 running   192.168.9.23    centos5-64.proxmox.com
     114         14 running   192.168.9.30    deb6-32.proxmox.com
     115         15 running   192.168.9.31    deb7-32.proxmox.com
     122         14 running   192.168.9.36    deb5.proxmox.com

2) 找出想进入的虚拟台的CTID,例如:108

proxmox-ve:~# vzctl enter 108

       进入到该台虚拟机的控制台,新增或修改 tty1.conf 这个文件
       root@ubuntu-1204:/# nano /etc/init/tty1.conf

修改为以下的内容:
——————————————————————-

# tty1 - getty # # This service maintains a getty on tty1 from the point the system is 
# started until it is shut down again.  
start on stopped rc RUNLEVEL=[2345]  
stop on runlevel [!2345]
respawn
exec /sbin/getty -8 38400 tty1
--------------------------------------------------------------------

以上例子是针对 VZ UBUNTU 12.04下的模板

發佈留言