[SOLVED] VM One-Time-Boot

Baader-IT

Active Member
Oct 29, 2018
49
1
28
41
Hallo,

we want to install some VM's automatically.
For this we have created a shell script which use the qm create command to create the VM.

qm create $ID -name $NAME -bootdisk scsi0 -scsi0 NVME:$DISK1SIZE -scsihw virtio-scsi-pci -scsi1 HDD:$DISK2SIZE -memory 8192 -ostype l26 -sockets $SOCKETS -cores $CORES -cpu host -numa 1 -net0 virtio,bridge=vmbr112 -net1 virtio,bridge=vmbr$VLAN2

Now to our question:
After we created the VM with this script, we want to start the VM and boot over PXE to install the OS.
We already saw "--boot n" for the qm create command but don't want to use is because this will set the networkboot permanent.

Is there a way to tell the VM to boot only one time from network?
(PS: I don't want to start the VM and start the networkboot manually from the one time boot menu :) )

Greeting,
Tobi
 
Hi Tobi,

Maybe a better idea is:

- create templates with minimal install for your OS that you want to use(Centos, Debian, whatever)
- then create a new VM from the desired template, and start the VM using a custom network for this stage
- use your prefered automation tool(ansible, puppet, whatever), and do what you need (hosname, install new software, and so on)
- power down the VM, and start it in your production enviroment

The time that you need to finish this is less time consuming compared with a fresh install using a PXE, and also the resurces that you need for that!

Good luck!
 
you could set 'boot' to 'cn'
it will skip the disk the first time because there is nothing to boot from on it (the same logic applied to our default config where we set 'cdn' and it still boots from the cdrom the first time)
 
  • Like
Reactions: Baader-IT
also, there is '--start' which starts the vm automatically if the creation was successful
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!