saltstack / saltstack/salt

2016.11: downgrade of grub does not work (--force-yes missing)

Open
#38,460 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Execution-Module Platform severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

SLS File:

install grub2:
    pkg.installed:
          - pkgs:
            - grub-pc: 2.02~beta2-22+deb8u1
            - grub2: 2.02~beta2-22+deb8u1
            - grub2-common: 2.02~beta2-22+deb8u1
            - grub-pc-bin: 2.02~beta2-22+deb8u1
            - grub-common: 2.02~beta2-22+deb8u1
          - install_recommends: False
          - skip_suggestions: True
          - refresh: True
          - cache_valid_time: 300

current state:

dpkg -l | grep -i grub         
ii  grub-common                          2.02-pve4                   amd64        GRand Unified Bootloader (common files)
ii  grub-pc                              2.02-pve4                   amd64        GRand Unified Bootloader, version 2 (PC/BIOS version)
ii  grub-pc-bin                          2.02-pve4                   amd64        GRand Unified Bootloader, version 2 (PC/BIOS binaries)
ii  grub2-common                         2.02-pve4                   amd64        GRand Unified Bootloader (common files for version 2)

debug output of salt-call:


[INFO    ] Running state [install grub2] at time 13:38:24.188313
[INFO    ] Executing state pkg.installed for install grub2
[DEBUG   ] Could not LazyLoad pkg.normalize_name: 'pkg.normalize_name' is not available.
[DEBUG   ] Could not LazyLoad pkg.check_extra_requirements: 'pkg.check_extra_requirements' is not available.
[DEBUG   ] Could not LazyLoad pkg.version_clean: 'pkg.version_clean' is not available.
[DEBUG   ] Current version (['2.02-pve4']) did not match desired version specification (2.02~beta2-22+deb8u1), adding to installation targets
[DEBUG   ] Could not LazyLoad pkg.check_extra_requirements: 'pkg.check_extra_requirements' is not available.
[DEBUG   ] Could not LazyLoad pkg.version_clean: 'pkg.version_clean' is not available.
[DEBUG   ] Current version (['2.02-pve4']) did not match desired version specification (2.02~beta2-22+deb8u1), adding to installation targets
[DEBUG   ] Could not LazyLoad pkg.check_extra_requirements: 'pkg.check_extra_requirements' is not available.
[DEBUG   ] Could not LazyLoad pkg.version_clean: 'pkg.version_clean' is not available.
[DEBUG   ] Current version (['2.02-pve4']) did not match desired version specification (2.02~beta2-22+deb8u1), adding to installation targets
[DEBUG   ] Could not LazyLoad pkg.check_extra_requirements: 'pkg.check_extra_requirements' is not available.
[DEBUG   ] Could not LazyLoad pkg.version_clean: 'pkg.version_clean' is not available.
[DEBUG   ] Current version (['2.02-pve4']) did not match desired version specification (2.02~beta2-22+deb8u1), adding to installation targets
[INFO    ] Executing command ['apt-cache', '-q', 'policy', 'grub2'] in directory '/root'
[INFO    ] Executing command ['apt-cache', '-q', 'policy', 'grub2-common'] in directory '/root'
[INFO    ] Executing command ['apt-cache', '-q', 'policy', 'grub-common'] in directory '/root'
[INFO    ] Executing command ['apt-cache', '-q', 'policy', 'grub-pc-bin'] in directory '/root'
[INFO    ] Executing command ['apt-cache', '-q', 'policy', 'grub-pc'] in directory '/root'
[DEBUG   ] Could not LazyLoad pkg.normalize_name: 'pkg.normalize_name' is not available.
[DEBUG   ] now: 1482928704.62, last update time: 1482928447.77, expire after: 300 seconds
[INFO    ] Executing command ['dpkg', '--get-selections', '*'] in directory '/root'
[INFO    ] Executing command ['systemd-run', '--scope', 'apt-get', '-q', '-y', '-o', 'DPkg::Options::=--force-confold', '-o', 'DPkg::Options::=--force-confdef', '--no-install-recommends', 'install', 'grub2=2.02~beta2-22+deb8u1', 'grub2-common=2.02~beta2-22+deb8u1', 'grub-common=2.02~beta2-22+deb8u1', 'grub-pc-bin=2.02~beta2-22+deb8u1', 'grub-pc=2.02~beta2-22+deb8u1'] in directory '/root'
[ERROR   ] Command '['systemd-run', '--scope', 'apt-get', '-q', '-y', '-o', 'DPkg::Options::=--force-confold', '-o', 'DPkg::Options::=--force-confdef', '--no-install-recommends', 'install', 'grub2=2.02~beta2-22+deb8u1', 'grub2-common=2.02~beta2-22+deb8u1', 'grub-common=2.02~beta2-22+deb8u1', 'grub-pc-bin=2.02~beta2-22+deb8u1', 'grub-pc=2.02~beta2-22+deb8u1']' failed with return code: 100
[ERROR   ] stdout: Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  libnvpair1 libzfs2
Use 'apt-get autoremove' to remove them.
Suggested packages:
  multiboot-doc grub-emu xorriso desktop-base console-setup
Recommended packages:
  os-prober
The following NEW packages will be installed:
  grub2
The following packages will be DOWNGRADED:
  grub-common grub-pc grub-pc-bin grub2-common
0 upgraded, 1 newly installed, 4 downgraded, 0 to remove and 33 not upgraded.
Need to get 4323 kB of archives.
After this operation, 3287 kB of additional disk space will be used.
[ERROR   ] stderr: Running as unit run-9496.scope.
E: There are problems and -y was used without --force-yes

So it seems the downgrade is not detected.

Bu aptpkg.py alrady contains the relevant part:

    if downgrade:
...
            # Downgrading requires --force-yes. Insert this before 'install'
            cmd.insert(-1, '--force-yes')

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in aptpkg.py at the existing downgrade handling and trace how the package command is assembled for the shown SLS state. Reproduce the Debian package downgrade scenario and inspect the relevant package-state tests, if present. Done means the downgrade request no longer fails because the generated apt-get invocation lacks the required option.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.