Назад | Перейти на главную страницу

Могу ли я выполнять запросы yum как непривилегированный пользователь?

Я бы предположил, что как непривилегированный пользователь я не могу yum install или yum update, и это понятно. Но я бы подумал, что могу yum search или yum whatprovides. Эти команды не должны вносить никаких изменений в мою локальную систему, а просто запрашивать то, что находится в репозиториях.

При попытке бежать yum search или yum whatprovides Однако как непривилегированный пользователь я получаю сообщение об ошибке, например:

bash-4.2$ yum search openssh-server
ovl: Error while doing RPMdb copy-up:                                           
[Errno 13] Permission denied: '/var/lib/rpm/.dbenv.lock'                        


 One of the configured repositories failed (Unknown),                           
 and yum doesn't have enough cached data to continue. At this point the only    
 safe thing yum can do is fail. There are a few ways to work "fix" this:        

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working  
        upstream. This is most often useful if you are using a newer            
        distribution release than is supported by the repository (and the       
        packages for the previous distribution release still work).             

     3. Run the command with the repository temporarily disabled                
            yum --disablerepo=<repoid> ...                                      

     4. Disable the repository permanently, so yum won't use it by default. Yum 
        will then just ignore the repository until you permanently enable it    
        again or use --enablerepo for temporary usage:                          

            yum-config-manager --disable <repoid>                               
        or                                                                      
            subscription-manager repos --disable=<repoid>                       

     5. Configure the failing repository to be skipped, if it is unavailable.   
        Note that yum will try to contact the repo. when it runs most commands, 
        so will have to try and fail each time (and thus. yum will be be much   
        slower). If it is a very temporary problem though, this is often a nice 
        compromise:                                                             

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find repomd.xml file for rhel7-x86_64-730                                
bash-4.2$

После входа в систему как root и chmoding это .dbenv.lock на 666, теперь мой непривилегированный пользователь может yum search но нет yum whatprovides.

bash-4.2$ yum search openssh-server
Loaded plugins: ovl, product-id, search-disabled-repos
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/__db.002'
========================= N/S matched: openssh-server ==========================
gsi-openssh-server.x86_64 : SSH server daemon with GSI authentication
openssh-server.x86_64 : An open source SSH server daemon
openssh-server-sysvinit.x86_64 : The SysV initscript to manage the OpenSSH
                               : server.

  Name and summary matches only, use "search all" for everything.
bash-4.2$  

bash-4.2$ yum whatprovides sshd                                                 
Loaded plugins: ovl, product-id, search-disabled-repos                          
ovl: Error while doing RPMdb copy-up:                                           
[Errno 13] Permission denied: '/var/lib/rpm/__db.002'                           


 One of the configured repositories failed (Unknown),                           
 and yum doesn't have enough cached data to continue. At this point the only    
 safe thing yum can do is fail. There are a few ways to work "fix" this:        

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working  
        upstream. This is most often useful if you are using a newer            
        distribution release than is supported by the repository (and the       
        packages for the previous distribution release still work).             

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Caching enabled but no local cache of /var/cache/yum/x86_64/7Server/rhel7-x86_64
-730/856d5d541d62809b07538e7b8b666e115e9871a9-filelists.sqlite.bz2 from rhel7-x8
6_64-730
bash-4.2$  

Это потому, что yum будет автоматически загружать данные в кеш во время такой операции запроса и терпит неудачу, если кеш недоступен для записи? Какие права доступа к файлам я (как root) должен предоставить непривилегированным пользователям, чтобы они могли запускать эти yum-запросы (например, доступ для записи в некоторые папки кеша)?

PS: root может yum install все в порядке, так что это не проблема с подключением к серверу репозитория yum как таковому.

РЕДАКТИРОВАТЬ: после изменения всех файлов в /var/lib/rpm каталог на 666, а также отключение ovl плагин, я не получаю начальных ошибок при запуске yum, но все равно не могу бежать yum whatprovides:

bash-4.2$ yum --disableplugin=ovl whatprovides apropos                          
Loaded plugins: product-id, search-disabled-repos                               


 One of the configured repositories failed (Unknown),                           
 and yum doesn't have enough cached data to continue. At this point the only    
 safe thing yum can do is fail. There are a few ways to work "fix" this:        

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working  
        upstream. This is most often useful if you are using a newer            
        distribution release than is supported by the repository (and the       
        packages for the previous distribution release still work).             

     3. Run the command with the repository temporarily disabled                
            yum --disablerepo=<repoid> ...                                      

     4. Disable the repository permanently, so yum won't use it by default. Yum 
        will then just ignore the repository until you permanently enable it    
        again or use --enablerepo for temporary usage:                          

            yum-config-manager --disable <repoid>                               
        or                                                                      
            subscription-manager repos --disable=<repoid>                       

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Caching enabled but no local cache of /var/cache/yum/x86_64/7Server/rhel7-x86_64
-730/856d5d541d62809b07538e7b8b666e115e9871a9-filelists.sqlite.bz2 from rhel7-x8
6_64-730

Новые версии yum позволяют выполнять ненавязчивые операции от имени обычного пользователя. В более старых версиях вам нужно будет использовать repoquery вместо этого в yum-utils пакет.

Кроме того, похоже, что проблему вызывает плагин ovl, а не yum как таковой. Вы можете пройти --disableplugin=ovl чтобы временно отключить его.