installed apt package post-installation script subprocess returned error exit status 127

Asked by xfwang

Need your help. When i tried to upgrade and found issues below. Thanks

~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up apt (2.0.8) ...
/var/lib/dpkg/info/apt.postinst: 65: /etc/kernel/postinst.d/apt-auto-removal: not found
dpkg: error processing package apt (--configure):
 installed apt package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 apt
E: Sub-process /usr/bin/dpkg returned an error code (1)

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

Probably Bug #1974456

Temporary workaround:

Issue the command
sudo gedit /var/lib/dpkg/info/apt.postinst
In the editor window that opens scroll down to line 63 and remove the following lines:

        # create kernel autoremoval blacklist on update
        if dpkg --compare-versions "$2" lt 0.9.9.3; then
            /etc/kernel/postinst.d/apt-auto-removal
        fi

Save the file and close the editor., then run the command
sudo dpkg --configure -a

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

I suggest you comment them out instead. Less destructive

So:

        # create kernel autoremoval blacklist on update
        if dpkg --compare-versions "$2" lt 0.9.9.3; then
            /etc/kernel/postinst.d/apt-auto-removal
        fi

Would become:

        # create kernel autoremoval blacklist on update
        #if dpkg --compare-versions "$2" lt 0.9.9.3; then
        # /etc/kernel/postinst.d/apt-auto-removal
        #fi

Can you help with this problem?

Provide an answer of your own, or ask xfwang for more information if necessary.

To post a message you must log in.