Can't remove pve-kernel-5.15.116-1-pve Package in Debian 11

Adrianozk

New Member
Sep 15, 2023
2
0
1
Hello Proxmox community,

I'm currently facing an issue when trying to remove the `pve-kernel-5.15.116-1-pve` package on Debian 11. Here's the context of my problem:

- Operating System: Debian 11
- Context: I initially attempted to install Proxmox alongside OpenMediaVault (OMV) on this Debian 11 system. However, I encountered an error during the installation process, and my primary issue now is related to removing the problematic package.

Issue Description:
I attempted to remove the `pve-kernel-5.15.116-1-pve` package using the following command:

sudo dpkg --remove --force-remove-reinstreq pve-kernel-5.15.116-1-pve

However, I received the following error:
Bash:
Removing pve-kernel-5.15.116-1-pve (5.15.116-1) ...
Examining /etc/kernel/postrm.d.
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 5.15.116-1-pve /boot/vmlinuz-5.15.116-1-pve
update-initramfs: Deleting /boot/initrd.img-5.15.116-1-pve
run-parts: executing /etc/kernel/postrm.d/proxmox-auto-removal 5.15.116-1-pve /boot/vmlinuz-5.15.116-1-pve
/etc/kernel/postrm.d/proxmox-auto-removal: 4: .: cannot open /usr/share/proxmox-kernel-helper/scripts/functions: No such file
run-parts: /etc/kernel/postrm.d/proxmox-auto-removal exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/pve-kernel-5.15.116-1-pve.postrm line 14.
dpkg: error processing package pve-kernel-5.15.116-1-pve (--remove):
 installed pve-kernel-5.15.116-1-pve package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 pve-kernel-5.15.116-1-pve
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've tried installing proxmox-kernel-helper as suggested by others, but it didn't resolve the issue. It seems like the post-removal script for pve-kernel-5.15.116-1-pve is encountering problems.

If anyone has encountered a similar issue or has any insights on how to resolve this, your assistance would be greatly appreciated. My goal is to successfully remove the pve-kernel-5.15.116-1-pve package from my Debian 11 system.

Thank you in advance for your help!

Additional Information:
  • Output of cat /var/lib/dpkg/info/pve-kernel-5.15.116-1-pve.postrm:
Perl:
#!/usr/bin/perl -w

use strict;

# Ignore all 'upgrade' invocations .
exit 0 if $ARGV[0] =~ /upgrade/;

my $imagedir = "/boot";

my $version = "5.15.116-1-pve";

if (-d "/etc/kernel/postrm.d") {
  print STDERR "Examining /etc/kernel/postrm.d.\n";
  system ("run-parts --verbose --exit-on-error --arg=$version " .
          "--arg=$imagedir/vmlinuz-$version " .
          "/etc/kernel/postrm.d") &&
            die "Failed to process /etc/kernel/postrm.d";
}

unlink "$imagedir/initrd.img-$version";
unlink "$imagedir/initrd.img-$version.bak";
unlink "/var/lib/initramfs-tools/$version";

# Ignore all invocations except when called on to purge.
exit 0 unless $ARGV[0] =~ /purge/;

my @files_to_remove = qw{
                         modules.dep modules.isapnpmap modules.pcimap
                         modules.usbmap modules.parportmap
                         modules.generic_string modules.ieee1394map
                         modules.ieee1394map modules.pnpbiosmap
                         modules.alias modules.ccwmap modules.inputmap
                         modules.symbols modules.ofmap
                         modules.seriomap modules.*.bin
                         modules.softdep modules.devname
                       };

foreach my $extra_file (@files_to_remove) {
    for (glob("/lib/modules/$version/$extra_file")) {
        unlink;
    }
}

system ("rmdir", "/lib/modules/$version") if -d "/lib/modules/$version";

exit 0;
 
Last edited:
I wanted to share the solution that worked for me regarding the removal of the pve-kernel-5.15.116-1-pve package on Debian 11.

Here's what worked for me:
  1. I commented out the /var/lib/dpkg/info/pve-kernel-5.15.116-1-pve.postrm file to prevent the post-removal script from running during removal.
  2. I ran the following command to forcefully remove the package:
    sudo dpkg -P --force-all pve-kernel-5.15.116-1-pve
  3. Then, I ran the following command to fix any broken dependencies:
    sudo apt --fix-broken install
This successfully removed the problematic package from my Debian 11 system.

I hope this solution helps others who might encounter a similar issue. If you have any questions or need further assistance, please feel free to ask.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!