To upgrade from Debian 12 with KDE to Debian 13, I did run sudo apt-get full-upgrade -o dir::cache::archives=dir and sudo apt-get --fix-broken install -o dir::cache::archives=dir but despite of selecting a dir with more than enough disk space on it to prevent the upgrade to break, it did break in between because the root partition didn't have enough disk space or something. (I wonder whether the Debian upgrade will ever become user-friendly and properly prevent disk space issues.)
When running a --fix-broken install command, it showed me packages can be removed with autoremove. Since I needed disk space, I thought running autoremove may help so I ran sudo apt-get autoremove afterwards and in /var/log/apt/history.logit shows me which packages got removed. Now I noticed that command must have removed some packages I need:
- Audio doesn't work anymore (no output device)
- Kwrite wasn't installed anymore
- K3B wasn't installed anymore
- When I open a new tab in the Konsole, it shows some errors about locale settings (
setlocale: LC_CTYPE:etc) - I can't change a file in /etc/apt/sources.list.d because it fails at saving it (it takes long to show the password prompt and then it has errors in the console without saving it)
- Open apps are not showing in the Plasma taskbar anymore
I have the mentioned history.log file and before I made the distro upgrade, I ran dpkg --get-selections > ~/dir/package-selections-$(date +%Y%m%d).txt so I also have a list of packages installed earlier.
How to fix all those package problems probably introduced by the autoremove command?
aptlogs everything it does in/var/log/apt/history.log, so you can see exactly which packages were removed.dpkg(which is used by apt to install or remove packages) also logs everything it does in/var/log/dpkg.log- it's probably easier to extract a list of package names from file this because it uses a time-stamped one-event-per-line format. e.g.awk '/^2025-11-22/ && / (remove|purge) / {print $4}' /var/log/dpkg.log(note the space characters before & after "(remove|purge)" are important). You can use that list with anapt installcommand to reinstall some or all of them.apt) — nowaptshows exactly how much space is needed and will stop if a file system doesn’t have enough spare capacity. The release notes used to recommend upgradingdpkgandaptfirst, I’m not sure why that was removed.apt-get install k3b kwrite? Also check the removed/purged package list for anything that seems audio-related and investigate them....pay particular attention to packages related to pulse-audio or pipewire. and before you get all gung-ho again, I am very clearly and explicitly saying "DON'T install everything you find".sudo apt-get install -y $(awk ...). That's installing everything you found, specifically ALL the packages that were removed or purged on that date - that's what I described as "gung-ho". It can be safe to do that if you're certain there's only a small number of packages, or by editing the list of removed packages (manually with a text editor or by adding more tests in the awk script, e.g.&& $4 =~ /some regex/) - you can use any combination of &&, ||, !, and parentheses to make a boolean expr to match exactly what you want and exclude what you don't want.