Score:1

apt and dpkg ruined after botched xplico installation

in flag

I tried to install the version of xplico for Ubuntu 16.04 in Ubuntu 21.10 with sudo bash -c 'echo "deb http://repo.xplico.org/ $(lsb_release -s -c) main" >> /etc/apt/sources.list' && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 791C25CE && sudo apt update && sudo apt install xplico and then I got a `post-removal script subprocess returned error exit status 127 error.

After a failed xplico install now I'm left with this error message and I can't install or remove other applications because xplico has to be removed first:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  xplico
0 upgraded, 0 newly installed, 1 to remove and 52 not upgraded.
1 not fully installed or removed.
After this operation, 86.8 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 213087 files and directories currently installed.)
Removing xplico (1.2.2) ...
/var/lib/dpkg/info/xplico.postrm: 23: /etc/apache2: Permission denied
dpkg: error processing package xplico (--remove):
 installed xplico package post-removal script subprocess returned error exit status 127
dpkg: too many errors, stopping
Errors were encountered while processing:
 xplico
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

what should I do?

Sina Aghily avatar
in flag
its ubuntu 21.10
karel avatar
sa flag
What did you do? Did you try to install the version of xplico for Ubuntu 16.04 in Ubuntu 21.10 with `sudo bash -c 'echo "deb http://repo.xplico.org/ $(lsb_release -s -c) main" >> /etc/apt/sources.list' && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 791C25CE && sudo apt update && sudo apt install xplico` and then you got a `post-removal script subprocess returned error exit status 127` error because of an expired key?
Sina Aghily avatar
in flag
Yeah thats what I got
Sina Aghily avatar
in flag
I don’t know what it for but that came up
Sina Aghily avatar
in flag
So I try to install xplico, it fails installing it. Then I try to install other programs and it first has to remove the xplico which is partially insyalled. Its kind of clogged so I can’t install anything.
Score:2
sa flag

You need to remove the xplico package, but the version of xplico that you installed is for Ubuntu 16.04 and you are running Ubuntu 21.10. Maybe that's why you got a post-removal script subprocess returned error exit status 127 error message. exit status 127 is the exit code for an expired key. The expired key is from 2016 and I didn't find any way of updating it, but you can regain normal use of apt and dpkg without updating the expired key.

  1. Remove the expired key that you added when trying to install xplico.

    sudo apt-key del 791C25CE
    
  2. Edit /var/lib/dpkg/info/xplico.postrm (if it exists) in nano text editor with sudoedit /var/lib/dpkg/info/xplico.postrm and replace its contents with:

    #!/bin/bash
    set -e
    /bin/true
    

    Nano text editor keyboard shortcuts
    Use the keyboard combination Ctrl + O and after that press Enter to save the file to its current location.
    Use the keyboard combination Ctrl + X to exit nano.

  3. Edit your /var/lib/dpkg/status by removing xplico with its description and save your changes to /var/lib/dpkg/status. Then run sudo dpkg --configure -a && sudo apt -f install.

  4. The above command might not do the trick. If so, run the following additional commands to force uninstall xplico.

    sudo mv /var/lib/dpkg/info/postinst /var/lib/dpkg/info/postinst.bak
    sudo mv /var/lib/dpkg/info/postrm /var/lib/dpkg/info/postrm.bak
    sudo mv /var/lib/dpkg/info/preinst /var/lib/dpkg/info/preinst.bak
    sudo dpkg --remove --force-remove-reinstreq xplico
    

Then try to update the system with sudo apt update

Sina Aghily avatar
in flag
thanks man it worked, thankyou so much
karel avatar
sa flag
@SinaAghily If this answered your question, you can mark this answer as accepted by clicking the gray check mark beside the answer to change its color to green.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.