Okay. I managed to get it working. Here I am writing the step by step instructions:
-
Install debian-11-minimal template. Clone it into a new template and remove the original downloaded template:
(in dom0)$ qvm-template install debian-11-minimal
(in dom0)$ qvm-clone debian-11-minimal deb11min-net
(in dom0)$ qvm-remove -f debian-11-minimal
Here, deb11min-net template is the one we will modify and use for our network connection needs for sys-net. -
Update your whole system (thus update your newly downloaded deb11min-net template):
(in dom0)$ qubesctl --show-output state.sls update.qubes-dom0
(in dom0)$ qubes-dom0-update --clean -y
(in dom0)$ qubesctl --show-output --skip-dom0 --templates state.sls update.qubes-vm
-
Using
apt
update and upgrade your deb11min-net template:
(in dom0)$ qvm-run --pass-io -u root deb11min-net "apt update && apt full-upgrade -y"
-
Now install the necessary packages for network management:
(in dom0)$ qvm-run --pass-io -u root deb11min-net "apt install --no-install-recommends -y firmware-iwlwifi qubes-core-agent-networking qubes-core-agent-network-manager"
-
Shutdown the internet-connected qubes in order to modify sys-net settings:
(in dom0)$ qvm-shutdown sys-whonix
(in dom0)$ qvm-shutdown sys-firewall
(in dom0)$ qvm-shutdown sys-net
-
Create a disposable vm out of the deb11min-net template, for acting as yet another template for the sys-net, and then base the sys-net on top of this newly created disposable template:
(in dom0)$ qvm-create --template deb11min-net --label red deb11min-net-dvm
(in dom0)$ qvm-prefs deb11min-net-dvm template_for_dispvms True
(in dom0)$ qvm-features deb11min-net-dvm appmenus-dispvm 1
(in dom0)$ qvm-prefs sys-net template deb11min-net-dvm
-
Finally, restart your whole QubesOS
(in dom0)$ sudo reboot now
After doing these steps, you should have a working internet connection using your minimal debian template (deb11min-net).
For comparison, here are the number of packages between debian-11 and our deb11min-net:
debian-11: 1332 packages
deb11min-net: 486 packages
This is 3x less packages, yet giving you the same functionality.
Thanks to @tzwcfq , @unman , @Sven and qubes-os documentation for guiding me.