all lxc initialization at boot

djsami

Renowned Member
Aug 24, 2009
193
5
83
Hello

There are 1000+ lxc is there any way to start them all at boot?

Code:
proxmox-ve: 6.3-1 (running kernel: 5.4.78-2-pve)
pve-manager: 6.3-3 (running version: 6.3-3/eee5f901)
pve-kernel-5.4: 6.3-3
pve-kernel-helper: 6.3-3
pve-kernel-5.4.78-2-pve: 5.4.78-2
pve-kernel-5.4.34-1-pve: 5.4.34-2
ceph-fuse: 12.2.11+dfsg1-2.1+b1
corosync: 3.1.0-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: 0.8.35+pve1
ksm-control-daemon: 1.3-1
libjs-extjs: 6.0.1-10
libknet1: 1.20-pve1
libproxmox-acme-perl: 1.0.7
libproxmox-backup-qemu0: 1.0.2-1
libpve-access-control: 6.1-3
libpve-apiclient-perl: 3.1-3
libpve-common-perl: 6.3-2
libpve-guest-common-perl: 3.1-4
libpve-http-server-perl: 3.1-1
libpve-storage-perl: 6.3-5
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 4.0.6-2
lxcfs: 4.0.6-pve1
novnc-pve: 1.1.0-1
proxmox-backup-client: 1.0.8-1
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.4-4
pve-cluster: 6.2-1
pve-container: 3.3-3
pve-docs: 6.3-1
pve-edk2-firmware: 2.20200531-1
pve-firewall: 4.1-3
pve-firmware: 3.1-3
pve-ha-manager: 3.1-1
pve-i18n: 2.2-2
pve-qemu-kvm: 5.1.0-8
pve-xtermjs: 4.7.0-3
qemu-server: 6.3-4
smartmontools: 7.1-pve2
spiceterm: 3.1-1
vncterm: 1.6-2
zfsutils-linux: 0.8.5-pve1


Thansk.
 
hi,

setting the onboot parameter for the container should do the trick, but starting all of them at boot can cause your system to get slow.

for a single container: pct set CTID --onboot 1 will make it start at boot.

if you want to set this for all of them you can use a simple loop like this: pct list | awk '{print $1}' | while read ctid; do pct set $ctid --onboot 1 ; done (keep in mind this can make your system boot very slow!)

you can also set a start delay or order for the containers to start in
 
  • Like
Reactions: djsami
hi,

setting the onboot parameter for the container should do the trick, but starting all of them at boot can cause your system to get slow.

for a single container: pct set CTID --onboot 1 will make it start at boot.

if you want to set this for all of them you can use a simple loop like this: pct list | awk '{print $1}' | while read ctid; do pct set $ctid --onboot 1 ; done (keep in mind this can make your system boot very slow!)

you can also set a start delay or order for the containers to start in

I tried like this but it gave an error?

root@pve20:~# qm list | awk '{print $1}' | while read VMID; do qm set $VMID --onboot 1 ; done
400 Parameter verification failed.
vmid: type check ('integer') failed - got 'VMID'
qm set <vmid> [OPTIONS]
update VM 130: -onboot 1
update VM 146: -onboot 1
update VM 149: -onboot 1
update VM 171: -onboot 1
update VM 174: -onboot 1
update VM 175: -onboot 1
update VM 189: -onboot 1
update VM 194: -onboot 1
update VM 195: -onboot 1
update VM 196: -onboot 1
update VM 197: -onboot 1
update VM 227: -onboot 1
update VM 240: -onboot 1
update VM 274: -onboot 1
update VM 318: -onboot 1
update VM 366: -onboot 1
update VM 368: -onboot 1
update VM 392: -onboot 1
update VM 393: -onboot 1
update VM 394: -onboot 1
root@pve20:~#
 
Hi,
I tried like this but it gave an error?

root@pve20:~# qm list | awk '{print $1}' | while read VMID; do qm set $VMID --onboot 1 ; done
400 Parameter verification failed.
vmid: type check ('integer') failed - got 'VMID'
qm set <vmid> [OPTIONS]
update VM 130: -onboot 1
update VM 146: -onboot 1
update VM 149: -onboot 1
update VM 171: -onboot 1
update VM 174: -onboot 1
update VM 175: -onboot 1
update VM 189: -onboot 1
update VM 194: -onboot 1
update VM 195: -onboot 1
update VM 196: -onboot 1
update VM 197: -onboot 1
update VM 227: -onboot 1
update VM 240: -onboot 1
update VM 274: -onboot 1
update VM 318: -onboot 1
update VM 366: -onboot 1
update VM 368: -onboot 1
update VM 392: -onboot 1
update VM 393: -onboot 1
update VM 394: -onboot 1
root@pve20:~#
that's just because the output of qm list starts with a header
Code:
root@pve701 ~ # qm list     
      VMID NAME                 STATUS     MEM(MB)    BOOTDISK(GB) PID       
100 VM 100               stopped    4096              32.00 0
and the one-liner doesn't filter that. But as you can see, it should have updated the setting for all VMs.
 
  • Like
Reactions: djsami
Hi,

that's just because the output of qm list starts with a header
Code:
root@pve701 ~ # qm list    
      VMID NAME                 STATUS     MEM(MB)    BOOTDISK(GB) PID      
100 VM 100               stopped    4096              32.00 0
and the one-liner doesn't filter that. But as you can see, it should have updated the setting for all VMs.

so is there any other way?

For 1800 virtual server auto-start ?
 
The error is only cosmetic. As you can see in the output, the onboot setting was applied to the VMs.
 
  • Like
Reactions: djsami