How to disable swap in App VM (Qubes OS R4.2.3)

Hi,

I have setup ZRAM for my App VMs. It worked. I also tried to disable swap so I can use the swap partition as a backing device for ZRAM so it can use it for pages that it cannot compress. However I noticed that even after I commented out the fstab entry for swap in debian-12 template, the swap partition was still mounted as swap. Apparently some scripts in initram and systemd activates swap. Is it possible to disable that?

I can disable swap in zram activation script, but it will be nice not to activate it in the first place.

Any suggestions?

You shouldn’t disable swap at boot time, as stated in the comment in /usr/share/initramfs-tools/scripts/local-top/qubes_cow_setup:

    # enable swap right now, because systemd may want to run fsck in initramfs
    # already and it require some more memory

So it’s better to disable swap in /dev/xvdc1 and setup ZRAM after the qubes boot e.g. in /rw/config/rc.local.

Also you can only use /dev/xvdc1 for ZRAM, not the whole /dev/xvdc, because /dev/xvdc is also used for volatile changes in root partition: