- **Recommended:** [Install a fresh template to replace the existing one.](#installing) **This option may be simpler for less experienced users.** After you install the new template, redo all desired template modifications and [switch everything that was set to the old template to the new template](/doc/templates/#switching). You may want to write down the modifications you make to your templates so that you remember what to redo on each fresh install. In the old Debian template, see `/var/log/dpkg.log` and `/var/log/apt/history.log` for logs of package manager actions.
- **Advanced:** [Perform an in-place upgrade of an existing Debian template.](/doc/templates/debian/in-place-upgrade/) This option will preserve any modifications you've made to the template, **but it may be more complicated for less experienced users.**
The Debian way (generally) is to start daemons if they are installed.
This means that if you install (say) ssh-server in a template, *all* the qubes that use that template will run a ssh server when they start. (They will, naturally, all have the same server key.) This may not be what you want.
So be very careful when installing software in Templates - if the daemon spawns outbound connections then there is a serious security risk.
In general, a reasonable approach would be, (using ssh as example):
(Replace XX with the Debian version number of the template you wish to remove.)
There are two possible ways to remove the TemplateVM. Check with `qvm-prefs debian-XX | grep installed_by_rpm` which way this template has been installed in the past. If you have the boolean value "False", the you have to use `sudo -E qubes-dom0-update --action=purge --yes qubes-template-debian-XX`. If you have the boolean value "True" then execute this command `sudo dnf -y remove qubes-template-debian-XX`.