Error: failed to commit transaction (conflicting files) for `R`

I am update my system today and get this

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 linux-headers-6.7.6.arch1-2-x86_64               25.3 MiB  19.9 MiB/s 00:01 [-------------------------------------------] 100%
 github-cli-2.44.1-1-x86_64                        8.7 MiB  1117 KiB/s 00:08 [-------------------------------------------] 100%
 nvidia-utils-550.54.14-2-x86_64                 221.1 MiB  23.0 MiB/s 00:10 [-------------------------------------------] 100%
 imath-3.1.11-1-x86_64                             3.9 MiB  15.3 MiB/s 00:00 [-------------------------------------------] 100%
 dvisvgm-3.2.1-1-x86_64                         1028.4 KiB   973 KiB/s 00:01 [-------------------------------------------] 100%
 eza-0.18.5-1-x86_64                             455.0 KiB  1176 KiB/s 00:00 [-------------------------------------------] 100%
 pixman-0.43.4-1-x86_64                          277.5 KiB   925 KiB/s 00:00 [-------------------------------------------] 100%
 opencl-nvidia-550.54.14-2-x86_64                  2.7 MiB  1252 KiB/s 00:02 [-------------------------------------------] 100%
 orc-0.4.38-1-x86_64                             274.7 KiB   938 KiB/s 00:00 [-------------------------------------------] 100%
 lib32-orc-0.4.38-1-x86_64                       216.3 KiB   983 KiB/s 00:00 [-------------------------------------------] 100%
 zziplib-0.13.73-1-x86_64                         64.7 KiB   526 KiB/s 00:00 [-------------------------------------------] 100%
 eos-bash-shared-24.10-1-any                      55.0 KiB   393 KiB/s 00:00 [-------------------------------------------] 100%
 libsrtp-1:2.6.0-1-x86_64                         48.4 KiB   505 KiB/s 00:00 [-------------------------------------------] 100%
 linux-6.7.6.arch1-2-x86_64                      130.9 MiB  9.47 MiB/s 00:14 [-------------------------------------------] 100%
 r-4.3.3-1-x86_64                                 44.3 MiB  3.02 MiB/s 00:15 [-------------------------------------------] 100%
 nvidia-dkms-550.54.14-2-x86_64                   39.8 MiB  2.59 MiB/s 00:15 [-------------------------------------------] 100%
 Total (16/16)                                   479.0 MiB  31.1 MiB/s 00:15 [-------------------------------------------] 100%
(16/16) checking keys in keyring                                             [-------------------------------------------] 100%
(16/16) checking package integrity                                           [-------------------------------------------] 100%
(16/16) loading package files                                                [-------------------------------------------] 100%
(16/16) checking for file conflicts                                          [-------------------------------------------] 100%
error: failed to commit transaction (conflicting files)
r: /usr/lib/R/library/Matrix/help/macros/local.Rd exists in filesystem
r: /usr/lib/R/library/Matrix/include/Matrix/Matrix.h exists in filesystem
r: /usr/lib/R/library/Matrix/include/Matrix/alloca.h exists in filesystem
r: /usr/lib/R/library/Matrix/include/Matrix/cholmod-utils.h exists in filesystem
r: /usr/lib/R/library/Matrix/include/Matrix/cholmod.h exists in filesystem
r: /usr/lib/R/library/Matrix/include/Matrix/remap.h exists in filesystem
r: /usr/lib/R/library/Matrix/include/Matrix/stubs.c exists in filesystem
r: /usr/lib/R/library/Matrix/include/Matrix/version.h exists in filesystem
Errors occurred, no packages were upgraded.
 -> error installing repo packages

As far as I know, this is probably due to that I have installed matrix package for R using R instead of pacman? So I went to sudo R and then remove the package by

> remove.packages("Matrix")
Removing package from ‘/usr/lib/R/library’
(as ‘lib’ is unspecified)

and then I update system again. It works fine but I got some warnings

