0

I last night installed a package sougoupinyin from a file sougoupinyin.deb via dpkg. I remember there being some missing dependencies that I didn't know how to take care of.

After I restarted my computer, I tried to install some other packages via apt. However, I came across this error:

littlewhole@pop-os:~$ sudo apt-get install fcitx fcitx-mozc kde-config-fcitx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
fcitx is already the newest version (1:4.2.9.7-3).
kde-config-fcitx is already the newest version (0.5.5-2build1).
The following packages will be REMOVED:
  sogoupinyin
The following NEW packages will be installed:
  fcitx-mozc
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 247 kB of archives.
After this operation, 57.2 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 fcitx-mozc amd64 2.23.2815.102+dfsg-8ubuntu1 [247 kB]
Fetched 247 kB in 0s (1,190 kB/s)  
(Reading database ... 235083 files and directories currently installed.)
Removing sogoupinyin (2.2.0.0108) ...
/var/lib/dpkg/info/sogoupinyin.postrm: 8: local: debian": bad variable name
dpkg: error processing package sogoupinyin (--remove):
 installed sogoupinyin package post-removal script subprocess returned error exit status 2
dpkg: too many errors, stopping
Errors were encountered while processing:
 sogoupinyin
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

I then tried to reinstall the package via dpkg, and got pretty much the same error:

littlewhole@pop-os:~$ sudo dpkg -i '/home/littlewhole/sogoupinyin.deb' 
Selecting previously unselected package sogoupinyin.
(Reading database ... 235083 files and directories currently installed.)
Preparing to unpack .../littlewhole/sogoupinyin.deb ...
Unpacking sogoupinyin (2.2.0.0108) over (2.2.0.0108) ...
/var/lib/dpkg/info/sogoupinyin.postrm: 8: local: debian": bad variable name
dpkg: warning: old sogoupinyin package post-removal script subprocess returned error exit status 2
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/postrm: 8: local: debian": bad variable name
dpkg: error processing archive /home/littlewhole/sogoupinyin.deb (--install):
 new sogoupinyin package post-removal script subprocess returned error exit status 2
/var/lib/dpkg/tmp.ci/postrm: 8: local: debian": bad variable name
dpkg: error while cleaning up:
 new sogoupinyin package post-removal script subprocess returned error exit status 2
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for libglib2.0-0:i386 (2.64.2-1~fakesync1) ...
Processing triggers for libglib2.0-0:amd64 (2.64.2-1~fakesync1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for shared-mime-info (1.15-1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:
 /home/littlewhole/sogoupinyin.deb

So then I tried to uninstall the package via dpkg, only to be greeted with this error:

littlewhole@pop-os:~$ sudo dpkg -r sougoupinyin
dpkg: warning: ignoring request to remove sougoupinyin which isn't installed

At this point I decided to take to askubuntu to see if anyone else had a similar problem and had a fix. I found an answer suggesting that running this would fix it:

sudo rm -rf /var/lib/dpkg/info/sougoupinyin.*
sudo rm -rf /usr/share/sougoupinyin
sudo rm -rf /etc/default/sougoupinyin
sudo rm -rf /etc/init.d/sougoupinyin
sudo apt purge sougoupinyin

I decided to run this. The rm operations completed successfully, but the apt purge was again met with an error:

littlewhole@pop-os:~$ sudo apt purge sougoupinyin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package sogoupinyin needs to be reinstalled, but I can't find an archive for it.

After browsing through a few more questions and answers, I decided to try this sudo apt-get -f install, but alas, another error:

littlewhole@pop-os:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package sogoupinyin needs to be reinstalled, but I can't find an archive for it.

Finally, I tried sudo dpkg --remove --force-remove-reinstreq sougoupinyin. But even that threw an error:

littlewhole@pop-os:~$ sudo dpkg --remove --force-remove-reinstreq sougoupinyin
dpkg: warning: ignoring request to remove sougoupinyin which isn't installed

At this point, my system is in this limbo between "this package exists, you have to reinstall it" and "this package isn't installed". I tried to reinstall the same .deb via dpkg, but still, error:

littlewhole@pop-os:~$ sudo dpkg -i '/home/littlewhole/sogoupinyin.deb' 
(Reading database ... 235083 files and directories currently installed.)
Preparing to unpack .../littlewhole/sogoupinyin.deb ...
Unpacking sogoupinyin (2.2.0.0108) over (2.2.0.0108) ...
/var/lib/dpkg/info/sogoupinyin.postrm: 8: local: debian": bad variable name
dpkg: warning: old sogoupinyin package post-removal script subprocess returned error exit status 2
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/postrm: 8: local: debian": bad variable name
dpkg: error processing archive /home/littlewhole/sogoupinyin.deb (--install):
 new sogoupinyin package post-removal script subprocess returned error exit status 2
/var/lib/dpkg/tmp.ci/postrm: 8: local: debian": bad variable name
dpkg: error while cleaning up:
 new sogoupinyin package post-removal script subprocess returned error exit status 2
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for libglib2.0-0:i386 (2.64.2-1~fakesync1) ...
Processing triggers for libglib2.0-0:amd64 (2.64.2-1~fakesync1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for shared-mime-info (1.15-1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:
 /home/littlewhole/sogoupinyin.deb

Right now, apt is being held up by these errors. I can't install any packages via apt. This is obviously a problem. I can neither reinstall or remove this package, and it's holding up apt. What should I do?

2
  • 1
    Yes, that's what --force-remove-reinstreq does: It makes users confused. That command tells dpkg to forget that the package ever existed but leave all the files in place. You still need to clean up all those left-behind files manually. For example, your output clearly shows that you left a broken postrm script in place. Consult Pop!_OS support for your next steps.
    – user535733
    Commented Jun 29, 2020 at 14:53
  • How would I fix the broken postrm script?
    – LittleWhole
    Commented Jun 29, 2020 at 17:12

1 Answer 1

2

As hinted in the messages, there is an issue on line 8 of /var/lib/dpkg/info/sogoupinyin.postrm — that is, with post removal procedures.

If you feel confident you can edit this file (as root) and fix the issue, or even comment the faulty line if you are sure they are not harmless.

Then apt-get remove sogoupinyin should work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .