Kali-core template is broken, removes qubes-core-agent when installing packages

Hi,

after an update broke my kali installation i need to redo it.

However when installing normal tools apt tries to remove qubes-core* packages, basically breaking the qube/template.

Steps to reproduce:

Install template (in dom0):

sudo qvm-template install --enablerepo=qubes-templates-community-testing kali-core

Update kali-core:

sudo apt update -y
sudo apt upgrade -y

Install a common package (in kali-core):

┌──(root㉿kali-core)-[~]
└─# apt install python3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  avahi-utils bridge-utils bubblewrap conntrack cpp cpp-13 cups-pk-helper curl dconf-cli debugedit deltarpm dnf dnf-data docbook-xml enchant-2 fakeroot fonts-dejavu fonts-dejavu-extra fwupd-qubes-vm gcc-13-base gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0
  gir1.2-girepository-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-handy-1 gir1.2-harfbuzz-0.0 gir1.2-nautilus-4.0 gir1.2-notify-0.7 gir1.2-packagekitglib-1.0 gir1.2-pango-1.0 gir1.2-polkit-1.0 gir1.2-secret-1 glib-networking glib-networking-common glib-networking-services
  gnome-icon-theme gnome-keyring gnome-keyring-pkcs11 gnome-terminal gnome-terminal-data graphicsmagick groff-base grub-xen-bin grub-xen-host gsfonts gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-x ibverbs-providers imagemagick-6-common jcat
  keyboard-configuration libaa1 libabsl20220623 libass9 libasyncns0 libauthen-sasl-perl libavc1394-0 libavfilter9 libavformat60 libavtp0 libayatana-appindicator3-1 libayatana-ido3-0.4-0 libayatana-indicator3-7 libblas3 libboost-iostreams1.74.0 libboost-thread1.74.0 libbs2b0
  libcaca0 libchromaprint1 libcjson1 libclone-perl libcomps0 libconfig++9v5 libdata-dump-perl libdbusmenu-glib4 libdbusmenu-gtk3-4 libdc1394-25 libdca0 libdecor-0-0 libdecor-0-plugin-1-cairo libdirectfb-1.7-7 libdjvulibre-text libdjvulibre21 libdnf2-common libdnf2t64 libdv4
  libdvdnav4 libdvdread8 libenchant-2-2 libencode-locale-perl libfaad2 libfakeroot libfdt1 libffado2 libfftw3-double3 libfile-basedir-perl libfile-desktopentry-perl libfile-listing-perl libfile-mimeinfo-perl libflac12 libflite1 libfluidsynth3 libfmt9 libfont-afm-perl libfreeaptx0
  libfsverity0 libgfapi0 libgfortran5 libgfrpc0 libgfxdr0 libgirepository-1.0-1 libgles2 libglibmm-2.4-1v5 libglusterfs0 libgme0 libgphoto2-l10n libgraphicsmagick-q16-3 libgssdp-1.6-0 libgstreamer-plugins-bad1.0-0 libgupnp-1.6-0 libgupnp-igd-1.6-0 libhandy-1-0
  libharfbuzz-gobject0 libharfbuzz-icu0 libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libhunspell-1.7-0 libhyphen0 libibverbs1
  libiec61883-0 libimagequant0 libimath-3-1-29 libinstpatch-1.0-2 libio-compress-brotli-perl libio-html-perl libio-socket-ssl-perl libio-stringy-perl libipc-system-simple-perl libiscsi7 libisl23 libjack-jackd2-0 libjavascriptcoregtk-4.1-0 libjcat1 libjxr-tools libjxr0 libkate1
  liblapack3 libldacbt-enc2 libldb2 liblilv-0-0 liblmdb0 liblqr-1-0 liblrdf0 libltc11 liblua5.3-0 liblua5.4-0 liblwp-mediatypes-perl liblwp-protocol-https-perl libmagickcore-6.q16-6 libmagickcore-6.q16-6-extra libmagickwand-6.q16-6 libmailtools-perl libmanette-0.2-0
  libmbedcrypto7 libmfx1 libmjpegutils-2.1-0 libmodplug1 libmodulemd2 libmpc3 libmpcdec6 libmpeg2encpp-2.1-0 libmpg123-0 libmplex2-2.1-0 libmysofa1 libnautilus-extension4 libneon27 libnet-dbus-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libnfs14 libnice10
  libnma-common libnma0 libnorm1 libopenal-data libopenal1 libopenexr-3-1-30 libopenfec1 libopenh264-7 libopenmpt0 libopenni2-0 libpackagekit-glib2-18 libpam-gnome-keyring libpangoxft-1.0-0 libpgm-5.3-0 libpipeline1 libpipewire-0.3-0 libpipewire-0.3-common libpipewire-0.3-modules
  libplacebo338 libpocketsphinx3 libpostproc57 libproxy1v5 libpulse0 libpython3.12t64 libqrexec-utils2 libqubes-pure0 libqubes-rpc-filecopy2 libqubesdb librabbitmq4 librados2 libraptor2-0 libraqm0 libraw1394-11 librbd1 librdmacm1 libregexp-ipv6-perl librepo0 librist4 libroc0.3
  librpm10 librpm9 librpmbuild10 librpmbuild9 librpmio10 librpmio9 librpmsign10 librpmsign9 librubberband2 libsbc1 libsdl2-2.0-0 libserd-0-0 libshout3 libsigc++-2.0-0v5 libsmbclient libsndfile1 libsndio7.0 libsolv1 libsolvext1 libsord-0-0 libsoundtouch1 libsoup-3.0-0
  libsoup-3.0-common libsoup2.4-1 libsoup2.4-common libspa-0.2-modules libspandsp2 libspeexdsp1 libsphinxbase3 libspice-server1 libsratom-0-0 libsrt1.5-gnutls libsrtp2-1 libssh-4 libssh-gcrypt-4 libswscale7 libtag1v5 libtag1v5-vanilla libtalloc2 libtevent0 libtie-ixhash-perl
  libtimedate-perl libtry-tiny-perl libuchardet0 libunbound8 libunibreak5 liburi-perl liburing2 libuv1 libv4l-0 libv4lconvert0 libvchan-xen1 libvidstab1.1 libvo-aacenc0 libvo-amrwbenc0 libvte-2.91-0 libvte-2.91-common libwavpack1 libwbclient0 libwebkit2gtk-4.1-0 libwebpdemux2
  libwebrtc-audio-processing1 libwildmidi2 libwireplumber-0.4-0 libwmflite-0.2-7 libwoff1 libwpe-1.0-1 libwpebackend-fdo-1.0-1 libwww-perl libwww-robotrules-perl libx11-protocol-perl libxatracker2 libxcvt0 libxencall1t64 libxendevicemodel1t64 libxenevtchn1t64
  libxenforeignmemory1t64 libxengnttab1t64 libxenhypfs1t64 libxenmisc4.17t64 libxenstore4t64 libxentoolcore1t64 libxentoollog1t64 libxfont2 libxml++2.6-2v5 libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxslt1.1 libxss1 libxvmc1 libyajl2 libyelp0 libzbar0 libzimg2
  libzix-0-0 libzmq5 libzxing3 linux-image-6.1.0-17-amd64 man-db mobile-broadband-provider-info nautilus-extension-gnome-terminal network-manager-gnome ntpdate ntpsec-ntpdate ntpsec-ntpdig ovmf p11-kit p11-kit-modules perl-openssl-defaults pipewire pipewire-bin pipewire-pulse
  pipewire-qubes pocketsphinx-en-us policykit-1-gnome python-babel-localedata python3-babel python3-cairo python3-certifi python3-cffi python3-cffi-backend python3-chardet python3-charset-normalizer python3-click python3-colorama python3-croniter python3-cups python3-cupshelpers
  python3-daemon python3-dateutil python3-dbus python3-distro python3-dnf python3-gi python3-gpg python3-hawkey python3-idna python3-jinja2 python3-jmespath python3-lib2to3 python3-libcomps python3-libdnf python3-lockfile python3-looseversion python3-markupsafe python3-msgpack
  python3-nautilus python3-ntp python3-numpy python3-olefile python3-packaging python3-pil python3-pkg-resources python3-ply python3-psutil python3-py python3-pyasyncore python3-pycparser python3-pycryptodome python3-pyinotify python3-qrexec python3-qubesimgconverter
  python3-requests python3-rpm python3-six python3-smbc python3-tqdm python3-tz python3-unbound python3-urllib3 python3-xcffib python3-xdg python3-yaml python3-zmq python3.11 python3.11-minimal qemu-block-extra qemu-system-data qemu-system-xen qemu-utils
  qubes-core-agent-dom0-updates qubes-core-agent-nautilus qubes-core-agent-passwordless-root qubes-core-qrexec qubes-gpg-split qubes-img-converter qubes-mgmt-salt-vm-connector qubes-pdf-converter qubes-repo-templates qubes-utils qubesdb qubesdb-vm rpm rpm-common rpm2cpio rtkit
  salt-common salt-ssh samba-libs seabios sgml-data sqlite3 system-config-printer system-config-printer-common system-config-printer-udev systemd-dev timgm6mb-soundfont tinyproxy tinyproxy-bin usbutils wireplumber x11-xkb-utils x11-xserver-utils xbitmaps xcvt xdg-dbus-proxy
  xdg-desktop-portal xdg-desktop-portal-gtk xdg-utils xen-hypervisor-4.17-amd64 xen-utils-4.17 xen-utils-common xen-utils-guest xenstore-utils xfonts-base xinit xserver-common xserver-xorg xserver-xorg-core xserver-xorg-input-all xserver-xorg-input-libinput
  xserver-xorg-input-qubes xserver-xorg-input-wacom xserver-xorg-legacy xserver-xorg-qubes-common xserver-xorg-video-all xserver-xorg-video-amdgpu xserver-xorg-video-ati xserver-xorg-video-dummyqbs xserver-xorg-video-fbdev xserver-xorg-video-intel xserver-xorg-video-nouveau
  xserver-xorg-video-qxl xserver-xorg-video-radeon xserver-xorg-video-vesa xserver-xorg-video-vmware xterm yelp yelp-xsl zutty
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  bsdextrautils bsdutils cryptsetup cryptsetup-bin curl dnf dnf-data e2fsprogs eject fdisk file gir1.2-freedesktop gir1.2-girepository-2.0 gir1.2-glib-2.0 libarchive13t64 libassuan9 libblkid1 libc-bin libc6 libcom-err2 libcomps0 libcryptsetup12 libcurl3t64-gnutls libdb5.3t64
  libdnf2-common libdnf2t64 libdw1t64 libelf1t64 libevent-2.1-7t64 libexpat1 libext2fs2t64 libfdisk1 libgfortran5 libglib2.0-0t64 libglib2.0-bin libgnutls30t64 libgomp1 libgpgme11t64 libhogweed6t64 libmagic-mgc libmagic1t64 libmount1 libnettle8t64 libnghttp3-9 libngtcp2-16
  libngtcp2-crypto-gnutls8 libpam-systemd libpsl5t64 libpython3-stdlib libpython3.12-minimal libpython3.12-stdlib libpython3.12t64 libreadline8t64 librepo0 librpm10 librpmbuild10 librpmio10 librpmsign10 libsmartcols1 libssh2-1t64 libssl3t64 libstdc++6 libsystemd-shared
  libsystemd0 libtirpc3t64 libudev1 libunbound8 libuuid1 libxencall1t64 libxendevicemodel1t64 libxenevtchn1t64 libxenforeignmemory1t64 libxengnttab1t64 libxenhypfs1t64 libxenmisc4.17t64 libxenstore4t64 libxentoolcore1t64 libxentoollog1t64 linux-sysctl-defaults locales login
  login.defs mount openssl openssl-provider-legacy passwd python3-dnf python3-gpg python3-hawkey python3-libcomps python3-libdnf python3-minimal python3-rpm python3-unbound python3.12 python3.12-minimal rpm rpm-common rpm2cpio systemd systemd-cryptsetup systemd-timesyncd udev
  util-linux util-linux-extra xen-utils-4.17 xen-utils-common xenstore-utils
