Cannot start a VM when created by custom template
Hello folks, I've been reading a lot of things about it and I can't get it resolved. I have openvz up/running on a centos 6.6 machine, it has 8gb or ram and a i5 cpu, is not that much but it fits well my needs. It already has 2 vms running: 101 -> ubuntu14.04_x64 201 -> centos6_x64 I'm trying to use the template of ubuntu14.04_x64 to create a new ubuntu template with some other softwares. I tried it form WebInterface and I got some errors, tried form CLI and got new errrors. See below my steps on CLI: [root@openvz /]# vzlist CTID NPROC STATUS IP_ADDR HOSTNAME 101 87 running 10.0.0.1 httpServer 201 9 running 10.0.0.2 bindServer [root@openvz ~]# cd /vz/private/101/ [root@openvz 101]# ls root.hdd [root@openvz 101]# tar --numeric-owner -czf /vz/template/cache/ubuntu-14.04-x86_64-kurento.tar.gz .[root@openvz /]# vzctl create 202 --ostemplate ubuntu-14.04-x86_64-kurento --config kurento Creating image: /vz/private/202.tmp/root.hdd/root.hdd size=10240000K Creating delta /vz/private/202.tmp/root.hdd/root.hdd bs=2048 size=20480000 sectors v2 Storing /vz/private/202.tmp/root.hdd/DiskDescriptor.xml Opening delta /vz/private/202.tmp/root.hdd/root.hdd Adding delta dev=/dev/ploop39010 img=/vz/private/202.tmp/root.hdd/root.hdd (rw) mke2fs 1.41.12 (17-May-2010) Discarding device blocks: done Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 640848 inodes, 2559488 blocks 127974 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 79 block groups 32768 blocks per group, 32768 fragments per group 8112 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 34 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. tune2fs 1.41.12 (17-May-2010) Setting maximal mount count to -1 Setting error behavior to 2 Setting interval between checks to 0 seconds Creating balloon file .balloon-c3a5ae3d-ce7f-43c4-a1ea-c61e2b4504e8 Mounting /dev/ploop39010p1 at /vz/private/202.tmp/root.hdd/root.hdd.mnt fstype=ext4 data='' Unmounting device /dev/ploop39010 Opening delta /vz/private/202.tmp/root.hdd/root.hdd Adding delta dev=/dev/ploop39010 img=/vz/private/202.tmp/root.hdd/root.hdd (rw) Mounting /dev/ploop39010p1 at /vz/root/202 fstype=ext4 data='balloon_ino=12,' Creating container private area (ubuntu-14.04-x86_64-kurento) Unmounting file system at /vz/root/202 Unmounting device /dev/ploop39010 Opening delta /vz/private/202/root.hdd/root.hdd Adding delta dev=/dev/ploop39010 img=/vz/private/202/root.hdd/root.hdd (rw) Mounting /dev/ploop39010p1 at /vz/root/202 fstype=ext4 data='balloon_ino=12,' Performing postcreate actions /etc/vz/dists/scripts/postcreate.sh: line 97: /vz/root/202/etc/hosts: No such file or directory /etc/vz/dists/scripts/postcreate.sh: line 100: /vz/root/202/etc/hosts: No such file or directory touch: cannot touch `/vz/root/202/etc/resolv.conf': No such file or directory Unmounting file system at /vz/root/202 Unmounting device /dev/ploop39010 CT configuration saved to /etc/vz/conf/202.conf Container private area was created [root@openvz /]# vzctl set 202 --hostname kurentodazuera --ipadd 10.0.0.3 --userpasswd root:toor Starting container... Opening delta /vz/private/202/root.hdd/root.hdd Adding delta dev=/dev/ploop39010 img=/vz/private/202/root.hdd/root.hdd (rw) Mounting /dev/ploop39010p1 at /vz/root/202 fstype=ext4 data='balloon_ino=12,' Container is mounted Container start failed (try to check kernel messages, e.g. "dmesg | tail") Killing container ... Container was stopped Unmounting file system at /vz/root/202 Unmounting device /dev/ploop39010 Container is unmounted [root@openvz /]# vzctl start 202 Starting container... Opening delta /vz/private/202/root.hdd/root.hdd Adding delta dev=/dev/ploop39010 img=/vz/private/202/root.hdd/root.hdd (rw) Mounting /dev/ploop39010p1 at /vz/root/202 fstype=ext4 data='balloon_ino=12,' Container is mounted Container start failed (try to check kernel messages, e.g. "dmesg | tail") Killing container ... Container was stopped Unmounting file system at /vz/root/202 Unmounting device /dev/ploop39010 Container is unmounted [root@openvz /]# dmesg | tail [11611.865722] EXT4-fs (ploop39010p1): mounted filesystem with ordered data mode. Opts: [11611.867170] EXT4-fs (ploop39010p1): loaded balloon from 12 (0 blocks) [11611.872292] CT: 202: started [11611.977464] CT: 202: stopped [11630.125492] ploop39010: p1 [11630.130202] ploop39010: p1 [11630.188173] EXT4-fs (ploop39010p1): mounted filesystem with ordered data mode. Opts: [11630.192533] EXT4-fs (ploop39010p1): loaded balloon from 12 (0 blocks) [11630.197419] CT: 202: started [11630.290469] CT: 202: stopped Any help/idea?
Re: Cannot start a VM when created by custom template
Hi, you've tar the ploop disk directory structure not a filesystem, you must mount the ploop to root/dir, tar it=build template. # mount the root/ploop vzctl mount 101 # change to ct root cd /vz/root/101 # build template from filesystem tar --numeric-owner -czf /vz/template/cache/ubuntu-14.04-x86_64-kurento.tar.gz . # umount ploop vzctl umount 101 # create new ct from build template vzctl create ... --ostemplate ubuntu-14.04-x86_64-kurento ... Bye, Thorsten
Thorsten, Thank you so much for the fast and precise reply, it worked like a charm. Someone needs to update this page with the info you provided about mount the container before tar it.: https: // openvz.org / Debian_template_creation#Preparing_for_and_packing_template_ cache