When I run sudo apt-get upgrade or sudo apt-get autoremove, it returns:
Reading package lists... Done Building dependency tree... Done Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: linux-image-amd64 : Depends: linux-image-5.10.0-16-amd64 (= 5.10.127-2) but it is not installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). Then, when I run sudo apt --fix-broken install, it returns:
[...] Preparing to unpack .../linux-image-5.10.0-16-amd64_5.10.127-2_amd64.deb ... Unpacking linux-image-5.10.0-16-amd64 (5.10.127-2) ... dpkg: error processing archive /var/cache/apt/archives/linux-image-5.10.0-16-amd64_5.10.127-2_amd64.deb (--unpack): cannot copy extracted data for './boot/vmlinuz-5.10.0-16-amd64' to '/boot/vmlinuz-5.10.0-16-amd64.dpkg-new': failed to write (No space left on device) dpkg-deb: error: paste subprocess was killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/linux-image-5.10.0-16-amd64_5.10.127-2_amd64.deb I had nearly the same error on a second Debian11/KDE computer with the same error message.
There I could solve it using these two commands from here to free disk space on the boot partition. However, the command to remove unneeded kernel images doesn't work on this computer: when I run
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]' it shows a number of kernel image filenames but when I run the full command
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]' | xargs sudo apt -y purge it doesn't remove them. The same filenames still show when I run the former command and no disk space is freed so my problem remains. The output of the above is:
The following packages have unmet dependencies: linux-headers-amd64 : Depends: linux-headers-5.10.0-14-amd64 (= 5.10.113-1) but it is not going to be installed linux-image-amd64 : Depends: linux-image-5.10.0-16-amd64 (= 5.10.127-2) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). - First of all, all of this shouldn't be needed as upgrades should run smoothly and be so easy to do that basically most grandmas could do it. If there are issues with available disk space, it should prompt the user (in the console as well as in GUIs like Apper if that's used for upgrading) to do things like clearing old kernel images (maybe using the command above) or running
sudo rm -rf /var/cache/apt/archives/*or clearing/tmpor runningsudo apt-get autoremove/autocleanor other things depending how much disk space is needed and where. It should calculate how much disk space is needed and check if sufficient is available. Alternatively, if insufficient space is available, it could run the upgrades one at a time and clean up after each, or notify the user about it and abort the upgrade until enough disk space is available to prevent any issues. This is probably a separate question/issue. It's very inconvenient, outdated, insecure and user-unfriendly. - How to remove those old kernel images to free up the required disk space? If that wouldn't be the recommended route to solving this problem (again, it worked on another computer where I also had this problem), then please (also?) add how you'd solve it instead.