Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win_pkg.install failing due to calls for missing missing/incorrect registry entries #53955

Closed
breshead opened this issue Jul 22, 2019 · 18 comments
Labels
info-needed waiting for more info
Milestone

Comments

@breshead
Copy link

breshead commented Jul 22, 2019

Description of Issue

calls to pkg.install fail silently or with error:

WindowsError: The system could not find the environment option that was entered.

Or in debug mode with a variant of this registry key issue

[DEBUG   ]   Cannot find key: HKU\S-1-5-18\Software\Microsoft\Installer\Products

Setup

My package sls files specify local downloads for packages but the problem appears to be the fact that none of the registry keys that it searches in are valid..

Running reg query on each of the registry entries shown in the DEBUG verified that it did not exist.

Steps to Reproduce Issue

From Master

salt HEDT8 pkg.install jsh-putty
HEDT8:
    ----------

From Minion

xxx@HEDT8 C:\salt>salt-call pkg.install jsh-putty                                                        
local:                                                                                                      
    ----------                                                                                              

From Minion with -l debug

xxx@HEDT8 C:\salt>salt-call -l debug pkg.install jsh-putty                                               
[DEBUG   ] Reading configuration from c:\salt\conf\minion                                                   
[DEBUG   ] Including configuration from 'c:\salt\conf\minion.d\_schedule.conf'                              
[DEBUG   ] Reading configuration from c:\salt\conf\minion.d\_schedule.conf                                  
[DEBUG   ] Including configuration from 'c:\salt\conf\minion.d\mine_functions.conf'                         
[DEBUG   ] Reading configuration from c:\salt\conf\minion.d\mine_functions.conf                             
[DEBUG   ] Configuration file path: c:\salt\conf\minion                                                     
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.                           
[DEBUG   ] Grains refresh requested. Refreshing grains.                                                     
[DEBUG   ] Reading configuration from c:\salt\conf\minion                                                   
[DEBUG   ] Including configuration from 'c:\salt\conf\minion.d\_schedule.conf'                              
[DEBUG   ] Reading configuration from c:\salt\conf\minion.d\_schedule.conf                                  
[DEBUG   ] Including configuration from 'c:\salt\conf\minion.d\mine_functions.conf'                         
[DEBUG   ] Reading configuration from c:\salt\conf\minion.d\mine_functions.conf                             
[DEBUG   ] Loading static grains from c:\salt\conf\grains                                                   
[DEBUG   ] Connecting to master. Attempt 1 (infinite attempts)                                              
[DEBUG   ] Master URI: tcp://192.168.8.14:4506                                                              
[DEBUG   ] Popen(['git', 'version'], cwd=C:\salt, universal_newlines=False, shell=None)                     
[DEBUG   ] Popen(['git', 'version'], cwd=C:\salt, universal_newlines=False, shell=None)                     
[DEBUG   ] Initializing new AsyncAuth for (u'c:\\salt\\conf\\pki\\minion', u'HEDT8', u'tcp://192.168.8.14:45
06')                                                                                                        
[DEBUG   ] Generated random reconnect delay between '1000ms' and '11000ms' (9959)                           
[DEBUG   ] Setting zmq_reconnect_ivl to '9959ms'                                                            
[DEBUG   ] Setting zmq_reconnect_ivl_max to '11000ms'                                                       
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for (u'c:\\salt\\conf\\pki\\minion', u'HEDT8', u'tcp://192
.168.8.14:4506', 'clear')                                                                                   
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.8.14:4506         
[DEBUG   ] Trying to connect to: tcp://192.168.8.14:4506                                                    
[DEBUG   ] salt.crypt.get_rsa_pub_key: Loading public key                                                   
[DEBUG   ] Decrypting the current master AES key                                                            
[DEBUG   ] salt.crypt.get_rsa_key: Loading private key                                                      
[DEBUG   ] salt.crypt._get_key_with_evict: Loading private key                                              
[DEBUG   ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem                                            
[DEBUG   ] salt.crypt.get_rsa_pub_key: Loading public key                                                   
[DEBUG   ] Closing AsyncZeroMQReqChannel instance                                                           
[DEBUG   ] Connecting the Minion to the Master publish port, using the URI: tcp://192.168.8.14:4505         
[DEBUG   ] salt.crypt.get_rsa_key: Loading private key                                                      
[DEBUG   ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem                                            
[DEBUG   ] Determining pillar cache                                                                         
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for (u'c:\\salt\\conf\\pki\\minion', u'HEDT8', u'tcp://192
.168.8.14:4506', u'aes')                                                                                    
[DEBUG   ] Initializing new AsyncAuth for (u'c:\\salt\\conf\\pki\\minion', u'HEDT8', u'tcp://192.168.8.14:45
06')                                                                                                        
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.8.14:4506         
[DEBUG   ] Trying to connect to: tcp://192.168.8.14:4506                                                    
[DEBUG   ] salt.crypt.get_rsa_key: Loading private key                                                      
[DEBUG   ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem                                            
[DEBUG   ] Closing AsyncZeroMQReqChannel instance                                                           
[DEBUG   ] LazyLoaded jinja.render                                                                          
[DEBUG   ] LazyLoaded yaml.render                                                                           
[DEBUG   ] LazyLoaded pkg.install                                                                           
[DEBUG   ] LazyLoaded direct_call.execute                                                                   
[DEBUG   ] key: ifttt.secret_key, ret: _|-                                                                  
[DEBUG   ] key: ifttt:secret_key, ret: _|-                                                                  
[DEBUG   ] key: pushbullet.api_key, ret: _|-                                                                
[DEBUG   ] key: pushbullet:api_key, ret: _|-                                                                
[DEBUG   ] LazyLoaded reg.read_value                                                                        
[DEBUG   ] key: victorops.api_key, ret: _|-                                                                 
[DEBUG   ] key: victorops:api_key, ret: _|-                                                                 
[DEBUG   ] LazyLoaded platform.is_windows                                                                   
[DEBUG   ] LazyLoaded path.which                                                                            
[DEBUG   ] Could not LazyLoad pkg.normalize_name: 'pkg.normalize_name' is not available.                    
[DEBUG   ] Using existing pkg metadata db for saltenv 'base' (age is 2:11:22.926667)                        
[DEBUG   ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-19\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-19\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-20\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000\Software\Microsoft\Installer\Pr
oducts                                                                                                      
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000_Classes\Software\Microsoft\Wind
ows\CurrentVersion\Uninstall                                                                                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000_Classes\Software\Microsoft\Inst
aller\Products                                                                                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-18\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-19\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-19\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-20\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000\Software\Microsoft\Installer\Pr
oducts                                                                                                      
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000_Classes\Software\Microsoft\Wind
ows\CurrentVersion\Uninstall                                                                                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000_Classes\Software\Microsoft\Inst
aller\Products                                                                                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-18\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] pkg.install: 'jsh-putty' version '0.66' is already installed                                     
[DEBUG   ] Using existing pkg metadata db for saltenv 'base' (age is 2:11:22.986667)                        
[DEBUG   ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-19\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-19\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-20\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000\Software\Microsoft\Installer\Pr
oducts                                                                                                      
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000_Classes\Software\Microsoft\Wind
ows\CurrentVersion\Uninstall                                                                                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000_Classes\Software\Microsoft\Inst
aller\Products                                                                                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-18\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-19\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-19\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-20\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000\Software\Microsoft\Installer\Pr
oducts                                                                                                      
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000_Classes\Software\Microsoft\Wind
ows\CurrentVersion\Uninstall                                                                                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-21-1121613800-83764902-4022640230-1000_Classes\Software\Microsoft\Inst
aller\Products                                                                                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\Uninstall                
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Cannot find key: HKU\S-1-5-18\Software\Microsoft\Installer\Products                              
Traceback (most recent call last):                                                                          
  File "C:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys                        
    handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)                                         
error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')                                    
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for (u'c:\\salt\\conf\\pki\\minion', u'HEDT8', u'tcp://192
.168.8.14:4506', u'aes')                                                                                    
[DEBUG   ] Initializing new AsyncAuth for (u'c:\\salt\\conf\\pki\\minion', u'HEDT8', u'tcp://192.168.8.14:45
06')                                                                                                        
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.8.14:4506         
[DEBUG   ] Trying to connect to: tcp://192.168.8.14:4506                                                    
[DEBUG   ] Closing AsyncZeroMQReqChannel instance                                                           
[DEBUG   ] LazyLoaded nested.output                                                                         
local:                                                                                                      
    ----------                  

Produces

Versions Report Master

Master and Minion running same version..

Salt Version:
Salt: 2019.2.0

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.5
docker-py: Not Installed
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 0.9.1
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.6 (default, Nov 13 2018, 12:45:42)
python-gnupg: 0.3.6
PyYAML: 3.10
PyZMQ: 14.4.0
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5

System Versions:
dist: Ubuntu 14.04 trusty
locale: UTF-8
machine: x86_64
release: 3.13.0-74-generic
system: Linux
version: Ubuntu 14.04 trusty

Versions Report Minion

xxx@HEDT8 C:\salt>salt-call --versions-report
Salt Version:
Salt: 2019.2.0

Dependency Versions:
cffi: 1.11.5
cherrypy: 17.4.1
dateutil: 2.7.5
docker-py: Not Installed
gitdb: 2.0.5
gitpython: 2.1.10
ioflo: Not Installed
Jinja2: 2.10
libgit2: Not Installed
libnacl: 1.6.1
M2Crypto: Not Installed
Mako: 1.0.7
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: 2.19
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
python-gnupg: 0.4.3
PyYAML: 3.13
PyZMQ: 17.1.2
RAET: Not Installed
smmap: 2.0.5
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.2.5

System Versions:
dist:
locale: cp1252
machine: AMD64
release: 7
system: Windows
version: 7 6.1.7601 SP1 Multiprocessor Free

@twangboy
Copy link
Contributor

What account is the salt-minion running under? It looks like it may be a permissions issue.

@dwoz dwoz added the info-needed waiting for more info label Jul 29, 2019
@dwoz dwoz added this to the Blocked milestone Jul 29, 2019
@breshead
Copy link
Author

It is running under the local administrator account.

@twangboy
Copy link
Contributor

twangboy commented Jul 31, 2019

@breshead I was able to replicate the issue with the log messages. The above PR's should take care of that. I don't think it fixes the WindowsError you reference above.

@twangboy
Copy link
Contributor

twangboy commented Jul 31, 2019

@breshead Would it be possible to get the stacktrace for the WindowsError the next time you see it?

@lapfrank12
Copy link

I am having a very similar issue @twangboy
Here's the debug mode for a pkg.install msoffice on a windows salt minion (2019-02, python3 64 bits):

[DEBUG ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Installer\Products Traceback (most recent call last): File "c:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask) pywintypes.error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.') [DEBUG ] Cannot find key: HKU\S-1-5-19\Software\Microsoft\Installer\Products Traceback (most recent call last): File "c:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask) pywintypes.error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.') [DEBUG ] Cannot find key: HKU\S-1-5-20\Software\Microsoft\Installer\Products Traceback (most recent call last): File "c:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask) pywintypes.error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.') [DEBUG ] Cannot find key: HKU\S-1-5-21-507921405-113007714-1060284298-81993\Software\Microsoft\Installer\Products Traceback (most recent call last): File "c:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask) pywintypes.error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.') [DEBUG ] Cannot find key: HKU\S-1-5-21-507921405-113007714-1060284298-81993_Classes\Software\Microsoft\Windows\CurrentVersion\Uninstall Traceback (most recent call last): File "c:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask) pywintypes.error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.') [DEBUG ] Cannot find key: HKU\S-1-5-21-507921405-113007714-1060284298-81993_Classes\Software\Microsoft\Installer\Products Traceback (most recent call last): File "c:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask) pywintypes.error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.') [DEBUG ] Cannot find key: HKU\S-1-5-18\Software\Microsoft\Installer\Products Traceback (most recent call last): File "c:\salt\bin\lib\site-packages\salt\utils\win_reg.py", line 341, in list_keys handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask) pywintypes.error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.') [DEBUG ] Cannot find key: HKU\.DEFAULT\Software\Microsoft\Installer\Products

@breshead
Copy link
Author

@twangboy : Found the WindowsError, it was while installing JRE

[INFO    ] Running state [C:\salt\salt-call pkg.install jsh-jre8] at time 09:01:08.870000
[INFO    ] Executing state cmd.run for [C:\salt\salt-call pkg.install jsh-jre8]
[INFO    ] Executing command 'C:\salt\salt-call pkg.install jsh-jre8' as user 'HEDT8\csuser' in directory 'C:\salt'
[DEBUG   ] Unable to OpenProcess pid=4 name=System
[DEBUG   ] An exception occurred in this state: The system could not find the environment option that was entered.
Traceback (most recent call last):
  File "c:\salt\bin\lib\site-packages\salt\state.py", line 1933, in call
    **cdata['kwargs'])
  File "c:\salt\bin\lib\site-packages\salt\loader.py", line 1939, in wrapper
    return f(*args, **kwargs)
  File "c:\salt\bin\lib\site-packages\salt\states\cmd.py", line 916, in run
    name, timeout=timeout, python_shell=True, **cmd_kwargs
  File "c:\salt\bin\lib\site-packages\salt\modules\cmdmod.py", line 2069, in run_all
    **kwargs)
  File "c:\salt\bin\lib\site-packages\salt\modules\cmdmod.py", line 407, in _run
    return win_runas(cmd, runas, password, cwd)
  File "c:\salt\bin\lib\site-packages\salt\utils\win_runas.py", line 185, in runas
    environment=env,
  File "c:\salt\bin\lib\site-packages\salt\platform\win.py", line 1055, in CreateProcessWithTokenW
    raise exc
WindowsError: The system could not find the environment option that was entered.

[ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "c:\salt\bin\lib\site-packages\salt\state.py", line 1933, in call
    **cdata['kwargs'])
  File "c:\salt\bin\lib\site-packages\salt\loader.py", line 1939, in wrapper
    return f(*args, **kwargs)
  File "c:\salt\bin\lib\site-packages\salt\states\cmd.py", line 916, in run
    name, timeout=timeout, python_shell=True, **cmd_kwargs
  File "c:\salt\bin\lib\site-packages\salt\modules\cmdmod.py", line 2069, in run_all
    **kwargs)
  File "c:\salt\bin\lib\site-packages\salt\modules\cmdmod.py", line 407, in _run
    return win_runas(cmd, runas, password, cwd)
  File "c:\salt\bin\lib\site-packages\salt\utils\win_runas.py", line 185, in runas
    environment=env,
  File "c:\salt\bin\lib\site-packages\salt\platform\win.py", line 1055, in CreateProcessWithTokenW
    raise exc
WindowsError: The system could not find the environment option that was entered.


[INFO    ] Completed state [C:\salt\salt-call pkg.install jsh-jre8] at time 09:01:08.933000 (duration_in_ms=63.0)

@breshead
Copy link
Author

In addition, I have finally figured out that the 'silent fail' that I thought was occurring was really just Salt saying "Already installed" as demonstrated below (Same behavior on Linux).

Isn't it supposed to say something like "Already Installed"? Am I dreaming that up or did it used to be that way?

csuser@HEDT8 C:\Users\csuser>salt-call pkg.install jsh-tightvnc                                                               
local:                                                                                                                        
    ----------                                                                                                                

csuser@HEDT8 C:\Users\csuser>salt-call pkg.remove jsh-tightvnc                                                                
local:                                                                                                                        
    ----------                                                                                                                
    jsh-tightvnc:                                                                                                             
        ----------                                                                                                            
        new:                                                                                                                  
        old:                                                                                                                  
            2.7.10.0                                                                                                          

csuser@HEDT8 C:\Users\csuser>salt-call pkg.install jsh-tightvnc                                                               
local:                                                                                                                        
    ----------                                                                                                                
    jsh-tightvnc:                                                                                                             
        ----------                                                                                                            
        new:                                                                                                                  
            2.7.10.0                                                                                                          
        old:                                                                                                                  

csuser@HEDT8 C:\Users\csuser>salt-call pkg.install jsh-tightvnc                                                               
local:                                                                                                                        
    ----------                                                                                                                

csuser@HEDT8 C:\Users\csuser> 

@twangboy
Copy link
Contributor

@breshead
I have some questions regarding: C:\salt\salt-call pkg.install jsh-jre8?
What user is running the salt-call command? ^^^
Does the user have Admin privileges?
Is the runas user defined in the jsh-jre.sls file?
Could you post the sls for C:\salt\salt-call pkg.install jsh-jre8?
Is this a custom definition for jre? Or are you using the one out of salt-winrepo-ng?
If custom, could you post that as well?

@twangboy
Copy link
Contributor

With your regards to the empty dictionary... That is a valid return in Salt. It was confusing to me at first when I was learning salt. I agree, coming from Windows world, I would expect to see something saying that it was successful and already installed... I think I had some code in at one point to that effect. But it's a change to the API, so I had to revert it. This brings Salt on Windows behavior in line with Salt on Linux.

@twangboy
Copy link
Contributor

It should only hit that code if you're doing some sort of runas... I'm not sure how we're getting there from pkg.install....

@breshead
Copy link
Author

@twangboy here is the package sls.

  1 {% set downloads = salt['pillar.get']('netcfg:' ~ salt['grains.get']('mmdata:location') ~ ':downloads' ) %}
  2 jsh-jre8:
  3   '8.0.770.3':
  4     {% if grains['cpuarch'] == 'AMD64' %}
  5 
  6     full_name: 'Java 8 Update 77 (64-bit)'
  7     installer: 'http://{{ downloads }}/drivers/applications/java-re/jre-8u77-windows-x64.exe'
  8     uninstall_flags: '/qn /x {26A24AE4-039D-4CA4-87B4-2F86418077F0} /norestart'
  9     
 10     {% elif grains['cpuarch'] == 'x86' %}
 11 
 12     full_name: 'Java 8 Update 77'
 13     installer: 'http://{{ downloads }}/drivers/applications/java-re/jre-8u77-windows-i586.exe'
 14     uninstall_flags: '/qn /x {26A24AE4-039D-4CA4-87B4-2F86418077F0} /norestart'
 15     
 16     {% endif %}
 17     
 18     install_flags: '/s REBOOT=Suppress SPONSORS=0'
 19 
 20     uninstaller: 'msiexec.exe'
 21     msiexec: False
 22     locale: en_US
 23     reboot: False
 24 

The user is 'csuser' which is a local admin on the machine.

There is no 'runas' in the package sls, but in the state file from which it is called..

184 java-re-installer:
185   cmd.run:
186     - name: C:\salt\salt-call pkg.install jsh-jre8
187     - cwd: C:\salt
188     - runas: {{ admname }}
189     - password: {{ admpwd }}

As an aside, any critique on how I am making these calls or organizing things would be appreciated as well.

@breshead
Copy link
Author

The runas is required because the "SYSTEM" user which salt runs as by default does not have access to the gui and so the installer hangs even though we specifically say to run silent (no gui interactions).

@twangboy
Copy link
Contributor

twangboy commented Aug 29, 2019

Looks like you have to use a config file to install silently with jre8. The /s switch was for jre7: https://java.com/en/download/help/silent_install.xml

To do that properly, you'll need to host the binary with the config and use the cache_dir option. Let's say, /srv/salt/win/repo-ng/jre8/

Populate config file (/srv/salt/win/repo-ng/jre8/install_opts.cfg) with options from https://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html#config_file_options. But here's the one we care about for now

INSTALL_SILENT=Enable

Package definition

jre8:
  '8.0.770.3':
    full_name: 'Java 8 Update 77 (64-bit)'
    installer: '/srv/salt/win/repo-ng/java-re/jre-8u77-windows-x64.exe'
    install_flags: 'INSTALLCFG=.\install_opts.cfg'
    cache_dir: True
    uninstaller: 'msiexec.exe'
    uninstall_flags: '/qn /x {26A24AE4-039D-4CA4-87B4-2F86418077F0} /norestart'
    msiexec: False
    locale: en_US
    reboot: False

State

java-re-installer:
  pkg.installed:
    - name: jre8

You may have to experiment a little to get the path to the config right. It may not like .\install_opts.cfg. It may have to be something like C:\salt\srv\salt\win\repo-ng\jre8\install_opts.cfg

Something like that

@breshead
Copy link
Author

This worked and I am able to get rid of the 'runas'. Does this mean the issue is resolved or we just don't care anymore because I'm not using 'runas'? :)

New package.sls

  1 {% set downloads = salt['pillar.get']('netcfg:' ~ salt['grains.get']('mmdata:location') ~ ':downloads' ) %}
  2 jsh-jre8:
  3   '8.0.2210.11':
  4     {% if grains['cpuarch'] == 'AMD64' %}
  5 
  6     full_name: 'Java 8 Update 221 (64-bit)'
  7     installer: 'http://{{ downloads }}/drivers/applications/java-re/jre-8u221-windows-x64.exe'
  8     uninstall_flags: '/qn /x {26A24AE4-039D-4CA4-87B4-2F86418077F0} /norestart'
  9 
 10     {% elif grains['cpuarch'] == 'x86' %}
 11 
 12     full_name: 'Java 8 Update 221'
 13     installer: 'http://{{ downloads }}/drivers/applications/java-re/jre-8u221-windows-i586.exe'
 14     uninstall_flags: '/qn /x {26A24AE4-039D-4CA4-87B4-2F86418077F0} /norestart'
 15 
 16     {% endif %}
 17 
 18     cache_file: 'salt://win/repo-ng/jsh-java-re.cfg'
 19     install_flags: 'INSTALLCFG=C:\salt\var\cache\salt\minion\files\base\win\repo-ng\jsh-java-re.cfg'
 20     #install_flags: '/s REBOOT=Suppress SPONSORS=0'
 21 
 22     uninstaller: 'msiexec.exe'
 23     msiexec: False
 24     locale: en_US
 25     reboot: False

Config File:

  1 INSTALL_SILENT=Enable
  2 SPONSORS=Disable
  3 REBOOT=Disable

And the install state goes to your example..

@breshead
Copy link
Author

Maybe it was throwing the error because I was running the state from salt-call as the same admin that the 'runas' uses. Could that be it?

@damon-atkins
Copy link
Contributor

damon-atkins commented Aug 30, 2019

You can run salt-call by hand as any one with windows admin to install software. Far as I am aware runas on windows needs special windows permissions. You can use salt-call to install software which requires GUI feed back but you need to be logon and run it by hand, so you can interact with the GUI.

salt-call pkg.install is a module design to feed data into the state.pkg. state.pkg expects to get data if changes happen. If you want nice output you need to use salt-call state.high {'grepwin':{'pkg':['installed']}} This will tell you that software is already installed. When you write sls files you call state.pkg not pkg.install module.


C:\salt>salt-call state.high "{'pkgnamehere':{'pkg':['installed']}}"
[ERROR   ] win_pkg.install Unable to locate package pkgnamehere
[ERROR   ] state.format_log {'pkgnamehere': 'Unable to locate package pkgnamehere'}
local:
    ----------
    pkg_|-pkgnamehere_|-pkgnamehere_|-installed:
        ----------
        __id__:
            pkgnamehere
        __run_num__:
            0
        __sls__:
            None
        changes:
            ----------
            pkgnamehere:
                Unable to locate package pkgnamehere
        comment:
            The following packages failed to install/update: pkgnamehere
        duration:
            6921.907
        name:
            pkgnamehere
        result:
            False
        start_time:
            01:30:03.763035

@breshead
Copy link
Author

breshead commented Sep 5, 2019

@twangboy re:WindowsError: The system could not find the environment option that was entered.

You know where the error is coming from, otherwise you would not have been able to deduce runas as the source.
Does this mean it is a sane error to be thrown in this instance and we can call this one done? I can't see why it would do this but I don't know the inner workings of the code very well.

i.e. Is this complete or is there more work to do?

@breshead
Copy link
Author

With the biggest part of this issue mitigated it does not look like anyone cares about the rest. I know I don't and I hate to have clutter build up so I am closing this.

The only unsolved part is why salt throws the WindowsError: The system could not find the environment option that was entered. error when using runas under windows. It could just be that specific Java installer or a wider "Windows" issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed waiting for more info
Projects
None yet
Development

No branches or pull requests

5 participants