[PUP-9824] Expand the apt provider to support virtual packages Created: 2019/04/17  Updated: 2019/10/30  Resolved: 2019/09/17

Status: Resolved
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: PUP 6.8.0

Type: Improvement Priority: Normal
Reporter: Erik Hansen Assignee: Alexandru Popa
Resolution: Fixed Votes: 0
Labels: resolved-issue-added, triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causes PUP-9975 Regression: Unable to install g++ pac... Resolved
relates to MODULES-2047 Rubygems is a virtual package on Ubun... Open
relates to MODULES-3064 Package['rubygems'] is installed ever... Open
relates to PUP-9974 Regression: allow_virtual => true mat... Resolved
relates to PUP-10023 Expand the apt provider to support vi... Resolved
Team: Night's Watch
Story Points: 3
Sprint: PR - 2019-06-12, PR - 2019-06-25, PR - 2019-07-10, PR - 2019-07-23, NW - 2019-09-18
Release Notes: New Feature
Release Notes Summary: This enables apt and dpkg providers to install virtual packages.
There is an attribute named allow_virtual which by default is set to true which enables the functionality to install virtual packages, the same behaviour can be found for rpm provider.

If a package that is defined as virtual by default it will search a real package on that system.
Example for virtual package named rubygems:

package { 'rubygems':
    ensure => 'latest'

It will find ruby as the real package and it will be installed instead of rubygems.
Note: this also can do unwanted behaviour if someone wants to uninstall a virtual package

package {'rubygems':
ensure => 'absent'

This by default will remove ruby package.

If the user don't want this functionality it can be done by setting the attribute allow_virtual to false.

package {'rubygems':
ensure => 'absent'
allow_virtual => false
QA Risk Assessment: Needs Assessment


This seems to be a problem for the rubygems package, particularly in Debian / Ubuntu.  I linked to a couple older tickets where this is reported as a minor issue with no workaround.


This ticket added virtual package support for apt & dpkg in 6.8.0, but it unintentionally caused the default value of the virtual parameter to change from false to true. It also caused a regression when packages have special characters in the name (PUP-9975), and the regex was overly greedy (PUP-9974). The code was reverted in 6.8.1, so puppet does not currently support virtual packages for apt & dpkg. A new ticket PUP-10023 has been filed to add virtual package support.

Comment by Jean Bond [ 2019/08/19 ]

Alexandru Popa you mentioned that "the same behaviour can be found for rpm provider." Just to clarify, you mean that this setting already existed for the rpm provider?

Comment by Alexandru Popa [ 2019/08/19 ]

Jean Bond yes that's right, for rpm packages this feature is available for some time.


Comment by Josh Cooper [ 2019/09/16 ]

Mihai Buzgau Alexandru Popa since this issue was released in 6.8.0, please leave this resolved and open a new ticket to add the virtual package support.

Comment by Josh Cooper [ 2019/10/03 ]

George Mrejea This is another case where commits for this ticket landed in 5.5.x and 6.4.x, but the original regression and the fix were resolved before 5.5.17 and 6.4.4 releases. So from the user's perspective, the bug never affected the 5.5.x and 6.4.x streams, and we don't want to tag this ticket with those fix versions.

Generated at Sat Aug 08 09:02:47 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.