Skip to main content

Kali LXC: Fixing Slow Desktop Load after KDE Upgrade

Background

Following an upgrade to KDE Plasma, whenever I entered user credentials, the KDE splash screen would load, but then it would take about a minute for the desktop environment to load. And even then, once the desktop environment was loaded, when clicking an application in the task bar, it would take about 30 seconds for the application to display.

Solution 1: Fix Service Conflicts

After an upgrade that installs core KDE packages, this may install, reinstall, or upgrade the plasma-nm package, which makes NetworkManager the default service for network configurations. KDE handles network connections via the NetworkManager service which clashes with systemd-networkd used by PVE to manage the Linux Containers' network stack.

sudo apt remove --auto-remove -y plasma-nm

Masking the systemd units should make this solution future-proof. But if you notice the issue coming back and logs show an upgrade was recently done, come back and repeat Solution 1

sudo systemctl disable --now systemd-networkd-wait-online NetworkManager
sudo systemctl mask systemd-networkd-wait-online NetworkManager

In my experience, the interface for the container does not come up / receive a DHCP lease when container starts. This could be due to the Kali image not being integrated with the PVE ecosystem, and failing to be managed by PVE. Either way, creating a cron job as root to bounce the networking service at reboot resolves this.

sudo crontab -e
@reboot systemctl restart networking.service

Solution 2: Fix Broken Packages

Reinstall Desktop Environment

Attempts to reinstall packages at their currently installed version

ssh -i id_rsa user@kali-host
sudo apt install --reinstall --fix-broken --auto-remove sddm $(
apt list $(
    apt info kali-desktop-kde kali-desktop-core sddm 2>/dev/null | 
    grep Depends | 
    sed -e 's/Depends: //g' -e 's/,//g' -e 's/ | / /g') 2>/dev/null | 
    grep amd64 | 
    cut -d '/' -f 1
)
reboot now

Reinstalling these packages may reintroduce the issue with NetworkManager. If so, please repeat the steps in Solution 1.