How do I force remove a package in Arch with pacman?

  • How do I force remove a package in Arch with pacman while other packages still depend upon it.

    pacman -R perl-libwww                                                               
    checking dependencies...
    error: failed to prepare transaction (could not satisfy dependencies)
    :: perl-app-cpanminus: requires perl-libwww>=5.828
    :: perl-app-pmuninstall: requires perl-libwww
    :: perl-app-sd: requires perl-libwww
    :: perl-catalyst-action-rest: requires perl-libwww>=2.033 
    :: perl-catalyst-runtime: requires perl-libwww>=1.64
    :: perl-cpan: requires perl-libwww
    :: perl-cpan-mini: requires perl-libwww
    :: perl-cpan-uploader: requires perl-libwww
    :: perl-feed-find: requires perl-libwww
    :: perl-http-body: requires perl-libwww
    :: perl-http-request-ascgi: requires perl-libwww
    :: perl-module-cpants-analyse: requires perl-libwww
    :: perl-module-install: requires perl-libwww>=5.812
    :: perl-net-trac: requires perl-libwww
    :: perl-net-whois-raw: requires perl-libwww
    :: perl-prophet: requires perl-libwww
    :: perl-rt-client-rest: requires perl-libwww
    :: perl-uri-fetch: requires perl-libwww
    :: perl-www-mechanize: requires perl-libwww
    :: perl-xml-atom: requires perl-libwww
    :: perl-xml-feed: requires perl-libwww

    basically LWP 6 split a whole bunch of packages, and I need to remove it so I can reinstall it.

    There is no equivalent of apt-get's --reinstall flag?

    @faheem considering that arch hasn't released libwww 6 yet... even if there was it wouldn't work right in this scenario

    @xenoterracide: Sorry, I didn't follow your response at all (I assume libwww is something to do with the package you are trying to install) but please don't feel you need to explain on my behalf. :-)

    @faheem it's LWP. but we can normally just reinstall a package by requesting it's install again... that doesn't help in this case though because it's non in arch repo's and I need to uninstall this and upgrade it without using arch repo's, and since the package was split, I had file conflicts.

    @faheem also please note that Arch is not debian, and have no idea how debian's `apt-get --reinstall` works.

    @xenoterracide: You want a more recent version of this perl-www package than is in arch? So you are trying to uninstall the installed arch version to do a local install of the more recent version, or something like that? Why not just make a package? It is probably not difficult.

    @xenoterracide: `apt-get install --reinstall` reinstalls the package without attempting to remove its dependencies. This can be useful in certain circumstances.

    @fatheem ... sigh... that is exactly what I'm doing... but because it has been split into many packages... the new packages conflict with the old and it must be removed before they can be installed. Otherwise there are conflicting files. I don't know how debian handles package file ownership conflicts, but arch and gentoo will both yell at you if another package owns the files and you try to install it. It can be overridden but because of how I made the package... a general overriding would be less easy than removing it and then installing the new.

  • Kambus

    Kambus Correct answer

    10 years ago

    You should be able to reinstall the package with a simple:

    # pacman -S perl-libwww

    This will only remove perl-libwww:

    # pacman -Rdd perl-libwww

    Please notice the double -d in the command, if you use --nodeps you have to specify that twice too or combine it with a -d like:

    # pacman -R --nodeps --nodeps perl-libwww
    # pacman -Rd --nodeps perl-libwww

    This removes all the packages which depend on perl-libwww:

    # pacman -Rc perl-libwww

    From pacman's man page:

       -d, --nodeps
           Skips dependency version checks. Package names are still
           checked. Normally, pacman will always check a package’s
           dependency fields to ensure that all dependencies are
           installed and there are no package conflicts in the
           system. Specify this option twice to skip all dependency
       -c, --cascade
           Remove all target packages, as well as all packages that
           depend on one or more target packages. This operation is
           recursive, and must be used with care since it can remove
           many potentially needed packages.

    +1 thanks for -Rc also, more info in Arch Wiki

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM