Project

General

Profile

Bug #14582

Improve package management error reporting to suggest avoiding virtual packages

Added by François ARMAND 8 months ago. Updated 3 months ago.

Status:
Released
Priority:
N/A
Category:
Generic methods - Package Management
Target version:
Severity:
Minor - inconvenience | misleading | easy workaround
User visibility:
Getting started - demo | first install | Technique editor and level 1 Techniques
Effort required:
Small
Priority:
61

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

Related issues

Related to ncf - Bug #15149: package management reporting broken when trying to use latest version and absent state ReleasedActions

Associated revisions

Revision 99cc8b47 (diff)
Added by Félix DALLIDET 6 months ago

Fixes #14582: For virtual package, package present generic method reports error but package is installed

History

#1

Updated by François ARMAND 8 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.

#2

Updated by Vincent MEMBRÉ 8 months ago

  • Target version changed from 5.0.9 to 5.0.10
#3

Updated by François ARMAND 8 months ago

  • 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
#4

Updated by François ARMAND 8 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. 
#5

Updated by François ARMAND 8 months ago

  • 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 :/

#6

Updated by Vincent MEMBRÉ 7 months ago

  • Target version changed from 5.0.10 to 5.0.11
#7

Updated by Vincent MEMBRÉ 7 months ago

  • Target version changed from 5.0.11 to 5.0.12
  • Priority changed from 66 to 65
#8

Updated by Félix DALLIDET 6 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.

#9

Updated by Félix DALLIDET 6 months ago

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.

#10

Updated by Félix DALLIDET 6 months ago

  • Status changed from New to In progress
  • Assignee changed from Alexis MOUSSET to Félix DALLIDET
#11

Updated by Félix DALLIDET 6 months ago

  • 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
#12

Updated by Félix DALLIDET 6 months ago

  • Status changed from Pending technical review to Pending release
#16

Updated by Alexis MOUSSET 5 months ago

  • 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
#18

Updated by François ARMAND 5 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.

#19

Updated by Vincent MEMBRÉ 5 months ago

This bug has been fixed in Rudder 5.0.12 which was released today.

#20

Updated by Vincent MEMBRÉ 3 months ago

  • Related to Bug #15149: package management reporting broken when trying to use latest version and absent state added
#21

Updated by Vincent MEMBRÉ 3 months ago

  • Status changed from Pending release to Released
  • Priority changed from 64 to 61

Also available in: Atom PDF