Loading...
X

Analogue of the –force option in pacman

If you update or install a new package, then if the files included in this package are already present in the file system, the update/install operation is aborted and the files that are already present in the system are displayed. In my practice, the reasons are usually packages installed with pip and the same packages that are trying to install with pacman – in which case the package files already exist and installation is not possible.

By the way, in this case, you definitely don't need to use the –force option, but you need to remove the interfering package with a command like:

pip uninstall PACKAGE

Previously, pacman had the –force option – if you specify it along with the install/update command, then it overwrites files already existing on the system.

There are situations when it is really necessary. But the maintainers of the distribution considered that the –force option only harm. And they removed it. It was replaced by the –overwrite <PATH> option. It overwrites conflicting files (can be used multiple times).

That is, according to the authors' idea, it should be used with each file separately, so that we have a clear idea of what exactly we are rewriting.

I ran into a situation where my OS stopped booting. I tried to uninstall GNOME Display Manager and found out that this package is considered to be NOT INSTALLED. Consequently, it could not be updated, and also some of its dependencies were removed as orphaned. That is, the system does not boot explicitly due to GDM, the easiest way to fix is to completely uninstall and do a clean install. But pacman doesn't uninstall GDM because it doesn't think it is installed. But on the other hand, when you try to install the gdm package, pacman does not allow you to install it, since the files of this package are present on the system.

Now it's time to use the –overwrite option, but there are a lot of GDM files and it is impossible to list them manually. In general, by experience, I found out that you can specify folders, for example:

sudo pacman -S --overwrite /usr/share/locale/* gdm

And to get a complete analog of –force, you need to specify it as “–overwrite '/*'”.

I ran the following commands to push install, complete uninstall and clean install of GNOME Display Manager:

sudo pacman -S --overwrite '/*' gdm
sudo pacman -Rn gdm
sudo pacman -S gdm

As a result, my problem was resolved. Do not overuse “–overwrite '/*'”, use this syntax only when you really understand what you are doing and when you are sure that there is no other way to remove interfering files – usually this can be done by third-party Python, PERL and others package managers – those the ones that installed these packages.


Leave Your Observation

Your email address will not be published. Required fields are marked *

Scroll Up