How to: automatic change of templates

I am a QubesOS heavy user. I separate almost everything. Because of it I have a ton of VMs I have to switch to Fedora 34. Is there a way to run it in one single command from dom0?

Note: I have ~20 VMs called storage-XX.

My idea was: qvm-prefs storage* template fedora-34

Unfortunately, this does not work. Also, I would have to match a number of groups. Much more advanced would be a command that simply matches each VM on fedora-33 and switches to fedora-34.

I am familiar with the in-place upgrade method. However, I’m looking more for a quick and dirty method without much risk of screwing something up:

  1. downloading the new template
  2. single line toggle command

Can someone please help me out?

You also can do this in the GUI, means open Qubes Manager > System > Manage Templates for Qubes. Then select all qubes, which have to be changed and down on the list change the drop down list to the desired template… click ok

1 Like

This is a simple exercise in bash:

for v in `qvm-ls --raw-list | grep ^storage`
do
        qvm-prefs $v template fedora-34
done
1 Like

Something like this…

qvm-ls --raw-data --halted --fields NAME,TEMPLATE | awk -F "|" '$2 ~ /fedora-33/ { print $1 }' | xargs -I{} qvm-prefs {} template fedora-34

It would be better to shutdown all qubes using qvm-shutdown --wait --all before doing that.

1 Like

Thanks for your help.

However, I suspect that your solution may not be as follows: Move all fedora-33 VMs to fedora-34
It is still GUI click of death.

1 Like