CacheDir on an NFS share no longer works since Pacman 7
Related BBS thread: https://bbs.archlinux.org/viewtopic.php?id=299473
Since Pacman 7, configuring CacheDir
to a directory on an NFS share will result in no ability to download packages:
:: Proceed with download? [Y/n]
debug: using cachedir: /n/pacman/cache/
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
Unsetting the DownloadUser
option allows the package to be downloaded, but the transaction still fails:
:: Retrieving packages...
ddcutil-2.1.4-2-x86_64 downloading...
...
debug: curl_download_internal return code is 0
warning: failed to retrieve some files
error: failed to commit transaction (unexpected error)
This happens because of two new chown
calls performed as root, which don't play nicely with NFS' root_squash
/all_squash
options (where root_squash
is the NFS default):
-
libalpm/util.c
–_alpm_temporary_download_dir_setup()
– changes the ownership of temporary download directory to the user set inDownloadUser
; -
libalpm/dload.c
–finalize_download_file()
– changes the ownership of downloaded files to root.
NFS squashing makes changing ownership an invalid operation, even though target user can still have read/write permissions to a file/directory in question.
Modifying the code so that the return values of these chown
calls are ignored makes Pacman successfully download packages.
There doesn't seem to be a way to fix this on NFS share's side other than by setting no_root_squash
, which might not be desirable.