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

Hello. I have a problem:

$ LANG=en_US.UTF-8 pamac install discord
Preparing...
Синхронизация баз данных пакетов...
Обновление core.db...                                                                                                                                                                                                                                                                         
Обновление extra.db...                                                                                                                                                                                                                                                                        
Обновление community.db...                                                                                                                                                                                                                                                                    
Обновление multilib.db...                                                                                                                                                                                                                                                                     
Refreshing AUR...                                                                                                                                                                                                                                                                             
cp: cannot create regular file '/var/tmp/pamac/dbs/sync/community.db': Permission denied                                                                                                                                                                                                      
cp: cannot create regular file '/var/tmp/pamac/dbs/sync/core.db': Permission denied
cp: cannot create regular file '/var/tmp/pamac/dbs/sync/extra.db': Permission denied
cp: cannot create regular file '/var/tmp/pamac/dbs/sync/multilib.db': Permission denied
Resolving dependencies...
Checking inter-conflicts...

To install (1):
  discord  0.0.20-1    community  60,2 MB

Total download size: 60,2 MB
Total installed size: 190,3 MB

Apply transaction ? [y/N] n

I tried :

  • sudo rm -rf /var/tmp/pamac
  • sudo chmod -R 777 /var/tmp/pamac/
  • sudo chmod -R 755 /var/tmp/pamac/
  • sudo chown MY_USER: /var/tmp/pamac
  • sudo pacman-mirrors && sudo pacman -Suy
  • cache cleaning
  • reboot

literally everything I found.

What is the output of ls -a /var/lib/pacman/sync ? Does /var/tmp/pamac/dbs/sync exist, if so whats in it? Lastly what is the DBPath set to in /etc/pacman.conf

It looks like you could actually complete the install of discord.

I think I have a solution for the messages.

# Check for pending repository updates
pamac checkupdates
# or
checkupdates

If there are updates, you need to update your system before you can install discord.

I think removing just the directory /var/tmp/pamac/dbs/sync might work (see below).


Testing

I had this happen to me once, and then went on with life. But I have noticed similar Topics. Certainly that message could be improved to be more helpful. Plus, if these two directories aren’t in-sync (pamac’s and pacman’s) could that lead to other install and update problems.

I was able to recreate the problem on a VM.

I started looking at the code in the alpm_utils.vala in the libpamac project. There is copying going on between /var/tmp/pamac/dbs/sync/ and /var/lib/pacman/sync/. I was able to recreate the problem in two ways:

  1. I rsynced from another machine, /var/lib/pacman/sync/ so /var/lib/pacman/sync/ would be older than /var/tmp/pamac/dbs/sync/. I then ran your install command and got the same messages.

    • When I ran the install again, I continued to get the message.
    • I just copied /var/tmp/pamac/dbs/sync/ to /var/lib/pacman/sync/ and the messages went away.
  2. Remove /var/tmp/pamac/dbs/sync directory.

    • When I ran the install again, no messages and sync was recreated. I didn’t have to take any other actions.
    • However, ownership was root not $USER and permission on directory changed from 777 to 755, but things seemed to work and no messages.

I don’t know what the ownership of the files in /var/tmp/pamac/dbs/sync/ should be. It appears to be a mixture of root and $USER, at least initially.

I don’t see any gitlab issues under libpamac, but there is one under pamac that might be related:

> ls -a /var/lib/pacman/sync
.  ..  community.db  community.files  core.db  core.files  extra.db  extra.files  mhwd.db  multilib.db  multilib.files  pamac_aur.db  refresh_timestamp
> ls /var/tmp/pamac/dbs/sync/
community.db  community.files  core.db  core.files  extra.db  extra.files  mhwd.db  multilib.db  multilib.files  pamac_aur.db  refresh_timestamp
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir     = /
#DBPath      = /var/lib/pacman/
> sudo rm -rf /var/tmp/pamac/dbs/sync/ && LANG=en_US.UTF-8 pamac checkupdates
cp: target '/var/tmp/pamac/dbs/sync': No such file or directory
ln: failed to create symbolic link '/var/tmp/pamac/dbs/local': Permission denied
touch: cannot touch '/var/tmp/pamac/dbs/sync/refresh_timestamp': No such file or directory
4 available updates:
ckbcomp                 1.208-1    -> 1.210-1     AUR
inxi                    3.3.21.1-1 -> 3.3.22.1-1  AUR
pamac-tray-icon-plasma  0.1.2-4    -> 0.1.3-1     AUR
v86d                    0.1.10-6   -> 0.1.10-12   AUR

Out of Date:
pamac-cli               10.1.2-1    AUR

Thats… strange

Until there is a better solution…

When I deleted the /var/tmp/pamac, pamac recreated the directory, as:

pamac                             drwxrwxrwx  root     root   
pamac/dbs                         drwxrwxrwx  root     root
pamac/dbs/local                   lrwxrwxrwx  $USER    $USER  ->  '/var/lib/pacman/local'
pamac/dbs/sync                    drwxrwxrwx  root     root 
pamac/dbs/sync/core.files         -rw-rw-rw-  root     root 
pamac/dbs/sync/mhwd.db            -rw-rw-rw-  root     root 
pamac/dbs/sync/core.db            -rw-r--r--  root     root     
pamac/dbs/sync/multilib.files     -rw-rw-rw-  root     root   
pamac/dbs/sync/community.files    -rw-rw-rw-  root     root 
pamac/dbs/sync/multilib.db        -rw-rw-rw-  root     root     
pamac/dbs/sync/community.db       -rw-r--r--  root     root   
pamac/dbs/sync/pamac_aur.db       -rw-rw-rw-  root     root 
pamac/dbs/sync/extra.db           -rw-r--r--  root     root     
pamac/dbs/sync/refresh_timestamp  -rw-rw-rw-  root     root 
pamac/dbs/sync/extra.files        -rw-rw-rw-  root     root    

There is a caveat though. pamac gave me the error below, but still copied community.db, core.db, extra.db, multilib.db and created refresh_timestamp. I responded “N” to install and ran the command again. This time no error and these files were created: community.files, core.files, extra.files, mhwd.db, multilib.files, and pamac_aur.db.

Note: Prior to the removal, everything was owed by $USER.

cp: cannot create regular file '/var/tmp/pamac/dbs/sync/community.files': Permission denied                                         
cp: cannot create regular file '/var/tmp/pamac/dbs/sync/core.files': Permission denied
cp: cannot create regular file '/var/tmp/pamac/dbs/sync/extra.files': Permission denied
cp: cannot create regular file '/var/tmp/pamac/dbs/sync/mhwd.db': Permission denied
cp: cannot create regular file '/var/tmp/pamac/dbs/sync/multilib.files': Permission denied
cp: cannot create regular file '/var/tmp/pamac/dbs/sync/pamac_aur.db': Permission denie

I normally use pacman and pamac for AUR.

This probably should be reported as a bug ? :slight_smile:

Same issue:

2 Likes

This doesn’t work. After delete pamac still tries to copy files every time

> sudo rm -r /var/tmp/pamac
[sudo] пароль для baroness: 

> pamac install discord
Подготовка...
Синхронизация баз данных пакетов...
Обновление core.db...                                                                                                                                                                                                                                                                         
Обновление community.db...                                                                                                                                                                                                                                                                    
Обновление multilib.db...                                                                                                                                                                                                                                                                     
Обновление AUR...                                                                                                                                                                                                                                                                             
cp: невозможно создать обычный файл '/var/tmp/pamac/dbs/sync/community.db': Отказано в доступе                                                                                                                                                                                                
cp: невозможно создать обычный файл '/var/tmp/pamac/dbs/sync/core.db': Отказано в доступе
cp: невозможно создать обычный файл '/var/tmp/pamac/dbs/sync/multilib.db': Отказано в доступе
Разрешение зависимостей...
Проверка на взаимные конфликты...

К установке (1):
  discord  0.0.20-1    community  60,2 МБ

Общий размер загрузки: 60,2 МБ
Общий размер установленного: 190,3 МБ

Применить транзакцию ? [д/Н] n

Транзакция отменена.

> pamac install discord
Подготовка...
Синхронизация баз данных пакетов...
Обновление core.db...                                                                                                                                                                                                                                                                         
Обновление community.db...                                                                                                                                                                                                                                                                    
Обновление multilib.db...                                                                                                                                                                                                                                                                     
cp: невозможно создать обычный файл '/var/tmp/pamac/dbs/sync/community.db': Отказано в доступе                                                                                                                                                                                                
cp: невозможно создать обычный файл '/var/tmp/pamac/dbs/sync/core.db': Отказано в доступе
cp: невозможно создать обычный файл '/var/tmp/pamac/dbs/sync/multilib.db': Отказано в доступе
Разрешение зависимостей...
Проверка на взаимные конфликты...

К установке (1):
  discord  0.0.20-1    community  60,2 МБ

Общий размер загрузки: 60,2 МБ
Общий размер установленного: 190,3 МБ

Применить транзакцию ? [д/Н]

I usually use pamac-cli to both normal and aur packages as it’s simple and useful.
These messages don’t stop packages from being installed, but they do force pamac to update its databases every time.