{{Header}} {{Title|title= Reinstall {{q_project_name_long}} Templates }} {{#seo: |description=How to Reinstall {{q_project_name_short}} Templates |image=Qubesreinstall123123.png }} {{qubes_mininav}} [[File:Qubesreinstall123123.png|250px|thumb]] {{intro| How to Reinstall {{q_project_name_short}} Templates }} = Introduction = On occasion it is necessary to reinstall a {{project_name_long}} template from the Qubes repository. https://www.qubes-os.org/doc/how-to-reinstall-a-template/ {{mbox | type = notice | image = [[File:Ambox_notice.png|40px|alt=Info]] | text = Note: If {{q_project_name_short}} 16 is installed and you want to get {{q_project_name_short}} 17, it is unnecessary to follow the instructions on this page. Refer to [[Qubes/Install|Install {{q_project_name_short}}]] instructions instead because it is easier. This is because the name of the Templates changed from: * whonix-gw-16 to whonix-gateway-17 * whonix-workstation-16 to whonix-workstation-17 }} This chapter usually applies when the template is: *Outdated: To upgrade to a newer [[Point Release]] or testers-only version of {{project_name_short}}. *Broken: Templates can become broken and/or unbootable for a number of reasons, like when [[Debian_Packages#Packages_FAQ|removing meta-packages]] that {{project_name_short}} "depends" on to function properly, or after {{kicksecure_wiki |wikipage=Install_Software#Install_from_Debian_Testing |text=mixing packages }} from a later Debian release. *Misconfigured: Not all Template modifications are easily reversible. In some cases it may be necessary to reinstall the Template. *Compromised: Users may suspect their Template has been compromised. For further information on this topic, see: [[Malware and Firmware Trojans#Valid_Compromise_Indicators_versus_Invalid_Compromise_Indicators|Indicators of Compromise]]. *Testing: To ensure a high quality of future {{project_name_short}} releases by becoming a {{project_name_short}} tester. == Warning == {{mbox | image = [[File:Ambox_warning_pn.svg.png|40px]] | text = If the {{project_name_short}} Template is broken, misconfigured or potentially compromised, discontinue using any App Qubes based on the affected template. }} The obvious reason is any App Qubes that are based on the affected Template will inherit the same issues. Disregarding this advice could lead to serious consequences. For example, a core component of the {{project_name_short}} security model depends on {{project_name_gateway_vm}} forcing all traffic through Tor or blocking it. If {{project_name_gateway_vm}} was based on a Template with a misconfigured or broken firewall, the {{project_name_short}} security model would be broken. [[Dev/Technical_Introduction#With_more_technical_terms|Technical Introduction: With more technical terms]] == Reinstallation Methods == Qubes has its own [https://www.qubes-os.org/doc/how-to-reinstall-a-template/ template reinstallation guide], however this {{project_name_short}} wiki entry should be preferred for re-installation of [[Qubes|{{q_project_name_short}}]]. The reason is this guide is Whonix-specific and contains instructions on how to properly configure all settings. Using salt. {{mbox | type = notice | image = [[File:Ambox_notice.png|40px|alt=Info]] | text = Note: The root file system of the affected Template will be lost during the reinstallation process. It is recommended to create a backup of any important files first. }} Use one of the following methods: * '''A)''' [[Qubes/Uninstall|Uninstall {{q_project_name_short}}]] and then [[Qubes/Install|Install {{q_project_name_short}}]]; OR * '''B)''' Follow the [[#Reinstall the {{project_name_short}} template|Reinstall the {{project_name_short}} template]] instructions below. = Reinstall the {{project_name_short}} template = == UpdateVM Setting == Since only Fedora-based UpdateVMs support the --action=upgrade option for reinstalling the Template, it is recommended to create a dedicated Qubes dom0 UpdateVM based on Qubes' Fedora template. Forcing dom0 updates over Tor is still possible by setting {{project_name_gateway_vm}} as the NetVM for the UpdateVM. * sys-netsys-firewall{{project_name_gateway_vm}}UpdateVM * UpdateVM{{project_name_gateway_vm}}sys-firewallsys-net {{Box|text= '''1.''' Create a new VM named dom0-updatevm. Qubes VM ManagerVMCreate App Qube * Name and label: Name the App Qube. Do not include any personal information (if the App Qube is compromised, the attacker could run qubesdb-read /name to reveal the VM name). Name the App Qube something generic, for example: dom0-updatevm. * Color: Choose a color label for the UpdateVM. * Use this template: Choose the Fedora-based Template. For example: fedora-34. (There may or may not be a higher version number than 34 than there was at time of writing.) * Standalone: Leave the Standalone field unchecked. * Type: Choose the type App Qube. * Allow networking: Choose the desired NetVM from the list. For example: {{project_name_gateway_vm}}. * Press: OK. '''2.''' Configure the NetVM setting of dom0-updatevm. * '''Option A''': If non-torified, clearnet Qubes dom0 updates are preferred, set the NetVM of dom0-updatevm for example to sys-firewall. Qube Managerdom0-updatevmQube settingsNetworking: sys-firewallOK {{CodeSelect|code= qvm-prefs updatevm-name netvm {{project_name_gateway_vm}} }} * '''Option B''': If torified Qubes dom0 updates are preferred, set the NetVM of dom0-updatevm to {{project_name_gateway_long}}. Qube Managerdom0-updatevmQube settingsNetworking: {{project_name_gateway_vm}}OK {{CodeSelect|code= qvm-prefs updatevm-name netvm {{project_name_gateway_vm}} }} '''3.''' The process of configuring the UpdateVM is now complete. If the dom0 UpdateVM is based on a template that is broken or no longer trusted (the template is broken, misconfigured or compromised), an alternate UpdateVM can be used temporarily. In other words, more specifically, if the {{project_name_gateway_short}} Template ({{project_name_gateway_template}}) and/or its {{project_name_gateway_short}} ProxyVM ({{project_name_gateway_vm}}) are no longer trusted, then configure Qubes dom0 to use a different UpdateVM by applying the following steps. TODO }} == Update dom0 == {{Qubes_upgrade_dom0}} == Configure salt using Qubes dom0 Community Testing Repository == {{Qubes_testing}} == Adjust {{project_name_short}} Version Number == {{Qubes_Adjust_Project_Version_Number}} == Reinstall == In the instructions below, a check is first made for a newer version of the Template. * If a newer Template version exists, install it (upgrade). * If no newer Template version is available, reinstall the existing version (reinstall). Unfortunately there is no combined upgrade and reinstall command. [https://github.com/QubesOS/qubes-issues/issues/4518 qubes-dom0-update combined upgrade reinstall command] {{Box|text= '''1.''' {{Qubes_Terminal}} '''2.''' First try upgrading the Template. This will only work if there is a new [[Point Release]] of the Template. Execute the following command. Notes: * Template choice: Replace qubes-template-package with either: qubes-template-whonix-workstation-{{VersionShort}} or qubes-template-whonix-gateway-{{VersionShort}}, respectively. * Testers-Only: Testers should replace --enablerepo=qubes-templates-community with --enablerepo=qubes-templates-community-testing. Syntax:
qvm-template --enablerepo=qubes-templates-community upgrade 
For example, to reinstall and upgrade whonix-gateway-{{VersionShort}} Template. {{CodeSelect|code= qvm-template --enablerepo=qubes-templates-community upgrade whonix-gateway-{{VersionShort}} }} For example, to reinstall and upgrade whonix-workstation-{{VersionShort}} Template. {{CodeSelect|code= qvm-template --enablerepo=qubes-templates-community upgrade whonix-workstation-{{VersionShort}} }} '''3.''' Read the output of the above command. The following outcomes are possible, either: * '''A)''' The Template is upgraded. In that case, skip step four below ("Reinstall the Template"); OR * '''B)''' The commands above might finish relatively quickly and state No new updates available. In that case, proceed with step four below ("Reinstall the Template"); OR * '''C)''' A Template upgrade is unsupported. This might happen if a non-Fedora based UpdateVM is used in conjunction with the upgrade option. See: [[Qubes/Reinstall#UpdateVM_Setting|UpdateVM Setting]] for further information; OR * '''D)''' An error has occurred, such as a networking issue. '''4.''' ''Optional:'' Reinstall the Template. If upgrade at step two did not actually reinstall the Template, this means there is no new [[Point Release]] available at present. This also means the Template has not been actually reinstalled and further action is required (see below). If unsure, the commands below are safe in any case because if you already have the latest Template version, then it will simply be reinstalled again. Execute the following command. Notes: Same notes as above apply. Syntax:
qvm-template --enablerepo=qubes-templates-community reinstall 
For example, to reinstall whonix-gateway-{{VersionShort}} Template. {{CodeSelect|code= qvm-template --enablerepo=qubes-templates-community reinstall qubes-template-whonix-gateway-{{VersionShort}} }} For example, to reinstall whonix-workstation-{{VersionShort}} Template. {{CodeSelect|code= qvm-template --enablerepo=qubes-templates-community reinstall qubes-template-whonix-workstation-{{VersionShort}} }} Read the output of the above command. There are two possible outcomes, either: * '''A)''' The Template was reinstalled; OR * '''B)''' An error has occurred, such as a networking issue. }} == Settings == {{mbox | image = [[File:Ambox_warning_pn.svg.png|40px]] | text = This step is mandatory. [https://github.com/QubesOS/qubes-issues/issues/3447 phase out manual use of qubes-dom0-update by user / replace it by salt] }} Use salt to configure dom0 settings. [[Dev/Qubes#salt]] {{CodeSelect|code= sudo qubesctl state.sls qvm.{{project_name_workstation_vm}} }} = Optional Steps = == {{project_name_short}} Disposable Template == {{Qubes_Install_DVM}} == Updates over Tor == {{Qubes Install Updates over Tor}} == Enable AppArmor == {{Qubes_AppArmor}} = Final Steps = == Restart App Qubes == Any VMs based on the reinstalled Template must be restarted to reflect the updated file system. == Update and Launch Applications == {{Qubes Install Update and Launch Applications}} == Done == The process of reinstalling {{q_project_name_short}} Templates is now complete. = Footnotes = {{reflist|close=1}} {{Footer}} [[Category:Documentation]]