LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   permantly removing a program from apt-get (https://www.linuxquestions.org/questions/debian-26/permantly-removing-a-program-from-apt-get-294533/)

diensthunds 02-24-2005 07:42 PM

permantly removing a program from apt-get
 
I for some odd reason have a program stuck in my apt-get database and for the life of me can't get rid of it. I have removed the program from the hard drive and all the files that were associated with it (came from the "supposedly installed files that you get when ya select it in synaptic) problem is every time I start synaptic it still tells me I have a broken program. This is a real problem in that I can't use apt-get from the command line. Where's the file(s) that I need to fix to get apt working?

Clark Bent 02-24-2005 08:11 PM

That happens from time to time. Have you tried apt-get install -f ?

Pr1musr3x 02-24-2005 08:14 PM

Re: permantly removing a program from apt-get
 
Quote:

Originally posted by diensthunds
I for some odd reason have a program stuck in my apt-get database and for the life of me can't get rid of it. I have removed the program from the hard drive and all the files that were associated with it (came from the "supposedly installed files that you get when ya select it in synaptic) problem is every time I start synaptic it still tells me I have a broken program. This is a real problem in that I can't use apt-get from the command line. Where's the file(s) that I need to fix to get apt working?
diensthunds, any idea as to which package it is that is half-installed/b0rked? If you know the name, one way out of it is to manually download the .deb for this package, issue this command i.e. "dpkg-deb --contents packagename" (WITHOUT quotes), note the files that gets installed and their repsective locations and then manually do a "rm -rf" for each of them.

Next time, do NOT ever attempt to manually remove files belonging to an installed/half-installed package. When on Debian, use the Debian utilities provided apt-get or dpkg to do it. IF you ever need to remove a package and its configuration files COMPLETELY i.e. purged them from your system, type "dpkg -P packagename" (WITHOUT quotes, and where packagename refers to name of problematic package) as root. I suspect the package segfaullted due to a buggy mainatiners' script e.g. preinst, postinst, or postrm. In such instances, you'll need to manually tamper with the particular maintainers' script. I have already explained in another thread i.e. one on Temporary Workaround for seahorse 0.7.6-2 install in Sid shown a quick and easy fix that has saved me arse on numerous occasions.

To save you the trouble of hunting down that thread...here's the fix:

Workaround for seahorse 0.7.6-2 install in Sid
Arising out of an apt-get upgrade session or apt-get install seahorse.

The bug report on this latest version of seahorse as fetched by apt-listbugs seems to indicate that the problem of with regards to its installation/upgrade on Sid has been fixed BUT in reality, it is NOT the case. See below:

Retrieving bug reports... Done
grave bugs of seahorse (0.7.6-1 -> 0.7.6-2) <done>
#296189 - seahorse: Upgrade from 0.7.6-1 to 0.7.6-2 fails.
Summary:
seahorse(1 bug)

dpkg --force overwrite -i /var/cache/apt/archives/seahorse_0.7.6-2_i386.deb
postinst called with unknown argument `upgrade'
dpkg: warning - old post-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
postinst called with unknown argument `failed-upgrade'
dpkg: error processing /var/cache/apt/archives/seahorse_0.7.6-2_i386.deb (--install):
subprocess new post-removal script returned error exit status 1
postinst called with unknown argument `abort-upgrade'
dpkg: error while cleaning up:
subprocess post-removal script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/seahorse_0.7.6-2_i386.deb
nano /var/lib/dpkg/info/seahorse.postrm
insert "exit 0" after "set -e" line (WITHOUT the quotes in BOTH) then type "Ctrl O" to save amendment. Rerun apt-get install seahorse to rid half-installed status of seahorse. Went fine for me i.e.

debian:/home/maximusp/dloads/debs# apt-show-versions seahorse
seahorse/unstable uptodate 0.7.6-2


Do not get to be reliant on cli tools, they still have their limitations e.g. your particular situation :D. It's also your only route to salvaging a buggy xserver upgrade (not trying to frighten you but it does occur from time to time ;)). Best of luck!

:cool:

diensthunds 02-24-2005 08:42 PM

Quote:

Originally posted by Clark Bent
That happens from time to time. Have you tried apt-get install -f ?
Yup I tried the apt-get -f install and apt-get -f remove and both still gave me the

(Reading database ... 100952 files and directories currently installed.)
Removing bootsplash-theme-newlinux ...
dpkg: error processing bootsplash-theme-newlinux (--remove):
subprocess pre-removal script returned error exit status 10
Errors were encountered while processing:
bootsplash-theme-newlinux
E: Sub-process /usr/bin/dpkg returned an error code (1)

diensthunds 02-24-2005 09:03 PM

Re: Re: permantly removing a program from apt-get
 
Quote:

Originally posted by Pr1musr3x
diensthunds, any idea as to which package it is that is half-installed/b0rked? If you know the name, one way out of it is to manually download the .deb for this package, issue this command i.e. "dpkg-deb --contents packagename" (WITHOUT quotes), note the files that gets installed and their repsective locations and then manually do a "rm -rf" for each of them.

Next time, do NOT ever attempt to manually remove files belonging to an installed/half-installed package. When on Debian, use the Debian utilities provided apt-get or dpkg to do it. IF you ever need to remove a package and its configuration files COMPLETELY i.e. purged them from your system, type "dpkg -P packagename" (WITHOUT quotes, and where packagename refers to name of problematic package) as root. I suspect the package segfaullted due to a buggy mainatiners' script e.g. preinst, postinst, or postrm. In such instances, you'll need to manually tamper with the particular maintainers' script. I have already explained in another thread i.e. one on Temporary Workaround for seahorse 0.7.6-2 install in Sid shown a quick and easy fix that has saved me arse on numerous occasions.

To save you the trouble of hunting down that thread...here's the fix:

Workaround for seahorse 0.7.6-2 install in Sid
Arising out of an apt-get upgrade session or apt-get install seahorse.

The bug report on this latest version of seahorse as fetched by apt-listbugs seems to indicate that the problem of with regards to its installation/upgrade on Sid has been fixed BUT in reality, it is NOT the case. See below:

Retrieving bug reports... Done
grave bugs of seahorse (0.7.6-1 -> 0.7.6-2) <done>
#296189 - seahorse: Upgrade from 0.7.6-1 to 0.7.6-2 fails.
Summary:
seahorse(1 bug)

dpkg --force overwrite -i /var/cache/apt/archives/seahorse_0.7.6-2_i386.deb
postinst called with unknown argument `upgrade'
dpkg: warning - old post-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
postinst called with unknown argument `failed-upgrade'
dpkg: error processing /var/cache/apt/archives/seahorse_0.7.6-2_i386.deb (--install):
subprocess new post-removal script returned error exit status 1
postinst called with unknown argument `abort-upgrade'
dpkg: error while cleaning up:
subprocess post-removal script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/seahorse_0.7.6-2_i386.deb
nano /var/lib/dpkg/info/seahorse.postrm
insert "exit 0" after "set -e" line (WITHOUT the quotes in BOTH) then type "Ctrl O" to save amendment. Rerun apt-get install seahorse to rid half-installed status of seahorse. Went fine for me i.e.

debian:/home/maximusp/dloads/debs# apt-show-versions seahorse
seahorse/unstable uptodate 0.7.6-2


Do not get to be reliant on cli tools, they still have their limitations e.g. your particular situation :D. It's also your only route to salvaging a buggy xserver upgrade (not trying to frighten you but it does occur from time to time ;)). Best of luck!

:cool:


Yes I know what file it is that is causing me the headache. I'm d/l it now and will do the dpkg-deb --contents and rm -rf on it when it's done. I usually don't do a manual removal of packages and let apt-get and dpkg do their thing but in this case they didn't work, I believe this is due to the maintainers script, as you said. It was after all from an unstable repo and yes I realise that things often break when you start messing with unstable. The only problem is that I have allready done the rm -f on all the files that should have been installed. They are gone, however dpkg and apt still think that they are there for some reason.

Pr1musr3x 02-24-2005 09:07 PM

Quote:

Originally posted by diensthunds
Yup I tried the apt-get -f install and apt-get -f remove and both still gave me the

(Reading database ... 100952 files and directories currently installed.)
Removing bootsplash-theme-newlinux ...
dpkg: error processing bootsplash-theme-newlinux (--remove):
subprocess pre-removal script returned error exit status 10
Errors were encountered while processing:
bootsplash-theme-newlinux
E: Sub-process /usr/bin/dpkg returned an error code (1)

diensthunds, re-read what I told you about those mainatiners' scripts. Try this at the cli (commandline interface), "ls -al /var/lib/dpkg/info |grep bootsplash-theme-newlinux" (WITHOUT the quotes) and see if you have a bootsplash-theme-newlinux.prerm. If you have it, fire up nano or vim or gedit or any editor of your choice (suggest you better get acquainted with cli editors) and add "exit 0" (WITHOUT the quotes) just underneath "set -e" (WITHOUT the quotes), then SAVED the amended /var/lib/dpkg/info/bootsplash-theme-newlinux.prerm, then run "dpkg -P bootsplash-theme-newlinux" (WITHOUT the quotes). This should be enough.

Example prerm script (for seahorse)

Code:

#!/bin/sh set -e # Automatically added by dh_gconf if [ "$1" = remove ] || [ "$1" = upgrade ]; then        SCHEMA_LOCATION=/usr/share/gconf/schemas        SCHEMA_FILES="seahorse.schemas "        for SCHEMA in $SCHEMA_FILES; do                if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then                        HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \                                gconftool-2 \                                        --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null                fi        done fi # End automatically added section
Let's assume that seahorse is giving me the problem like bootsplash-theme-newlinux is giving you, I would edit /var/lib/dpkg/info/seahorse.prerm in the following manner:

Code:

#!/bin/sh set -e exit 0 # Automatically added by dh_gconf if [ "$1" = remove ] || [ "$1" = upgrade ]; then        SCHEMA_LOCATION=/usr/share/gconf/schemas        SCHEMA_FILES="seahorse.schemas "        for SCHEMA in $SCHEMA_FILES; do                if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then                        HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \                                gconftool-2 \                                        --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null                fi        done fi # End automatically added section
NOTE the addition of "exit 0"

diensthunds 02-25-2005 05:41 PM

sorry was reading that late at night I did it again after a good rest and it worked thanks

macewan 03-06-2005 02:41 PM

Quote:

Originally posted by Pr1musr3x
diensthunds, re-read what I told you about those mainatiners' scripts. Try this at the cli (commandline interface), "ls -al /var/lib/dpkg/info |grep bootsplash-theme-newlinux" (WITHOUT the quotes) and see if you have a bootsplash-theme-newlinux.prerm. If you have it, fire up nano or vim or gedit or any editor of your choice (suggest you better get acquainted with cli editors) and add "exit 0" (WITHOUT the quotes) just underneath "set -e" (WITHOUT the quotes), then SAVED the amended /var/lib/dpkg/info/bootsplash-theme-newlinux.prerm, then run "dpkg -P bootsplash-theme-newlinux" (WITHOUT the quotes). This should be enough.

Example prerm script (for seahorse)

Code:

#!/bin/sh set -e # Automatically added by dh_gconf if [ "$1" = remove ] || [ "$1" = upgrade ]; then        SCHEMA_LOCATION=/usr/share/gconf/schemas        SCHEMA_FILES="seahorse.schemas "        for SCHEMA in $SCHEMA_FILES; do                if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then                        HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \                                gconftool-2 \                                        --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null                fi        done fi # End automatically added section
Let's assume that seahorse is giving me the problem like bootsplash-theme-newlinux is giving you, I would edit /var/lib/dpkg/info/seahorse.prerm in the following manner:

Code:

#!/bin/sh set -e exit 0 # Automatically added by dh_gconf if [ "$1" = remove ] || [ "$1" = upgrade ]; then        SCHEMA_LOCATION=/usr/share/gconf/schemas        SCHEMA_FILES="seahorse.schemas "        for SCHEMA in $SCHEMA_FILES; do                if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then                        HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \                                gconftool-2 \                                        --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null                fi        done fi # End automatically added section
NOTE the addition of "exit 0"


thank you. i've been fking with that for too long this afternoon. mine was an error with bootsplash files on Ubuntu


All times are GMT -5. The time now is 01:32 PM.