Suggested packages:
  cryptsetup-initramfs keyutils gpart fuse2fs e2fsck-static lrzip glibc-doc libnss-nis libnss-nisplus low-memory-monitor gnutls-bin libtss2-rc0t64 libpwquality1 uuid-runtime nfs-common python3-doc python3-tk python3-venv python3-dnf-doc python3-hawkey-docs python-libcomps-doc
  python3.12-venv python3.12-doc binutils binfmt-support alien elfutils rpmlint rpm-i18n systemd-container systemd-homed systemd-userdbd systemd-boot systemd-resolved systemd-repart libtss2-tcti-device0 kbd util-linux-locales wtmpdb xen-doc
Recommended packages:
  e2fsprogs-l10n manpages
The following packages will be REMOVED:
  libarchive13 libcurl3-gnutls libdb5.3 libdnf2 libdw1 libelf1 libevent-2.1-7 libext2fs2 libglib2.0-0 libgnutls30 libgpgme11 libhogweed6 libmagic1 libnettle8 libpsl5 libreadline8 libssh2-1 libssl3 libtirpc3 libxencall1 libxendevicemodel1 libxenevtchn1 libxenforeignmemory1
  libxengnttab1 libxenhypfs1 libxenmisc4.17 libxenstore4 libxentoolcore1 libxentoollog1 python3-distutils python3-qubesdb 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
The following NEW packages will be installed:
  libarchive13t64 libassuan9 libcurl3t64-gnutls libdb5.3t64 libdnf2t64 libdw1t64 libelf1t64 libevent-2.1-7t64 libext2fs2t64 libglib2.0-0t64 libgnutls30t64 libgpgme11t64 libhogweed6t64 libmagic1t64 libnettle8t64 libnghttp3-9 libngtcp2-16 libngtcp2-crypto-gnutls8 libpsl5t64
  libpython3.12t64 libreadline8t64 librpm10 librpmbuild10 librpmio10 librpmsign10 libssh2-1t64 libssl3t64 libtirpc3t64 libxencall1t64 libxendevicemodel1t64 libxenevtchn1t64 libxenforeignmemory1t64 libxengnttab1t64 libxenhypfs1t64 libxenmisc4.17t64 libxenstore4t64
  libxentoolcore1t64 libxentoollog1t64 linux-sysctl-defaults login.defs openssl-provider-legacy systemd-cryptsetup
The following packages will be upgraded:
  bsdextrautils bsdutils cryptsetup cryptsetup-bin curl dnf dnf-data e2fsprogs eject fdisk file gir1.2-freedesktop gir1.2-girepository-2.0 gir1.2-glib-2.0 libblkid1 libc-bin libc6 libcom-err2 libcomps0 libcryptsetup12 libdnf2-common libexpat1 libfdisk1 libgfortran5 libglib2.0-bin
  libgomp1 libmagic-mgc libmount1 libpam-systemd libpython3-stdlib libpython3.12-minimal libpython3.12-stdlib librepo0 libsmartcols1 libstdc++6 libsystemd-shared libsystemd0 libudev1 libunbound8 libuuid1 locales login mount openssl passwd python3 python3-dnf python3-gpg
  python3-hawkey python3-libcomps python3-libdnf python3-minimal python3-rpm python3-unbound python3.12 python3.12-minimal rpm rpm-common rpm2cpio systemd systemd-timesyncd udev util-linux util-linux-extra xen-utils-4.17 xen-utils-common xenstore-utils
67 upgraded, 42 newly installed, 39 to remove and 470 not upgraded.
Need to get 63.2 MB of archives.
After this operation, 19.8 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Note the important part:

[...]
The following packages will be REMOVED:
[...] python3-qubesdb 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
[...]

Possibly related problem: Kali does not upgrade - held broken packages? - #13 by KellyJohnson

I do not have much experience dealing with those dependency problems and could need some help to install tools without breaking the template.

PS:

I thought holding the qubes related stuff may solve it and it seems, that python3-qubesdb depends on python3 < 3.12 but 3.12.5 is to be installed. Not 100% sure what to do now.

┌──(root㉿kali-core)-[~]
└─# apt-mark hold python3-qubesdb 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 was already set on hold.
qubes-core-agent was already set on hold.
qubes-core-agent-network-manager was already set on hold.
qubes-core-agent-networking was already set on hold.
qubes-gui-agent was already set on hold.
qubes-input-proxy-sender was already set on hold.
qubes-usb-proxy was already set on hold.
qubes-vm-dependencies was already set on hold.
qubes-vm-recommended set on hold.

┌──(root㉿kali-core)-[~]
└─# apt install python3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-qubesdb : Depends: python3 (< 3.12) but 3.12.5-1+b1 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
1 Like

https://qubes.3isec.org/Templates/

Rolling distros - Parrot, Arch, Kali

Templates like Parrot or Kali are based on Debian testing, and are rolling distributions.
To avoid breakage when updating, the core Qubes packages should be on hold.
This means that they will not be updated.
You can confirm this by running apt-mark showhold in the template.
apt-mark unhold will remove the hold, and allow you to update the Qubes packages.
I suggest you restore the hold apt-mark hold to make sure that the Qubes packages are not removed when updating other packages.

So, while updating a template you will see that some packages cannot be upgraded because they will conflict with the Qubes packages.
Periodically, in the template, remove the hold on the Qubes packages. Update the package list with apt update and then update the Qubes packages - either manually with apt install... , or using a manager like aptitude, and selecting Qubes packages for upgrade.
Once the upgrade has been completed, put the Qubes packages back on hold, and upgrade again.

Undoubtedly a pain, but less than the pain of breaking your qubes, and having to crawl backwards to get them working again.
Then again, if you use aptitude you would be able to see what changes would be made, opt to retain the Qubes packages - always keep the Qubes packages, and avoid breakage that way. This depends on you looking to see what changes will be made and acting accordingly. Using apt-mark hold will take some pressure off.

2 Likes

Thank you very much apparatus!

I was unable to get it to working with holding, but with installing aptitude and carefully inspecting the proposed actions.

That does not solve the problem tho, i think upstream has to “do something”.

As of now kali template does not survive updating via regular qubes update method. We need some workaround.

Yup,

but i think there is another dependency problem, as i am having trouble installing python3 on a brand new kali-core image without using the qubes updater. Unsure if a normal aptitude upgrade works.

previously i did “kalification” for a debian template and it worked better, but i did not try it recently.

Mine is broken after a failed update too. The template won’t start at all. I can run xl console from dom0 terminal, but I get “name resolution failed for 127.0.0.1” when trying to run the update again.

I opted to reinstall the template because I had made very few changes to it, but I just wanted to make you all aware in case it helps. How do I prevent this from happening again?

Are you able to, for example, just install python3 on a fresh kali-core or do a manual upgrade?

In my template this removes qubes-core-agent and bricks the template.

kalification does not work for me.

As i am trying this, it also removes important packages at the dist-upgrade with enabled kali repos, resulting in error messages regarding qubes-core-agent.

!!! Warning !!!
The following is not the securest way to do this, but one of the faster methods. Fine for troubleshooting, maybe not for production.

Quick rundown for debian-12-xfce4 → kali:

  1. in dom0 qvm-clone debian-12-xfce dali
  2. Give more RAM, CPU and network to template

The procedure is mostly from here. Slightly modified, should run without user interaction.

in dali:

sudo -s
apt -y update
# Update 1: apt-mark hold python3-qubesdb 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
apt -y dist-upgrade
apt -y install -y gnupg dirmngr wget
wget -q -O - https://archive.kali.org/archive-key.asc | gpg --import
echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" > /etc/apt/sources.list.d/kali.list
gpg --export ED444FF07D8D0BF6 > /etc/apt/trusted.gpg.d/kali-rolling.gpg
apt -y update
apt -y upgrade
# Update 1: apt -y install qubes-core-agent-dom0-updates
# Update 2: apt -y remove qubes-vm-recommended
apt -y dist-upgrade
# Thats when shit hits the fan
# apt -y autoremove --purge
# apt -y  install kali-linux-core

It tries to remove the following packages:

  • python3-qubesdb
  • 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

… and fails at the qubes-core-agent

[...]
Removing qubes-core-agent (4.2.37-1+deb12u1) ...
dpkg-divert: warning: please specify --no-rename explicitly, the default will change to --rename in 1.20.x
Removing 'diversion of /etc/init/plymouth-shutdown.conf to /etc/init/plymouth-shutdown.conf.qubes-disabled by qubes-core-agent'
dpkg-divert: warning: please specify --no-rename explicitly, the default will change to --rename in 1.20.x
Removing 'diversion of /etc/init/prefdm.conf to /etc/init/prefdm.conf.qubes-disabled by qubes-core-agent'
dpkg-divert: warning: please specify --no-rename explicitly, the default will change to --rename in 1.20.x
Removing 'diversion of /etc/init/splash-manager.conf to /etc/init/splash-manager.conf.qubes-disabled by qubes-core-agent'
dpkg-divert: warning: please specify --no-rename explicitly, the default will change to --rename in 1.20.x
Removing 'diversion of /etc/init/start-ttys.conf to /etc/init/start-ttys.conf.qubes-disabled by qubes-core-agent'
dpkg-divert: warning: please specify --no-rename explicitly, the default will change to --rename in 1.20.x
Removing 'diversion of /etc/init/tty.conf to /etc/init/tty.conf.qubes-disabled by qubes-core-agent'
dpkg-divert: warning: please specify --no-rename explicitly, the default will change to --rename in 1.20.x
Removing 'diversion of /etc/init/serial.conf to /etc/init/serial.conf.qubes-orig by qubes-core-agent'
dpkg: warning: while removing qubes-core-agent, unable to remove directory '/rw': Device or resource busy - directory may be a mount point?
Failed to disable unit: Unknown method DisableUnitFilesWithFlagsAndInstallInfo or interface org.freedesktop.systemd1.Manager.
dpkg: error processing package qubes-core-agent (--remove):
 installed qubes-core-agent package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 qubes-core-agent
Processing was halted because there were too many errors.
sh: 1: /usr/lib/qubes/upgrades-status-notify: not found
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo apt install --fix-broken also fails with:

Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 171001 files and directories currently installed.)
Removing qubes-vm-dependencies (4.2.14-1+deb12u1) ...
Removing qubes-usb-proxy (1.3.1+deb12u1) ...
dpkg: qubes-core-agent: dependency problems, but removing anyway as you requested:
 qubes-gui-agent depends on qubes-core-agent (>= 3.0.14).
 qubes-core-agent-networking depends on qubes-core-agent (= 4.2.37-1+deb12u1).

Removing qubes-core-agent (4.2.37-1+deb12u1) ...
dpkg: warning: while removing qubes-core-agent, unable to remove directory '/rw': Device or resource busy - directory may be a mount point?
Failed to disable unit: Unknown method DisableUnitFilesWithFlagsAndInstallInfo or interface org.freedesktop.systemd1.Manager.
dpkg: error processing package qubes-core-agent (--remove):
 installed qubes-core-agent package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 qubes-core-agent
Processing was halted because there were too many errors.
sh: 1: /usr/lib/qubes/upgrades-status-notify: not found
E: Sub-process /usr/bin/dpkg returned an error code (1)

Marking the removed packages for hold does not help either.

Update:

I tried marking some packages on hold, as seen in the comments in the script. This results in my manual installation of qubes-core-agent-dom0-updates as it is needed for the dist-upgrade:

root@dali:/home/user# apt dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Error!
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 qubes-vm-recommended : Depends: qubes-core-agent-dom0-updates but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

But installing it, has no effect.

root@dali:/home/user# apt install qubes-core-agent-dom0-updates
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
qubes-core-agent-dom0-updates is already the newest version (4.2.37-1+deb12u1).
The following packages were automatically installed and are no longer required:
  libgphoto2-l10n libquadmath0 libwpe-1.0-1 libwpebackend-fdo-1.0-1 linux-image-6.1.0-21-amd64 python3-daemon python3-lockfile
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 629 not upgraded.

After this command, still the same error message from the dist-upgrade.

I am kinda running out of ideas/just trying random stuffs to get some kali qube to work.

Update 2

I am now trying the dist-upgrade with the qubes packages on hold as in Update 1 but removing qubes-vm-recommended before the last dist-upgrade with enabled kali repos. Does not work.

Anything i can do to have some kali with the ability to install stuffs? This is my work system and the next pentest starts in 12 hours :upside_down_face:.

1 Like

Here’s what I did:

  1. Restore previous backup of kali-core
  2. apt-mark hold qubes-*
  3. Update normally.

PSA: Make frequent backups

1 Like

Qubes tools are dependent on the specific version of python so you can’t install the newer version of python3 without removing the Qubes tools, e.g.:

$ apt info python3-qubesdb
Package: python3-qubesdb
Version: 4.2.6-1+deb12u1
Priority: extra
Section: python
Source: qubesdb
Maintainer: Jason Mehring <nrgaway@gmail.com>
Installed-Size: 38.9 kB
Depends: libqubesdb (= 4.2.6-1+deb12u1), libc6 (>= 2.4), python3 (<< 3.12), python3 (>= 3.11~)

To use newer version of python in kali with Qubes tools you’ll need to wait for devs to update the Qubes tools so they will work with newer python version.

1 Like

Kali uses the Debian Trixie python version.
If you replace bookworm with trixie in /etc/apt/sources.list.d/qubes-r4.list then it is able to update.

2 Likes

I can confirm that upgrading goes through without breaking stuff if you change bookworm to trixie in

/etc/apt/sources.list.d/debian.list
/etc/apt/sources.list.d/qubes-r4.list

My template might be a debian-minimal which I kali-fied, not sure about that. So, there might not be a debian.list in your template. Also, I have a file on_hold in /root/ which looks like this

python3-qubesdb
python3-qubesimgconverter
qubes-core-admin-client
qubes-core-agent
qubes-core-agent-dbgsym
qubes-core-agent-dom0-updates
qubes-core-agent-nautilus
qubes-core-agent-network-manager
qubes-core-agent-networking
qubes-core-agent-passwordless-root
qubes-core-agent-thunar
qubes-core-qrexec
qubes-core-qrexec-dbgsym
qubes-gpg-split
qubes-gui-agent
qubes-img-converter
qubes-input-proxy-sender
qubes-mgmt-salt-vm-connector
qubes-pdf-converter
qubes-usb-proxy
qubes-vm-dependencies

and can be used like this

apt-mark unhold $(cat on_hold)
apt-mark hold $(cat on_hold)
apt-mark showhold

I usually update the kali template from the command line with the aforementioned packages on hold. When apt returns issues I don’t update and make a backup of the template instead.