:: Proceed with installation? [Y/n] 
(16/16) checking keys in keyring                                             [-------------------------------------------] 100%
(16/16) checking package integrity                                           [-------------------------------------------] 100%
(16/16) loading package files                                                [-------------------------------------------] 100%
(16/16) checking for file conflicts                                          [-------------------------------------------] 100%
(16/16) checking available disk space                                        [-------------------------------------------] 100%
warning: could not get file information for usr/lib/R/library/Matrix/
warning: could not get file information for usr/lib/R/library/Matrix/DESCRIPTION
warning: could not get file information for usr/lib/R/library/Matrix/INDEX
warning: could not get file information for usr/lib/R/library/Matrix/LICENCE
warning: could not get file information for usr/lib/R/library/Matrix/Meta/
warning: could not get file information for usr/lib/R/library/Matrix/Meta/Rd.rds
warning: could not get file information for usr/lib/R/library/Matrix/Meta/data.rds
warning: could not get file information for usr/lib/R/library/Matrix/Meta/features.rds
warning: could not get file information for usr/lib/R/library/Matrix/Meta/hsearch.rds
warning: could not get file information for usr/lib/R/library/Matrix/Meta/links.rds
warning: could not get file information for usr/lib/R/library/Matrix/Meta/nsInfo.rds
warning: could not get file information for usr/lib/R/library/Matrix/Meta/package.rds
warning: could not get file information for usr/lib/R/library/Matrix/Meta/vignette.rds
warning: could not get file information for usr/lib/R/library/Matrix/NAMESPACE
warning: could not get file information for usr/lib/R/library/Matrix/NEWS.Rd
warning: could not get file information for usr/lib/R/library/Matrix/R/
warning: could not get file information for usr/lib/R/library/Matrix/R/Matrix
warning: could not get file information for usr/lib/R/library/Matrix/R/Matrix.rdb
warning: could not get file information for usr/lib/R/library/Matrix/R/Matrix.rdx
warning: could not get file information for usr/lib/R/library/Matrix/data/
warning: could not get file information for usr/lib/R/library/Matrix/data/CAex.R
warning: could not get file information for usr/lib/R/library/Matrix/data/KNex.R
warning: could not get file information for usr/lib/R/library/Matrix/data/USCounties.R
warning: could not get file information for usr/lib/R/library/Matrix/data/datalist
warning: could not get file information for usr/lib/R/library/Matrix/data/wrld_1deg.R
warning: could not get file information for usr/lib/R/library/Matrix/doc/
warning: could not get file information for usr/lib/R/library/Matrix/doc/Comparisons.R
warning: could not get file information for usr/lib/R/library/Matrix/doc/Comparisons.Rnw
warning: could not get file information for usr/lib/R/library/Matrix/doc/Comparisons.pdf
warning: could not get file information for usr/lib/R/library/Matrix/doc/Design-issues.R
warning: could not get file information for usr/lib/R/library/Matrix/doc/Design-issues.Rnw
warning: could not get file information for usr/lib/R/library/Matrix/doc/Design-issues.pdf
warning: could not get file information for usr/lib/R/library/Matrix/doc/Intro2Matrix.R
warning: could not get file information for usr/lib/R/library/Matrix/doc/Intro2Matrix.Rnw
warning: could not get file information for usr/lib/R/library/Matrix/doc/Intro2Matrix.pdf
warning: could not get file information for usr/lib/R/library/Matrix/doc/Introduction.R
warning: could not get file information for usr/lib/R/library/Matrix/doc/Introduction.Rnw
warning: could not get file information for usr/lib/R/library/Matrix/doc/Introduction.pdf
warning: could not get file information for usr/lib/R/library/Matrix/doc/SuiteSparse/
warning: could not get file information for usr/lib/R/library/Matrix/doc/SuiteSparse/AMD.txt
warning: could not get file information for usr/lib/R/library/Matrix/doc/SuiteSparse/CHOLMOD.txt
warning: could not get file information for usr/lib/R/library/Matrix/doc/SuiteSparse/COLAMD.txt
warning: could not get file information for usr/lib/R/library/Matrix/doc/SuiteSparse/SPQR.txt
warning: could not get file information for usr/lib/R/library/Matrix/doc/SuiteSparse/SuiteSparse_config.txt
warning: could not get file information for usr/lib/R/library/Matrix/doc/index.html
warning: could not get file information for usr/lib/R/library/Matrix/doc/sparseModels.R
warning: could not get file information for usr/lib/R/library/Matrix/doc/sparseModels.Rnw
warning: could not get file information for usr/lib/R/library/Matrix/doc/sparseModels.pdf
warning: could not get file information for usr/lib/R/library/Matrix/external/
warning: could not get file information for usr/lib/R/library/Matrix/external/CAex_slots.rda
warning: could not get file information for usr/lib/R/library/Matrix/external/KNex_slots.rda
warning: could not get file information for usr/lib/R/library/Matrix/external/USCounties_slots.rda
warning: could not get file information for usr/lib/R/library/Matrix/external/Z_NA_rnk.rds
warning: could not get file information for usr/lib/R/library/Matrix/external/jgl009.mtx
warning: could not get file information for usr/lib/R/library/Matrix/external/lund_a.mtx
warning: could not get file information for usr/lib/R/library/Matrix/external/lund_a.rsa
warning: could not get file information for usr/lib/R/library/Matrix/external/pores_1.mtx
warning: could not get file information for usr/lib/R/library/Matrix/external/symA.rda
warning: could not get file information for usr/lib/R/library/Matrix/external/symW.rda
warning: could not get file information for usr/lib/R/library/Matrix/external/test3comp.rda
warning: could not get file information for usr/lib/R/library/Matrix/external/utm300.rua
warning: could not get file information for usr/lib/R/library/Matrix/external/wrld_1deg_slots.rda
warning: could not get file information for usr/lib/R/library/Matrix/external/wrong.mtx
warning: could not get file information for usr/lib/R/library/Matrix/help/
warning: could not get file information for usr/lib/R/library/Matrix/help/AnIndex
warning: could not get file information for usr/lib/R/library/Matrix/help/Matrix.rdb
warning: could not get file information for usr/lib/R/library/Matrix/help/Matrix.rdx
warning: could not get file information for usr/lib/R/library/Matrix/help/aliases.rds
warning: could not get file information for usr/lib/R/library/Matrix/help/paths.rds
warning: could not get file information for usr/lib/R/library/Matrix/html/
warning: could not get file information for usr/lib/R/library/Matrix/html/00Index.html
warning: could not get file information for usr/lib/R/library/Matrix/html/R.css
warning: could not get file information for usr/lib/R/library/Matrix/include/
warning: could not get file information for usr/lib/R/library/Matrix/include/Matrix.h
warning: could not get file information for usr/lib/R/library/Matrix/include/Matrix_stubs.c
warning: could not get file information for usr/lib/R/library/Matrix/include/cholmod.h
warning: could not get file information for usr/lib/R/library/Matrix/libs/
warning: could not get file information for usr/lib/R/library/Matrix/libs/Matrix.so
warning: could not get file information for usr/lib/R/library/Matrix/po/
warning: could not get file information for usr/lib/R/library/Matrix/po/de/
warning: could not get file information for usr/lib/R/library/Matrix/po/de/LC_MESSAGES/
warning: could not get file information for usr/lib/R/library/Matrix/po/de/LC_MESSAGES/Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/de/LC_MESSAGES/R-Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/en@quot/
warning: could not get file information for usr/lib/R/library/Matrix/po/en@quot/LC_MESSAGES/
warning: could not get file information for usr/lib/R/library/Matrix/po/en@quot/LC_MESSAGES/Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/en@quot/LC_MESSAGES/R-Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/fr/
warning: could not get file information for usr/lib/R/library/Matrix/po/fr/LC_MESSAGES/
warning: could not get file information for usr/lib/R/library/Matrix/po/fr/LC_MESSAGES/Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/fr/LC_MESSAGES/R-Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/it/
warning: could not get file information for usr/lib/R/library/Matrix/po/it/LC_MESSAGES/
warning: could not get file information for usr/lib/R/library/Matrix/po/it/LC_MESSAGES/Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/it/LC_MESSAGES/R-Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/ko/
warning: could not get file information for usr/lib/R/library/Matrix/po/ko/LC_MESSAGES/
warning: could not get file information for usr/lib/R/library/Matrix/po/ko/LC_MESSAGES/Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/ko/LC_MESSAGES/R-Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/lt/
warning: could not get file information for usr/lib/R/library/Matrix/po/lt/LC_MESSAGES/
warning: could not get file information for usr/lib/R/library/Matrix/po/lt/LC_MESSAGES/Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/lt/LC_MESSAGES/R-Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/pl/
warning: could not get file information for usr/lib/R/library/Matrix/po/pl/LC_MESSAGES/
warning: could not get file information for usr/lib/R/library/Matrix/po/pl/LC_MESSAGES/Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/po/pl/LC_MESSAGES/R-Matrix.mo
warning: could not get file information for usr/lib/R/library/Matrix/test-tools-1.R
warning: could not get file information for usr/lib/R/library/Matrix/test-tools-Matrix.R
warning: could not get file information for usr/lib/R/library/Matrix/test-tools.R
warning: could not get file information for usr/lib/R/library/mgcv/po/it/
warning: could not get file information for usr/lib/R/library/mgcv/po/it/LC_MESSAGES/
warning: could not get file information for usr/lib/R/library/mgcv/po/it/LC_MESSAGES/R-mgcv.mo
warning: could not get file information for usr/lib/R/library/mgcv/po/it/LC_MESSAGES/mgcv.mo
:: Running pre-transaction hooks...


And I then install the matrix package for R in AUR: yay -Syu rmatrix, it installed ok and I can find this package in R, so the install is successful.

I am wondering where does those warnings come from and should I do something now?

EDIT: I run yay again and find this

╰─> bsh > yay
[sudo] password for yuanhao: 
:: Synchronising package databases...
 endeavouros is up to date
 core is up to date
 extra is up to date
 multilib is up to date
:: Searching AUR for updates...
:: Searching databases for updates...
 -> Flagged Out Of Date AUR Packages: forticlient-vpn  rstudio-desktop-bin
 -> rmatrix: local (4538c3e-1) is newer than AUR (a84a1a3-1)
 there is nothing to do

this confuse me again… and I install rmatrix from AUR just now, how can it be newer?

What if you removed ~/.cache/yay/rmatrix and run yay again?

It still downloads the same thing

 -> rmatrix: local (4538c3e-1) is newer than AUR (a84a1a3-1)

It seems to try to install the correct version at first, but it turns to the wrong version later during the install.

╰─> bsh > yay -S rmatrix
AUR Explicit (1): rmatrix-a84a1a3-1
:: (1/1) Downloaded PKGBUILD: rmatrix
  1 rmatrix                          (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 
  1 rmatrix                          (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 
==> Making package: rmatrix a84a1a3-1 (Fri 01 Mar 2024 08:32:17 GMT)
==> Retrieving sources...
  -> Cloning rmatrix git repo...
Cloning into bare repository '/home/yuanhao/.cache/yay/rmatrix/rmatrix'...
remote: Enumerating objects: 324, done.
remote: Counting objects: 100% (69/69), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 324 (delta 36), reused 58 (delta 28), pack-reused 255
Receiving objects: 100% (324/324), 1.39 MiB | 2.16 MiB/s, done.
Resolving deltas: 100% (159/159), done.
==> WARNING: Skipping verification of source file PGP signatures.
==> Validating source files with sha1sums...
    rmatrix ... Skipped
:: (1/1) Parsing SRCINFO: rmatrix
==> Making package: rmatrix a84a1a3-1 (Fri 01 Mar 2024 08:32:19 GMT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating rmatrix git repo...
==> Validating source files with sha1sums...
    rmatrix ... Skipped
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Creating working copy of rmatrix git repo...
Cloning into 'rmatrix'...
done.
==> Starting pkgver()...
==> Updated version: rmatrix 4538c3e-1
==> Sources are ready.
==> Making package: rmatrix 4538c3e-1 (Fri 01 Mar 2024 08:32:21 GMT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting pkgver()...
==> Starting build()...
    Updating crates.io index
   Compiling libc v0.2.153
   Compiling proc-macro2 v1.0.78
   Compiling version_check v0.9.4
   Compiling cc v1.0.88
   Compiling unicode-ident v1.0.12
   Compiling syn v1.0.109
   Compiling cfg-if v1.0.0
   Compiling pkg-config v0.3.30
   Compiling unicode-width v0.1.11
   Compiling unicode-segmentation v1.11.0
   Compiling ppv-lite86 v0.2.17
   Compiling bitflags v1.3.2
   Compiling strsim v0.8.0
   Compiling vec_map v0.8.2
   Compiling ansi_term v0.12.1
   Compiling lazy_static v1.4.0
   Compiling log v0.4.21
   Compiling textwrap v0.11.0
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling heck v0.3.3
   Compiling quote v1.0.35
   Compiling getrandom v0.2.12
   Compiling atty v0.2.14
   Compiling signal-hook-registry v1.4.1
   Compiling term_size v0.3.2
   Compiling clap v2.34.0
   Compiling rand_core v0.6.4
   Compiling ncurses v5.101.0
   Compiling signal-hook v0.3.17
   Compiling rand_chacha v0.3.1
   Compiling rand v0.8.5
   Compiling pancurses v0.17.0
   Compiling structopt-derive v0.4.18
   Compiling structopt v0.3.26
   Compiling r-matrix v0.2.3 (/home/yuanhao/.cache/yay/rmatrix/src/rmatrix)
    Finished release [optimized] target(s) in 6.80s
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "rmatrix"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Creating package "rmatrix-debug"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: rmatrix 4538c3e-1 (Fri 01 Mar 2024 08:32:32 GMT)
==> Cleaning up...
loading packages...
resolving dependencies...
looking for conflicting packages...

Package (2)    New Version  Net Change

rmatrix        4538c3e-1      0.85 MiB
rmatrix-debug  4538c3e-1     11.05 MiB

Total Installed Size:  11.90 MiB

:: Proceed with installation? [Y/n] 
(2/2) checking keys in keyring                                                                                   [--------------------------------------------------------------------] 100%
(2/2) checking package integrity                                                                                 [--------------------------------------------------------------------] 100%
(2/2) loading package files                                                                                      [--------------------------------------------------------------------] 100%
(2/2) checking for file conflicts                                                                                [--------------------------------------------------------------------] 100%
(2/2) checking available disk space                                                                              [--------------------------------------------------------------------] 100%
:: Processing package changes...
(1/2) installing rmatrix                                                                                         [--------------------------------------------------------------------] 100%
(2/2) installing rmatrix-debug                                                                                   [--------------------------------------------------------------------] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
(took 40s) 

╭───> yuanhao @ MS7D05 (172.16.3.12) @ 08:32:50 Fri 03/01/24 
│ ~ 
╰─> bsh > yay
:: Synchronising package databases...
 endeavouros is up to date
 core is up to date
 extra is up to date
 multilib is up to date
:: Searching AUR for updates...
:: Searching databases for updates...
 -> Flagged Out Of Date AUR Packages: forticlient-vpn  rstudio-desktop-bin
 -> rmatrix: local (4538c3e-1) is newer than AUR (a84a1a3-1)
 there is nothing to do

Also, if I run yay -Rns rmatrix I find that the Matrix package for R is still there and I can load it… and I can also remove that again using R, remove.packages

I checked the upstream repository for the rmatrix package. This version number is the latest version in the git repository. The non-git version in the AUR is a84a1a3-1, so something else is installing that package without pacman’s knowledge (e.g: pulling directly from rmatrix’s git repository).

I’m not familiar with R, but does R have some kind of init function that automatically runs code when you start it? E.g: when you run R, maybe some init code is installing rmatrix automatically?

Also, how on earth did a software package that isn’t installed with pacman end up inside /usr/lib? If you want to install things outside of pacman, you should not run it with sudo permissions.

You’ve done what I often do, which is to update R as root in order to update the core package set. If you run a regular system update using:

sudo pacman -Syyu r --overwrite=/usr/lib/R/library/\*

This should fix the problem.

You can then run R as root to update the core package set again.

sudo su -
R

… then…

update.packages(checkBuilt = T, ask = F)
1 Like

I see. I was wondering how those files ended up inside /usr/lib.

I use R for my day-to-day job. I need to do this about once every month or so (because I update the core package set as root). I’m not sure whether it’s bad practice or not. I’ve been pondering whether I should suggest some changes to the PKGBUILD that would wipe the affected directory prior to installing.

It is generally good practice (on Arch-based systems) to let pacman manage the stuff in /usr/lib. Everything else should be installed inside the user’s home directory.

Most programming language toolchains have an option to set a custom directory inside the user’s home directory to place software packages. For example, Go uses GOPATH; rust uses RUSTUP_HOME and CARGO_HOME, etc.

According to R’s documentation, R allows users to specify a local directory via the R_LIBS_USER environment variable.

Yup. There’s also a directory that can be specified for “site” packages, which is where sys admins should install packages for their users (such as per supercomp cluster setups), so whacking /usr/lib/R/library every update with a PKGBUILD pre-transaction hook shouldn’t really affect anything… unless that’s where AUR packages are set to be installed… in which case, there goes my idea.

Does this help?

https://wiki.archlinux.org/title/r#With_R

1 Like

Yup. So it could work if it only removed the core package subdirectories, and not the entirety of /usr/lib/R/library. That way it wouldn’t remove packages installed via pacman.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.