Jira (PUP-9564) Puppet upgrades debian packages with pending updates when setting them on hold

19 views
Skip to first unread message

Karsten Heymann (JIRA)

unread,
Mar 15, 2019, 8:57:03 AM3/15/19
to puppe...@googlegroups.com
Karsten Heymann created an issue
 
Puppet / Bug PUP-9564
Puppet upgrades debian packages with pending updates when setting them on hold
Issue Type: Bug Bug
Affects Versions: PUP 4.10.12
Assignee: Unassigned
Created: 2019/03/15 5:56 AM
Priority: Normal Normal
Reporter: Karsten Heymann

Puppet Version: 4.10.x, probably other too
Puppet Server Version:
OS Name/Version: Debian 8, probably other versions too

If puppet sets a package with a pending upgrade on hold (ensure=>held), the pending upgrade is installed before the package is set on hold.

Describe steps to reproduce:

1. Show available versions

# apt-cache policy openssl
openssl:
  Installed: 1.0.1t-1+deb8u11
  Candidate: 1.0.1t-1+deb8u11
  Version table:
 *** 1.0.1t-1+deb8u11 0
        500 http://mirror.ip-platform.net/debian-security/ jessie/updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1.0.1t-1+deb8u8 0
        500 http://mirror.ip-platform.net/debian/ jessie/main amd64 Packages

 

 2. Downgrade package:

 

# puppet resource package openssl ensure=1.0.1t-1+deb8u8
Notice: /Package[openssl]/ensure: ensure changed '1.0.1t-1+deb8u11' to '1.0.1t-1+deb8u8'
package { 'openssl':
 ensure => '1.0.1t-1+deb8u8',
}

3. Set package on hold:

 

# puppet resource --debug package openssl ensure=held
[...]
Debug: Prefetching apt resources for package
Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n''
Debug: Executing: '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install openssl'
Debug: Executing: 'dpkg --set-selections'
Notice: /Package[openssl]/ensure: ensure changed '1.0.1t-1+deb8u8' to 'held'
Debug: Finishing transaction 28203320
Debug: Storing state
Debug: Stored state in 0.45 seconds
Debug: Executing: '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n' openssl'
package { 'openssl':
 ensure => '1.0.1t-1+deb8u11',
}

4. Now the package has been upgraded:

# apt-cache policy openssl
openssl:
 Installed: 1.0.1t-1+deb8u11
 Candidate: 1.0.1t-1+deb8u11
 Version table:
 1.0.2l-1~bpo8+1 0
 200 http://mirror.ip-platform.net/debian/ jessie-backports/main amd64 Packages
 *** 1.0.1t-1+deb8u11 0
 500 http://mirror.ip-platform.net/debian-security/ jessie/updates/main amd64 Packages
 100 /var/lib/dpkg/status
 1.0.1t-1+deb8u8 0
 500 http://mirror.ip-platform.net/debian/ jessie/main amd64 Packages

 

 

Desired Behavior:

The package version stays unchanged and the package is marked on-hold.

Actual Behavior:

The package has been upgraded and is on hold. This is counterintuitive and also not reflected by the agent output, especially as the "on hold" setting may be performed especially to prevent the pending upgrade from being installed.

Probable cause:

The reason this happens is the apt-get install line marked bold above. If the package already is installed, it should not happen.

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Jorie Tappa (JIRA)

unread,
Mar 18, 2019, 12:44:02 PM3/18/19
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Mar 27, 2019, 1:49:02 AM3/27/19
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Mar 27, 2019, 1:49:02 AM3/27/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Apr 3, 2019, 6:20:02 AM4/3/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Apr 3, 2019, 6:20:03 AM4/3/19
to puppe...@googlegroups.com

Alexandru Popa (JIRA)

unread,
Apr 15, 2019, 8:40:02 AM4/15/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Apr 17, 2019, 5:35:10 AM4/17/19
to puppe...@googlegroups.com

Alexandru Popa (JIRA)

unread,
Apr 18, 2019, 9:51:03 AM4/18/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
May 2, 2019, 5:21:11 AM5/2/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - 2019-04-17, PR - 2019-05-02 , PR - 2019-05-15

Alexandru Popa (JIRA)

unread,
May 14, 2019, 8:24:03 AM5/14/19
to puppe...@googlegroups.com
Alexandru Popa updated an issue

For Debian os.

Issue: when defining the state of a package in a manifest with:

package {'openssl': ensure => held }

and the package is all ready installed on the system the first thing it does is to update the package to latest version instead of locking the package to a specific version.

Fix: If the package is all ready installed on the system the package remains locked to the specific version. 

If the package is not installed on the system, it installs the latest package and locks it to that version.

Change By: Alexandru Popa
Release Notes Summary: Fixed bug for Debian distribution in which the ensure => held would install latest version of the package before locking it to the specific version.

Patrick Carlisle (JIRA)

unread,
May 22, 2019, 6:53:02 PM5/22/19
to puppe...@googlegroups.com

Patrick Carlisle (JIRA)

unread,
May 22, 2019, 8:21:03 PM5/22/19
to puppe...@googlegroups.com

This may be related to a systemwide apt problem that I'm working on, should have something tomorrow so feel free to leave it for now.

Josh Cooper (JIRA)

