1

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?

20
  • 1
    @MarcusMüller Yes, that was another machine where I did not have the issue described here Commented Nov 24 at 22:15
  • 1
    apt logs 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 an apt install command to reinstall some or all of them. Commented Nov 25 at 3:30
  • 2
    @mYnDstrEAm right, the lack of warning is unfortunate, and fixed for Debian 13 (so upgrades to 14, or upgrades from 12 to 13 where users start by upgrading apt) — now apt shows 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 upgrading dpkg and apt first, I’m not sure why that was removed. Commented Nov 25 at 12:02
  • 1
    don't install everything that was removed - some of that was removed because it is obsolete and has been replaced by newer, possibly incompatible versions. Did you try just 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". Commented Nov 25 at 21:33
  • 1
    You said that you ran 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. Commented Nov 26 at 17:00

1 Answer 1

0

This is now more or less solved using the installation logs at /var/log/apt/history.log and /var/log/dpkg.log

I looked through the history.log file to see which autoremove command removed the kwrite and k3b apps. Then I opened /var/log/dpkg.log in a text editor like kwrite and copied all its contents from the time of the Start-Date to the End-Date of that autoremove command in the history.log and put it in a separate file ./packageslist. Then I ran the below (replace the date) to get just the names of the removed packages:

awk '/^2025-11-22/ && / (remove|purge) / {print $4}' ./packageslist.txt

Then I reinstalled all the apps that I thought I may need. These also included kinfocenter kmenuedit fuse-overlayfs.

To fix the audio problem, I did this.

To solve the warnings in the console, I did run this: sudo dpkg-reconfigure locales.

The problem with not being able to save an edited file were solved probably by the packages I installed.

The running open apps show in the Plasma taskbar again after I restarted Plasma with killall plasmashell and then kstart5 plasmashell &.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.