Change default-dvm from Fedora 38 to Fedora 39

Hello,
new template Fedora 39 successfully downloaded and already replaced the old Fedora 38 templates in 39.

Now the problem. Now I want to change the last template, the default dvm from fedora 38 to fedora 39. would work if it wasn’t for the sys-usb. Because I would have to switch it off to be able to change the template. Well, if I shut it down I can’t do anything anymore, because my mouse and keyboard are attached to it.

Any ideas?

1 Like

The command (in dom0 terminal) is:

qvm-shutdown --wait sys-usb; qvm-prefs -s sys-usb template dvm-default; qvm-start sys-usb

But best way is, you clone your default-dvm to a default-fedora-39-dvm and then insert:

qvm-shutdown --wait sys-usb; qvm-prefs -s sys-usb template default-fedora-39-dvm; qvm-start sys-usb

…and so on the next time
fedora-40
fedora-41

The command stops sys-usb // change the template // starts sys-usb again. You don’t have to do anything with keyboard and mouse during this…

5 seconds of fear!

3 Likes

okay, it worked, thanks

1 Like

potentially followed by disaster.
I always recommend a failsafe:

#!/usr/bin/bash

qvm-shutdown --wait sys-usb
sleep 10
qvm-prefs sys-usb template <NEW_TEMPLATE>
qvm-start sys-usb

## Delete this section after testing
sleep 120
qvm-shutdown sys-usb
sleep 10
qvm-prefs sys-usb template <OLD_TEMPLATE>
sleep 5
qvm-start sys-usb
## Delete this section after testing

That gives you 2 minutes to test out the new template backed sys-usb,
and will then revert to the old.
Once you are happy you can delete, or comment out, the testing section, and
rerun the script to make the change permanent.

I never presume to speak for the Qubes team. When I comment in the Forum I speak for myself.
6 Likes

Okay, thanks.
Does this text have to be in the #!/usr/bin/bash ?
and then execute it?
Or just write it in the terminal from Dom0 one after the other?

I’m just making a documentation for next time.

1 Like

You have to write unmans text into a file, which you can execute (i.e. change-sys-usb-template.sh) and store wherever you want.

1 Like

This is already documented here:

https://www.qubes-os.org/doc/templates/#switching

Perhaps you should update the documentation above and/or upstream your script into Qubes.

3 Likes

I’m looking for an option that is similar because Qubes is my daily driver on my desktop and I am picky about my keyboard. I really like this type of solution because it is the creation of an editable script that could progress with the system.

Here is my process when I tested it today:
Saved the text as <filename> .
Used chmod -x <filename> in a terminal window in the correct directory to make it executable.
Had to bash <filename> for it to run.

I got the following errors:

qvm-shutdown: command not found
qvm-prefs: command not found
qvm-start: command not found

Here is where I could use some clarification in the process:
It makes sense that these commands can only be run from dom0. Is that a correct assumption?

I read how to move a file to dom0 in unman’s post.

or I know that I could write using an editor like vim in a dom0 terminal. Is there a gui text editor equivalent in dom0?

or could I somehow ask dom0 to execute a file in a vm but it run in dom0?

What would the best practice be for security? (Outside of buying a ps2 keyboard or reinstalling when a new qubes image is available, of course?)

1 Like

chmod - removes the mode bit
You want chmod +x

Yes

nano may suit you better than vi

2 Likes

You are awesome! Thank you for the help.

I’m so glad that I did this as a practice with a script! I would have locked myself out again.

qvm-prefs: error: template for DispVM must have template_for_dispvms=True

Then tried in dom0 terminal
qvm-prefs --set fedora-39-dvm template_for_dispvms True (also tried with the ‘=’ included)

and got this error

qvm-prefs: error: no such property: ‘template_for_dispvms’

‘template_for_dispvms’ shows up under man qvm-prefs but not under qvm-prefs --help-properties fedora-39-dvm
Under the ‘–help-properties’ info I couldn’t find a similar property.

I’m at a loss of how to change it. Any idea what I missed?

1 Like

So I spent a few minutes reading and testing some of the commands to change my default-dvm when I am using a desktop with only usb keyboard.
Here is what I made as a bash script.

# change-default-template
qvm-shutdown --force sys-net
qvm-shutdown --force sys-firewall
qvm-shutdown --force sys-usb
qvm-shutdown --force sys-whonix

sleep 20
echo "Testing NEW Template"
qvm-prefs --set default-dvm template fedora-39-xfce
sleep 15
qvm-start sys-net
qvm-start sys-firewall
qvm-start sys-usb
qvm-start sys-whonix

#Comment out this section after testing
sleep 120
echo "Restoring OLD Template"
qvm-shutdown --force sys-net
qvm-shutdown --force sys-firewall
qvm-shutdown --force sys-usb
qvm-shutdown --force sys-whonix

sleep 20
qvm-prefs --set default-dvm template fedora-38-xfce
sleep 5
qvm-start sys-usb
qvm-start sys-net
qvm-start sys-firewall
qvm-start sys-whonix
echo "Template Change Test Completed"
#end comment out section

Does anyone suggest a better method other than forcing qvm-shutdown or is there a better order to shut down templates? I’m self taught with this. I guess most people are really. If you’re new to Qubes and want an explanation of what it is doing line by line let me know and I’ll update this.

2 Likes

qvm-shutdown --force --wait sys-net sys-firewall sys-usb sys-whonix

2 Likes