unread,
Jun 3, 2019, 5:19:05 PM6/3/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Jun 3, 2019, 5:25:04 PM6/3/19
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-9564
 
Re: Puppet upgrades debian packages with pending updates when setting them on hold

Reopening this because CI is failing.

Last passing puppet-agent#5.5.x is 775f8210268e6b4d86c4e63819cf1ed9fd3098f7 containing puppet#5d06d0b737, which includes all of the dpkg/held work and acceptance updates. Running the test in isolation fails. I think the test only started failing recently when the new version 1.0.1t-1+deb8u8 was released upstream:

$ bundle exec rake ci:test:aio HOSTS=redhat7-64m-debian8-64a TESTS=tests/provider/package/dpkg_ensure_held_package_should_preserve_version.rb RELEASE_STREAM=puppet5 SHA=775f8210268e6b4d86c4e63819cf1ed9fd3098f7
...
Begin tests/provider/package/dpkg_ensure_held_package_should_preserve_version.rb
 
dpkg ensure held package should preserve version if package is allready installed
 
* Ensure held should lock to specific installed version
 
  snjlb1kd6994dsa.delivery.puppetlabs.net (snjlb1kd6994dsa.delivery.puppetlabs.net) 14:15:56$ dpkg -s openssl | sed -n -e 's/Version: //p'
    Warning: Skipping ip method to ssh to host as its value is not set. Refer to https://github.com/puppetlabs/beaker/tree/master/docs/how_to/ssh_connection_preference.md to remove this warning
    Attempting ssh connection to snjlb1kd6994dsa.delivery.puppetlabs.net, user: root, opts: {:config=>false, :verify_host_key=>false, :auth_methods=>["publickey"], :port=>22, :forward_agent=>true, :keys=>["id_rsa_acceptance", "~/.ssh/id_rsa-acceptance"], :user_known_hosts_file=>"/Users/josh/.ssh/known_hosts", :keepalive=>true}
verify_host_key: false is deprecated, use :never
    1.0.1t-1+deb8u8
 
  snjlb1kd6994dsa.delivery.puppetlabs.net (snjlb1kd6994dsa.delivery.puppetlabs.net) executed in 0.22 seconds
 
  snjlb1kd6994dsa.delivery.puppetlabs.net (snjlb1kd6994dsa.delivery.puppetlabs.net) 14:15:56$ mktemp -t apply_manifest.pp.XXXXXX
    /tmp/apply_manifest.pp.O192UA
 
  snjlb1kd6994dsa.delivery.puppetlabs.net (snjlb1kd6994dsa.delivery.puppetlabs.net) executed in 0.07 seconds
  localhost $ scp /var/folders/8m/d6146zxd6bv_3h8y4ykvvxh40000gn/T/beaker20190603-34756-10r3tu2 snjlb1kd6994dsa.delivery.puppetlabs.net:/tmp/apply_manifest.pp.O192UA {:ignore => }
 
  snjlb1kd6994dsa.delivery.puppetlabs.net (snjlb1kd6994dsa.delivery.puppetlabs.net) 14:15:56$ puppet apply --verbose /tmp/apply_manifest.pp.O192UA
    Notice: Compiled catalog for snjlb1kd6994dsa.delivery.puppetlabs.net in environment production in 0.37 seconds
    Info: Applying configuration version '1559596558'
    Notice: /Stage[main]/Main/Package[openssl]/ensure: ensure changed '1.0.1t-1+deb8u8' to 'held'
    Notice: Applied catalog in 2.20 seconds
 
  snjlb1kd6994dsa.delivery.puppetlabs.net (snjlb1kd6994dsa.delivery.puppetlabs.net) executed in 4.49 seconds
 
  snjlb1kd6994dsa.delivery.puppetlabs.net (snjlb1kd6994dsa.delivery.puppetlabs.net) 14:16:01$ apt-cache policy openssl | sed -n -e 's/Installed: //p'
      1.0.1t-1+deb8u11

Alexandru Popa (JIRA)

unread,
Jun 5, 2019, 8:02:03 AM6/5/19
to puppe...@googlegroups.com

Josh Cooper should I close this ticket since the PR for the fix was merged? 

Karsten Heymann (JIRA)

unread,
Jun 6, 2019, 1:25:03 AM6/6/19
to puppe...@googlegroups.com

Alexandru Popa, Josh Cooper It is a bit difficult to write a functioning test for this bug because you need to create a situation where a package is reliably available in two versions, and doing this against the official debian repos creates a moving target that depends on the current debian package situation. I can think of two ways to achieve this: Either use https://snapshot.debian.org/ and add two dated repos with known different versions of a package, or create a minimal dummy debian package in two versions and ship a tiny local repository with these two packages as a test asset. If I can be of any help with either of these ways, just give me a note.

Josh Cooper (JIRA)

unread,
Jun 6, 2019, 12:18:03 PM6/6/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Jun 6, 2019, 12:18:04 PM6/6/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 6.5.0
Fix Version/s: PUP 6.0.10

Josh Cooper (JIRA)

unread,
Jun 6, 2019, 12:20:03 PM6/6/19
to puppe...@googlegroups.com

Heston Hoffman (JIRA)

unread,
Jun 13, 2019, 4:08:03 PM6/13/19
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages