Apt remove error /usr/share/pve-kernel-helper/scripts/functions

franko5

Member
Feb 2, 2021
19
0
21
55
Hello,

I have the same problem on two pbs backup servers, running version: 1.1.13,
current kernel version: 5.4.106-1-pve

I can't do any update/install/uninstall due to the error:
Code:
(Reading database ... 78457 files and directories currently installed.)
Removing linux-image-4.19.0-16-amd64 (4.19.181-1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.19.0-16-amd64
/etc/kernel/postrm.d/proxmox-auto-removal:
/etc/kernel/postrm.d/proxmox-auto-removal: 4: .: Can't open /usr/share/pve-kernel-helper/scripts/functions
run-parts: /etc/kernel/postrm.d/proxmox-auto-removal exited with return code 127
dpkg: error processing package linux-image-4.19.0-16-amd64 (--remove):
 installed linux-image-4.19.0-16-amd64 package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-4.19.0-16-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

If I try to manually uninstall the package with:
Bash:
apt remove linux-image-4.19.0-16-amd64
or apt install -f or apt autoremove, always the same error.

Indeed, there is no script existing on the path: /usr/share/pve-kernel-helper/scripts/functions
(this is invoked by /etc/kernel/postrm.d/proxmox-auto-removal ) , first lines are:
Bash:
#! /bin/sh
set -e

. /usr/share/pve-kernel-helper/scripts/functions

Even if I try to move manually files /var/lib/dpkg/info/linux-image-4.19.0-18-amd64* to some tmp directory and afterwards
with commands as apt clean && dpkg --configure -a,
after apt remove or autoremove, always the same error Can't open /usr/share/pve-kernel-helper/scripts/functions.

Any idea how to fix that properly?
Thanks.
 
Hello,

Please provide us with the output of the below commands:

Bash:
grep '' /etc/apt/sources.list
grep '' /etc/apt/sources.list.d/*
apt update
 
Hello, sure, here it is:
Code:
$ grep '' /etc/apt/sources.list
deb http://mirror.hetzner.de/debian/packages buster main contrib non-free
deb http://mirror.hetzner.de/debian/security buster/updates main contrib non-free
deb http://mirror.hetzner.de/debian/packages buster-updates main contrib non-free

#
# deb cdrom:[Debian GNU/Linux 10.0.0 _Buster_ - Official amd64 NETINST 20190706-10:23]/ buster main
# deb cdrom:[Debian GNU/Linux 10.0.0 _Buster_ - Official amd64 NETINST 20190706-10:23]/ buster main

deb http://deb.debian.org/debian/ buster main non-free contrib
# deb-src http://deb.debian.org/debian/ buster main non-free contrib

deb http://security.debian.org/debian-security buster/updates main contrib non-free
# deb-src http://security.debian.org/debian-security buster/updates main contrib non-free

# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main contrib non-free
# deb-src http://deb.debian.org/debian/ buster-updates main contrib non-free

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

# PBS pbs-no-subscription repository provided by proxmox.com,
deb http://download.proxmox.com/debian/pbs buster pbs-no-subscription

$ grep '' /etc/apt/sources.list.d/*
/etc/apt/sources.list.d/cisofy-lynis.list:deb https://packages.cisofy.com/community/lynis/deb/ stable main
/etc/apt/sources.list.d/pbs-enterprise.list:# deb https://enterprise.proxmox.com/debian/pbs buster pbs-enterprise
/etc/apt/sources.list.d/zabbix.list:deb http://repo.zabbix.com/zabbix/5.2/debian/ buster main
/etc/apt/sources.list.d/zabbix.list:deb-src http://repo.zabbix.com/zabbix/5.2/debian/ buster main

Next,
Code:
$ apt update
Hit:1 http://mirror.hetzner.de/debian/packages buster InRelease
Hit:2 http://mirror.hetzner.de/debian/security buster/updates InRelease                                                                                                                                     
Hit:3 http://mirror.hetzner.de/debian/packages buster-updates InRelease                                                                                                                                     
Hit:4 http://deb.debian.org/debian buster InRelease                                                                                                                                                         
Get:5 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]                                                                                                                     
Hit:6 http://download.proxmox.com/debian/pbs buster InRelease                                                                                                                  
Hit:7 http://deb.debian.org/debian buster-updates InRelease                                                                                                                    
Hit:8 https://packages.cisofy.com/community/lynis/deb stable InRelease                                                                                       
Hit:9 http://repo.zabbix.com/zabbix/5.2/debian buster InRelease                                      
Fetched 65.4 kB in 1s (112 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
11 packages can be upgraded. Run 'apt list --upgradable' to see them.

And upgrade is failing:
Code:
$ apt upgrade -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  linux-image-4.19.0-16-amd64
The following packages will be upgraded:
  bind9-host libbind9-161 libdns-export1104 libdns1104 libisc-export1100 libisc1100 libisccc161 libisccfg163 liblwres161 proxmox-backup-server tzdata
11 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 18.7 MB of archives.
After this operation, 270 MB disk space will be freed.
Get:1 http://mirror.hetzner.de/debian/packages buster-updates/main amd64 tzdata all 2021a-0+deb10u3 [266 kB]
Get:2 http://mirror.hetzner.de/debian/security buster/updates/main amd64 bind9-host amd64 1:9.11.5.P4+dfsg-5.1+deb10u6 [271 kB]
Get:3 http://mirror.hetzner.de/debian/security buster/updates/main amd64 libbind9-161 amd64 1:9.11.5.P4+dfsg-5.1+deb10u6 [247 kB]
Get:4 http://mirror.hetzner.de/debian/security buster/updates/main amd64 libisccfg163 amd64 1:9.11.5.P4+dfsg-5.1+deb10u6 [267 kB]
Get:5 http://mirror.hetzner.de/debian/security buster/updates/main amd64 libisccc161 amd64 1:9.11.5.P4+dfsg-5.1+deb10u6 [237 kB]
Get:6 http://download.proxmox.com/debian/pbs buster/pbs-no-subscription amd64 proxmox-backup-server amd64 1.1.13-3 [14.2 MB]
Get:7 http://mirror.hetzner.de/debian/security buster/updates/main amd64 libdns1104 amd64 1:9.11.5.P4+dfsg-5.1+deb10u6 [1,215 kB]
Get:8 http://mirror.hetzner.de/debian/security buster/updates/main amd64 libisc1100 amd64 1:9.11.5.P4+dfsg-5.1+deb10u6 [458 kB]
Get:9 http://mirror.hetzner.de/debian/security buster/updates/main amd64 liblwres161 amd64 1:9.11.5.P4+dfsg-5.1+deb10u6 [252 kB]
Get:10 http://mirror.hetzner.de/debian/security buster/updates/main amd64 libisc-export1100 amd64 1:9.11.5.P4+dfsg-5.1+deb10u6 [380 kB]
Get:11 http://mirror.hetzner.de/debian/security buster/updates/main amd64 libdns-export1104 amd64 1:9.11.5.P4+dfsg-5.1+deb10u6 [970 kB]
Fetched 18.7 MB in 0s (75.2 MB/s)                                                       
Preconfiguring packages ...
dpkg: warning: files list file for package 'linux-image-4.19.0-18-amd64' missing; assuming package has no files currently installed
(Reading database ... 74207 files and directories currently installed.)
Removing linux-image-4.19.0-16-amd64 (4.19.181-1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.19.0-16-amd64
/etc/kernel/postrm.d/proxmox-auto-removal:
/etc/kernel/postrm.d/proxmox-auto-removal: 4: .: Can't open /usr/share/pve-kernel-helper/scripts/functions
run-parts: /etc/kernel/postrm.d/proxmox-auto-removal exited with return code 127
dpkg: error processing package linux-image-4.19.0-16-amd64 (--remove):
 installed linux-image-4.19.0-16-amd64 package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-4.19.0-16-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
 
Have you tried to remove the kernel with purge flag?

Bash:
apt-get remove --purge linux-image-4.19.0-16-amd64
 
Hi,

yes, same error with purge flag.
What is this script about: /etc/kernel/postrm.d/proxmox-auto-removal ?
Can it be tweaked/downloaded etc?
 
it's shipped by pve-kernel-helper, which you apparently removed from some reason ;)
 
This is so weird, I'm checking the history, it has never been touched manually.
Only apt upgrade or autoremove.
Also, pve-kernel-helper has not be removed/reinstalled etc.

Something is strange all together, I will have to investigate further.
Thanks for responses, anyhow.
 
maybe the permissions are wrong?