I'm trying to install a rhel guest inside a rhel host using kvm and have the rhel guest auto start after the installation completes.
The kickstart file has the "reboot" command which should tell RHEL to restart after the install.
the script is at /root/install_machine, and the variables are defined at the top of the script
virt-install \ --name=$name-$ip_short \ --arch=x86_64 \ --ram=$memory \ --os-type=linux \ --os-variant=virtio26 \ --hvm \ --connect=qemu:///system \ --network bridge:br0 \ --vcpus=$cpus \ --accelerate \ --autostart \ --disk path=/kvm/disks/$name-$ip_short.img,size=$disk_size \ --location $location \ --vnc \ -x "ks=$ks_file ksdevice=eth0 ip=$ip_long netmask=255.255.255.0 gateway=$gateway dns=22.214.171.124"
I log into the machine, and run the script
ssh -X root@virtual_server /root/install_machine
the virt-viewer window pops open, I watch the intall, I watch it reboot, and it runs great.
But if I login without graphics, I get a "cannot open display" error (which is expected), then the system installs, and then it shuts down and I have to manually start it
ssh root@virtual_server /root/install_machine Starting install... Retrieving file .treeinfo... Retrieving file vmlinuz... Retrieving file initrd.img... Creating storage file test2-178.img Creating domain... Cannot open display: Run 'virt-viewer --help' to see a full list of available command line options Domain installation still in progress. You can reconnect to the console to complete the installation process.
I also tried running the script from a cron, the machine is installed but is left in the turned off state and I have to manually turn it on.
Any suggestions for what I might try to get this to install and start without my input? I suppose I could monitor the process and run "virsh start $name-$ip_short", but that seems hacky. It seems like it should restart on its own. Adding --noautoconsole to virt-install doesn't seem to help either...