Issue with Debian 12 Template - Vital Qubes Packages Being Removed During Updates

Hi everyone,

I encountered a critical issue while attempting to install applications on my Debian 12 template in Qubes OS. During installation, the template would unexpectedly shut down, and I was no longer able to boot it. Each time, I received the following error:

Cannot connect to qrexec agent for 60 seconds.

Debugging the issue was extremely difficult because the template couldn’t boot, leaving me without a clear way to diagnose the problem and there was nothing in logs in Dom0. After numerous attempts, I systematically analyzed the installation process to identify the root cause.

It turned out that when updating python3-pip, some vital Qubes-related packages were being automatically removed. Here’s the list of packages that were removed during the process:

qubes-core-agent
qubes-core-agent-network-manager
qubes-core-agent-networking
qubes-gui-agent
qubes-input-proxy-sender
qubes-usb-proxy
qubes-vm-dependencies
qubes-vm-recommended
python3-qubesdb
libxencall1
libxendevicemodel1
libxenevtchn1
libxenforeignmemory1
libxengnttab1
libxenhypfs1
libxenmisc4.17
libxenstore4
libxentoolcore1
libxentoollog1

To resolve this, I used apt-mark to manually mark these packages as essential so that they wouldn’t be removed during updates:

sudo apt-mark manual

After doing this, the issue was resolved, and the template no longer shut down unexpectedly during updates.

I’m not sure if others have experienced this issue, but it seems like these critical Qubes packages should be marked as essential by default, or at the very least, there should be a confirmation prompt before they are removed.

I hope this post helps anyone encountering similar issues, and I would appreciate any insights or feedback from the community.