Turn swap off: swapoff -a.
Then comment out the swap line in /etc/fstab of your template.
Finally restart (or shutdown) the template and check with free -h.
What does qvm-prefs <vm name> kernelopts "<kernel options>" actually do? So far it doesn’t seem to do anything to the fedora-34 template, which is using the PVH virtualization mode.
# list units with names that contain "swap"
[user@fedora-34 ~]$ systemctl | grep "swap"
dev-xvdc1.swap
swap.target
[user@fedora-34 ~]$ swapon -s # check if any swap device is active
Filename Type
/dev/xvdc1 partition
[user@fedora-34 ~]$ swapoff -a # temporarily turn off all swap devices
[user@fedora-34 ~]$ swapon -s # check if any swap device is active
[user@fedora-34 ~]$ sudo systemctl mask "dev-*.swap"
Invalid unit name "dev-*.swap" escaped as "dev-\x2a.swap".
Unit dev-\x2a.swap does not exist, proceeding anyway.
Created symlink /etc/systemd/system/dev-\x2a.swap → /dev/null.
# Try to undo the last command
[user@fedora-34 ~]$ sudo systemctl unmask "dev-*.swap"
Glob pattern passed to enable, but globs are not supported for this.
Invalid unit name "dev-*.swap" escaped as "dev-\x2a.swap".
Removed /etc/systemd/system/dev-\x2a.swap.
# Link the dev-xvdc1.swap unit to /dev/null. Nothing can active
# this unit even if another unit depends on dev-xvdc1.swap.
[user@fedora-34 ~]$ sudo systemctl mask "dev-xvdc1.swap"
Created symlink /etc/systemd/system/dev-xvdc1.swap → /dev/null.
I disabled zswap in a clone of the fedora-35-minimal template.
sudo swapoff -a
systemctl mask dev-xvdc1.swap # doesn't work
vi /etc/fstab # comment out the line for swap. doesn't work.
sudo vi /etc/default/grub.qubes # add zswap.enabled=0; doesn't work
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
systemctl mask dev-xvdc1-swap.service # this finally works