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')
@disaster123 i'm guessing the reason its not downgrading is because of here
I cannot replicate your behavior but thats because my version numbers are completely different (example 2016.3.4 vs 2016.11.1). In the code it looks like it does a comparison check of the versions to see if its greater then the other. In your versions as follows:
2.02~beta2-22+deb8u1 vs 2.02-pve4 i'm guessing the comparison sees these is probably equal since the version numbers include beta and pve. I bet you are not getting to this part in the code due to what i explained above.
I'm not sure what approach we will take to handle scenarios like this, but looks like we wil lneed to add some logic to catch scenarios like this. If you could verify this theory by adding log.debug() messages in those if statements to see if my theory is accurate that would be very appreciated.
Sure this seems reasonable. I think one main problem is that salt uses it's own code to compare versions and debian uses another one. And the options with epoch, sub sub version ... are complex.
Shouldn't saltstack uses the apt version compare?
Example:
import apt_pkg
apt_pkg.init_system()
a = '1:1.3.10-0.3'
b = '1.3.4-1'
vc = apt_pkg.version_compare(a,b)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
This one is still valid.
Thank you for updating this issue. It is no longer marked as stale.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Still valid
Thank you for updating this issue. It is no longer marked as stale.