LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 02-24-2005, 07:42 PM   #1
diensthunds
Member
 
Registered: Oct 2003
Posts: 45

Rep: Reputation: 15
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?
 
Old 02-24-2005, 08:11 PM   #2
Clark Bent
Member
 
Registered: Jul 2004
Distribution: Debian, FreeBSD, Slamd64
Posts: 201

Rep: Reputation: 30
That happens from time to time. Have you tried apt-get install -f ?
 
Old 02-24-2005, 08:14 PM   #3
Pr1musr3x
Member
 
Registered: Feb 2004
Location: /dev/null
Distribution: Debian Sid, Mepis, Slackware 9.1
Posts: 41

Rep: Reputation: 15
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 . 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!


Last edited by Pr1musr3x; 02-24-2005 at 08:15 PM.
 
Old 02-24-2005, 08:42 PM   #4
diensthunds
Member
 
Registered: Oct 2003
Posts: 45

Original Poster
Rep: Reputation: 15
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)
 
Old 02-24-2005, 09:03 PM   #5
diensthunds
Member
 
Registered: Oct 2003
Posts: 45

Original Poster
Rep: Reputation: 15
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 . 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!


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.
 
Old 02-24-2005, 09:07 PM   #6
Pr1musr3x
Member
 
Registered: Feb 2004
Location: /dev/null
Distribution: Debian Sid, Mepis, Slackware 9.1
Posts: 41

Rep: Reputation: 15
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"

Last edited by Pr1musr3x; 02-26-2005 at 08:34 PM.
 
Old 02-25-2005, 05:41 PM   #7
diensthunds
Member
 
Registered: Oct 2003
Posts: 45

Original Poster
Rep: Reputation: 15
sorry was reading that late at night I did it again after a good rest and it worked thanks
 
Old 03-06-2005, 02:41 PM   #8
macewan
Senior Member
 
Registered: Jan 2002
Distribution: Ubuntu, Debian
Posts: 1,055
Blog Entries: 1

Rep: Reputation: 45
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apt not removing dependencies JetJock Debian 11 06-18-2005 02:09 AM
Removing and then reinstalling through synaptic / apt-get? Erik_the_Red Linux - Software 4 06-05-2005 10:40 AM
Removing extra files using apt-get Brother Michael Debian 7 06-20-2004 05:24 PM
removing obsolete files in APT m_yates Debian 1 11-15-2003 06:57 PM
apt-get error when removing (debian) hyrule Linux - Distributions 4 03-03-2003 10:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration