LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   apt-get problem - need top force remove an application (https://www.linuxquestions.org/questions/debian-26/apt-get-problem-need-top-force-remove-an-application-256121/)

amon 11-17-2004 04:10 PM

apt-get problem - need top force remove an application
 
I am running an installation of Libranet which i have upgraded with apt-get to the equivalent of Debian Sarge. after doing an upgrade and makeing some changes the alsa audio stopped working properly. in my inexperiance i attempted to use the setup scripts provided by adminmenu (application provided by libranet). after attempting to apt-get alsa and various other things (i can't remember exactly what ive done after 3 hours of no luck) i have managed to have a copy of alsa-modules installed that i can't remove, and without reomving this programme i can't make any changes.

the installed program is one of the libranet specific programmes. i have also got the problem that this is stopping the installation of annother application that is broken.

when i run apt-get the error i get is:
root@amon1:/home/amon# apt-get -f install
Reading Package Lists... Done
Building Dependency Tree... Done
Correcting dependencies... Done
The following extra packages will be installed:
kudzu kudzu-vesa libranet-upgrade pciutils
The following packages will be REMOVED:
alsa-modules-2.4.21
The following NEW packages will be installed:
kudzu kudzu-vesa libranet-upgrade pciutils
0 upgraded, 4 newly installed, 1 to remove and 5 not upgraded.
2 not fully installed or removed.
Need to get 0B/468kB of archives.
After unpacking 609kB disk space will be freed.
Do you want to continue? [Y/n] y
Media Change: Please insert the disc labeled
'Libranet GNU/Linux 2.8.1 CD2'
in the drive '/cdrom/' and press enter

(Reading database ... 137510 files and directories currently installed.)
Removing alsa-modules-2.4.21 ...
invoke-rc.d: unknown initscript, /etc/init.d/alsa not found.
dpkg: error processing alsa-modules-2.4.21 (--remove):
subprocess post-removal script returned error exit status 100
Errors were encountered while processing:
alsa-modules-2.4.21
E: Sub-process /usr/bin/dpkg returned an error code (1)


is there a way of removing the entry from the apt-get database as i have physicaly deleated the files listed for alsa-modules using rm as su.

ToniT 11-17-2004 04:32 PM

The thing to try first:
dpkg --purge alsa-modules-2.4.21

If that doesn't work, move to way 2.

Way #2:
ok, there goes something wrong with the
/var/lib/dpkg/info/alsa-modules-2.4.21.postrm
file (no, don't remove it!), probably because it wasn't prepared that the files are missing.

If that package is from libranet I don't know the exact contents, but it probably has
some lines like:
Code:

if [ "$1" = "remove" ]; then
        if [ $(uname -r) = "2.4.21" ]; then
                invoke-rc.d alsa stop
        fi
fi

If so, replace them with :
Code:

if [ "$1" = "remove" ]; then
        if [ $(uname -r) = "2.4.21" ]; then
#                invoke-rc.d alsa stop
            true
        fi
fi

(Comment out the invoke-rc.d line and add the line "true").

Now run
apt-get -f install
again and see if it works.


And what comes to deleting files, don't. Use apt-get and dpkg to manage your files in other places than /home, /usr/local and /etc (let the package mangager to keep record of files in /etc too, to some extent).

ToniT 11-17-2004 04:33 PM

Ah, and a way #3:
(that might also work)
Code:

touch /etc/init.d/alsa
chmod +x /etc/init.d/alsa
apt-get -f install


amon 11-17-2004 06:07 PM

method 1 was unsuccessful.

however method 2 worked strait off and the file was easy to find and the edit was easy, exactly as stated above. thanks very much.

jamslug 10-22-2010 07:02 AM

Same problem with mysql-cluster-server in ubuntu 10.10
 
I read your post and you gave me inspiration:

For me it was this file: /var/lib/dpkg/info/mysql-cluster-server-5.1.prerm

And I edited as this:

#!/bin/sh
set -e
# Automatically added by dh_installinit
if [ -x "/etc/init.d/mysql" ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
true
#invoke-rc.d mysql stop || exit $?
#else
#/etc/init.d/mysql stop || exit $?
fi
fi
# End automatically added section

Works perfect ;-)

Thanks a lot


All times are GMT -5. The time now is 03:33 PM.