Bug #14582
closed
Improve package management error reporting to suggest avoiding virtual packages
Added by François ARMAND over 5 years ago.
Updated over 2 years ago.
Severity:
Minor - inconvenience | misleading | easy workaround
User visibility:
Getting started - demo | first install | Technique editor and level 1 Techniques
Description
I did the technique in screenshot (only one generic method "package present", with only "vim" in "name" field).
Rudder reports error, with "rudder agent run -i":
error: Error installing package 'vim'
error: Method 'ncf_package' failed in some repairs
E| error A_new_technique install vim vim Presence of package vim in any version could not be repaired
error: Method 'package_present' failed in some repairs
error: Method 'A_new_technique' failed in some repairs
But the package was installed:
[root@agent1 vagrant]# yum install vim
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.pasteur.fr
* extras: fr2.rpmfind.net
* updates: centos.crazyfrogs.org
Package 2:vim-enhanced-7.4.160-5.el7.x86_64 already installed and latest version
Nothing to do
So it seems to be because "vim" is not a package per se, it's a virtual package. So rudder agent try to find it, doesn't not find it, try to install it, succeed (well, it's already there), and try again to find it, and still doesn't find it.
There is no good solution to make that better, because yum is not able to answer "is vim installed?" properly.
- Target version changed from 5.0.9 to 5.0.10
- Subject changed from Package present generic method reports error but package is installed to For virtual package, package present generic method reports error but package is installed
- Severity changed from Major - prevents use of part of Rudder | no simple workaround to Minor - inconvenience | misleading | easy workaround
- Effort required set to Very Small
- Priority changed from 70 to 79
So the problem is actually hard and goes like that:
- I asked for `vim
- `vim` is a virtual package
- cfengine code looks in "rpm qa" list and doesn't find it. It ask distrib package manager to correct that.
package manager tries to install it: it automatically chooses default virtual package for vim, say `vim-minimal`
- installation success!
- cfengine code looks again in "rpm -qa" but still doesn't find it: oh noes! Unknow error!
We don't have any simple mean to know what the package manager chose to install.
So the correct solution is to change report so that the user has a least a way to know where to look. Perhaps adding something like:
If you tried to install a virtual package, please use in place the concrete package you want to isntall.
- Assignee set to Alexis Mousset
- Effort required changed from Very Small to Small
- Priority changed from 79 to 66
It's still a C patch in cfengine :/
- Target version changed from 5.0.10 to 5.0.11
- Target version changed from 5.0.11 to 5.0.12
- Priority changed from 66 to 65
- Priority changed from 65 to 64
It is possible to make yum take virtual package into account without touching any cfengine C source code.
We are now only using the cfengine packages modules, and the yum one is in python.
We could make the module check in rpm -q (which is currently the case) but also check in the rpm local database via:
[root@server packages]# rpm -q --whatprovides vim
vim-enhanced-7.4.160-5.el7.x86_64
This should work and should not be too much work.
Still, this would also state that doing a "package absent" on a virtual package will remove all packages providing it, which may not be what we want.
Edit: Since cfengine does not let us pass args when listing installed packages, listing all virtual packages and their versions + arch (which is retrieved from their providers) will be too slow
to be usable.
Going back to the warning message.
- Status changed from New to In progress
- Assignee changed from Alexis Mousset to Félix DALLIDET
- Status changed from In progress to Pending technical review
- Assignee changed from Félix DALLIDET to Nicolas CHARLES
- Pull Request set to https://github.com/Normation/ncf/pull/990
- Status changed from Pending technical review to Pending release
Applied in changeset commit:99cc8b47575a2f382ae6a367e8e41c1318d6e879.
- Name check changed from To do to Needs change
- Subject changed from For virtual package, package present generic method reports error but package is installed to Improve package management error reporting to suggest avoiding virtual packages
- Name check changed from Needs change to Reviewed
- Fix check changed from To do to Error - Blocking
- Fix check changed from Error - Blocking to Checked
The warning correctly appear on an interactive run. Given that the use case is not that common, and that an interactive run display what is expected, I thing the correction is ok.
error: Error installing package 'vim'
error: Method 'ncf_package' failed in some repairs
warning packageManagement None vim If you tried to install a virtual package, please use in place the concrete package you want to install.
error: Method 'package_state_options' failed in some repairs
E| error packageManagement Package vim Presence of package vim in any version could not be repaired
I'm switching to "ok" for the fix.
This bug has been fixed in Rudder 5.0.12 which was released today.
- Related to Bug #15149: package management reporting broken when trying to use latest version and absent state added
- Status changed from Pending release to Released
- Priority changed from 64 to 61
- Project changed from 41 to Rudder
- Category changed from Generic methods - Package Management to Generic methods
- Priority changed from 61 to 56
Also available in: Atom
PDF