34

I ran sudo pacman -Syu and I got some interesting errors reading:

error: failed to commit transaction (conflicting files)

and a long list of files followed by exists in filesystem. Full output is here: http://ix.io/lLw

It appears that many of these files are not associated with a package when I checked them with pacman -Qo <path-to-file>, but I did not check them all. I had a weak connection when I ran pacman -Syu, but I get the same errors when I updated later: http://ix.io/lLx

What should I do? Should I check all files and delete ones that do not have an associated package? Should I force update (with sudo pacman -S --force <package-name>?)

Update

I tried running sudo pacman -S --force <package-name> and got this:

[my-pc]/home/average-joe$ pacman -Qo /usr/lib/python3.5/site-packages/PyYAML-3.11-py3.5.egg-info
error: No package owns /usr/lib/python3.5/site-packages/PyYAML-3.11-py3.5.egg-info

It looks like pacman -S --force <package does not overwrite directories that contain files. From the man:

Using --force will not allow overwriting a directory with a file or installing packages with conflicting files and directories.

Should I just delete the conflicting directories? (they do not have associated packages)

  • 5
    why do you have conflicting files in the first place? when using a package manager, try not to tap on its toes (e.g. by installing software in places the package manager rightfully thinks is theirs; if you must install things manually, install to /usr/local/ rather than /usr/) – umläute Nov 2 '15 at 12:37
  • 1
    @umläute I am not exactly sure where the conflicting files came from, but I suspect they are related to my installation of docker-compose which I installed using sudo pip install -U docker-compose==1.5.0rc3 on this page. Perhaps sudo pip install conflicts with pacman? – modulitos Nov 3 '15 at 7:47
  • 1
    @umläute Getting wrong -S updates (partial installs, etc) will let you that scenario. Case of me --force worked all times. – erm3nda May 23 '17 at 17:15
22

Ok, it looks like running sudo pacman -S --force <package-name> works, but it doesn't resolve conflicting directories. In such cases, running sudo rm -rf on the conflicting directories, followed by sudo pacman -S --force <package-name> works.

Now my pacman -Syu resolves well.

  • 3
    --force is deprecated; use --overwrite instead. – Ankit Balyan Jun 14 '18 at 8:37
  • 5
    --force is working for me but --overwrite is not – Infernion Jun 18 '18 at 13:19
  • 1
    sudo pacman -Syu --force worked for me, but overwrite wasn't recognized. – spydon Jul 2 '18 at 8:03
19

tl;dr: Uninstall the conflicting application before running pacman.

pacman (and other package managers) keep an index of packages and files that they manage (pacman --query --list). Some files, such as configuration, will be marked as modifiable and will not be overwritten during upgrade (except in special circumstances, where the package manager will typically move away the old file before creating the new one). Other files will be marked as unmodifiable. If another application changes those files in any way without updating the index accordingly there's no way for the package manager to know what to do with those files during an upgrade.

Many applications installed using the standard ./configure && make && sudo make install pattern can be uninstalled using sudo make uninstall. If you have installed the application in some other way you might have to something else to uninstall it. In general it can be a good idea to keep a copy of installation files somewhere (for example ~/install) to be able to reliably uninstall them in such cases. Just removing the conflicting files will probably leave other files lying around, which could conceivably cause other problems.

When installing software with other package managers there are ways to isolate those from the system files. This is an established best practice for example during software development, where you really want to keep versions consistent and avoid conflicts with other software. Examples include:

  • 2
    See my comment to @umlaute above. I think the conflict was from a sudo pip install command. Perhaps I should avoid using pip with sudo? – modulitos Nov 3 '15 at 7:48
2

I was installing packages that I usually install with pip via pacman because of this. But some packages arent found in pacman repos. I think we should avoid installing pip with sudo privilegies and istead:

pip install pillow --user

--user flag makes pip install packages in your home directory instead, which doesn't require any special privileges.https://stackoverflow.com/questions/42988977/what-is-the-purpose-pip-install-user

1

TLDR;

  1. Get a list of the offending files (copy and paste pacman's output into a file).
  2. Use awk to strip out everything but the file paths into a new list.
  3. Use while to move the offending files out of the way, based on the list.
  4. Run sudo pacman -Syu again.

    edited to add TLDR and fix typos

Although I'm pretty sure I haven't been doing anything stupid, I've had this problem maybe every other time I've tried to update since I've been using Manjaro; three or four times within two months. Point being, this fixes it.

Get a list of your files.

When the update fails in your terminal window, you get this:

error: failed to commit transaction (conflicting files)
evilfile: /usr/bin/evilfile exists in filesystem
libx000: /usr/lib/libx000.so.f.u.loser exists in filesystem
accountsservice: /usr/share/locale/ru/LC_MESSAGES/accounts-service.mo.yu.dnt.evn.spk.russian exists in filesystem

... and a lot more.

  • Copy the output from the terminal, and put it in a file. I used nano, and named mine "files," as in ~/work/files.

  • Strip extraneous info:

    cat files | awk '{print $2}' >> ~/work/files2

    This takes the second "word" from each line and prints it to files2.

Deal with the files

  • You could delete them, move them, or rename them.

  • If something breaks, it's easiest to fix if we break it by moving it instead of deleting or renaming it:
    mkdir ~/work/oldfiles while read -r file; do sudo mv -- "$file" ~/work/oldfiles/$file; done < files2

  • If you really want to delete them, which there is no reason to do (DANGER DANGER): while read -r file; do sudo rm -- "$file"; done < files2

Updating

  • To get --overwrite to work, which we need to do to get pacman to realize the package isn't broken, you need the following syntax:

    sudo pacman -S package_name --overwrite /location/of/thing

    • In my case: sudo pacman -S libidn2 --overwrite /usr/lib/libidn2.so.0
    • Following the example: sudo pacman -S libx000 --overwrite /usr/lib/libx000.so.f.u.loser
  • I had a cute problem where if I deleted the libidn2.so.0 symlink, nothing worked, and when I put it back, I got the "exists on filesystem" error. The above, with --overwrite, is all that worked for me.

  • Finally:

    sudo pacman -Syu

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.