[SOLVED] Debian9 apt: package x needs to be reinstalled, but no archive found
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I didn't know about LC_ALL=c...I will remember that.
jvermeulen@jvermeulen:~/Downloads$
Code:
LC_ALL=c sudo sudo dpkg --purge --force-all PackageX
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
(Reading database ... 278235 files and directories currently installed.)
Removing PackageX (3.0.2.1.el7-2) ...
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (c)
userdel: user 'xxx' does not exist
dpkg: error processing package packageX (--purge):
subprocess installed post-removal script returned error exit status 6
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Errors were encountered while processing:
PackageX
Thanks. Do you have the original deb file so that you can reinstall this package? Normally, --force-all should take care of business, so you could try doing as it advises (although you might find that subsequently trying to uninstall it triggers the same post-removal script error, but we'll cross that bridge if/when we come to it).
LC_ALL=c sudo dpkg -i --force-all packageX_3.0.2.1.el7-2_amd64.deb
Selecting previously unselected package packageX.
(Reading database ... 278236 files and directories currently installed.)
Preparing to unpack packageX_3.0.2.1.el7-2_amd64.deb ...
Unpacking packageX (3.0.2.1.el7-2) over (3.0.2.1.el7-2) ...
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (c)
userdel: user 'xxx' does not exist
dpkg: warning: subprocess old post-removal script returned error exit status 6
dpkg: trying script from the new package instead ...
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (c)
userdel: user 'xxx' does not exist
dpkg: error processing archive packageX_3.0.2.1.el7-2_amd64.deb (--install):
subprocess new post-removal script returned error exit status 6
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (c)
userdel: user 'xxx' does not exist
dpkg: error while cleaning up:
subprocess new post-removal script returned error exit status 6
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for desktop-file-utils (0.23-1) ...
Processing triggers for mime-support (3.60) ...
Errors were encountered while processing:
packageX_3.0.2.1.el7-2_amd64.deb
But then trying to remove it indeed gives same EM...
It doesn't appear to have installed correctly anyway.
Is there any chance that you could paste the post-removal script on here so that I can have a look? If you don't know how to access this then let me know.
Ok. You can first extract the package's control files with:
Code:
dpkg -e packageX_3.0.2.1.el7-2_amd64.deb
This will create a DEBIAN subdirectory in the current directory. In that subdirectory, you will find the control files, including postrm which is the post-removal script.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
I am not sure if it confuses apt if a post install script has an error while removing. After all the package has been removed. I mean would apt set the package to partially installed or removed if the postrm script returns an error.
If it does, two workarounds: create user 'xxx' or edit the postrm script to force to return OK after running userdel. It is BTW a questionable policy to return an error on something which already has been completed. If the script want to delete a user which does not exist that is not an error.
I am not sure if it confuses apt if a post install script has an error while removing. After all the package has been removed. I mean would apt set the package to partially installed or removed if the postrm script returns an error.
If it does, two workarounds: create user 'xxx' or edit the postrm script to force to return OK after running userdel. It is BTW a questionable policy to return an error on something which already has been completed. If the script want to delete a user which does not exist that is not an error.
jlinkels
Good advice, What I'm hoping to do for the OP is repackage the original package but with a modified or blank postrm file - that will be easy to do and should solve the problem. The package hasn't actually been removed, it has been "half removed". We're down at dpkg level by the way, rather than at apt level.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by hydrurga
We're down at dpkg level by the way, rather than at apt level.
Yes, I know. But it is dpkg which sets the package installed status. IIRC apt calls dpkg for installing or removing packages, but apt does much more in terms of dependency management.
I think adding user xxx solved the problem.
After adding user:
Code:
jvermeulen@jvermeulen:~$ id xxx
UID=1001(xxx) GID=1001(xxx) groepen=1001(xxx)
jvermeulen@jvermeulen:~$ LC_ALL=c sudo sudo dpkg --purge --force-all packageX
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
(Reading database ... 278234 files and directories currently installed.)
Purging configuration files for packageX (3.0.2.1.el7-2) ...
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (c)
After that I can update/upgrade again, use apt in a normal way!
Thanks for the help, I learned a lot.
J.
I think adding user xxx solved the problem.
After adding user:
Code:
jvermeulen@jvermeulen:~$ id xxx
UID=1001(xxx) GID=1001(xxx) groepen=1001(xxx)
jvermeulen@jvermeulen:~$ LC_ALL=c sudo sudo dpkg --purge --force-all packageX
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
(Reading database ... 278234 files and directories currently installed.)
Purging configuration files for packageX (3.0.2.1.el7-2) ...
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (c)
After that I can update/upgrade again, use apt in a normal way!
Thanks for the help, I learned a lot.
J.
Great to hear. jlinkels' solution was less convoluted than mine was to have been. Nice one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.