cp: cannot create regular file '/var/tmp/pamac/dbs/sync/pamac_aur.db': Permission denied

Pamac --version

Pamac 10.4.1-1 - libpamac 11.3.1-1

Variant in use

CLI

Distribution

DISTRIB_ID=ManjaroLinux DISTRIB_RELEASE=21.3.5 DISTRIB_CODENAME=Ruah

Desktop environment

KDE

What's not working

I got cp: cannot create regular file '/var/tmp/pamac/dbs/sync/pamac_aur.db': Permission denied when using pamac update. pamac_aur.db file was existing in the folder above.

I tried to fix privs: sudo chown -R $(whoami):$(whoami) /var/tmp/pamac/ and rerun pamac update. Now my pamac_aur.db got removed from the directory:

    ~  ls -al /var/tmp/pamac/dbs/sync/                                                                                                                                                                    2 ✘ 
total 73588
drwxrwxrwx 2 fafre fafre     4096  9. Aug 11:31 .
drwxrwxrwx 3 fafre fafre     4096  9. Aug 11:31 ..
-rw-r--r-- 1 fafre fafre  7418408  7. Aug 13:49 community.db
-rw-r--r-- 1 fafre fafre 33921062  7. Aug 13:49 community.files
-rw-r--r-- 1 fafre fafre 20066304 16. Jun 21:40 community.files.part
-rw-r--r-- 1 fafre fafre   169156  7. Aug 13:49 core.db
-rw-r--r-- 1 fafre fafre  1459972  7. Aug 13:49 core.files
-rw-r--r-- 1 fafre fafre  1896112  7. Aug 13:49 extra.db
-rw-r--r-- 1 fafre fafre  9918633  7. Aug 13:49 extra.files
-rw-r--r-- 1 fafre fafre    18496 17. Okt 2021  mhwd.db
-rw-r--r-- 1 fafre fafre   183111  7. Aug 13:49 multilib.db
-rw-r--r-- 1 fafre fafre   267547  7. Aug 13:49 multilib.files
-rw-rw-rw- 1 fafre fafre        0  9. Aug 11:31 refresh_timestamp

Running pamac update again will bring the same permission denied error as above. It will not create a new database.

I tried to run sudo pamac update which refreshes aur without error. However, it doesn't create a new pamac_aur.db in the sync directory. Instead I found out, another one was created in the main folder:

    ~  ls -al /var/tmp/pamac/                                                                                                                                                                     1 ✘  45s  
total 24
drwxrwxrwx  5 fafre fafre 4096  9. Aug 11:45 .
drwxrwxrwt 10 root  root  4096  4. Aug 18:39 ..
drwxr-xr-x  4 fafre fafre 4096  9. Aug 10:06 aur-fafre
drwxr-xr-x  3 fafre fafre 4096  9. Aug 11:27 aur-root
drwxrwxrwx  3 fafre fafre 4096  9. Aug 11:45 dbs
-rw-r--r--  1 fafre fafre 2560  9. Aug 11:45 pamac_aur.db

How can I fix this?

Edited by Fabian Freund