Improve package management error reporting to suggest avoiding virtual packages
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
Updated by François ARMAND 5 months ago
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.
Updated by François ARMAND 4 months ago
- 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.
Updated by Félix DALLIDET 2 months ago
- 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.
Updated by François ARMAND about 2 months ago
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.