salt icon indicating copy to clipboard operation
salt copied to clipboard

windows salt-minion running localservice account fails to install package

Open getabc opened this issue 11 years ago • 12 comments

Hello,

Running 2015.5.2 on service and minions.

Tried to upgrade a number of minions today and only got as far as them downloading the installer files from the server. When I kill the NSSM service and run salt in debug from command line, then the packages are installed successfully. When I go back to NSSM/LocalService it is unable to install packages again.

The media players automatically log into windows without a password, so I'm unable to start the service with the Administrator account.

Any idea what might be going wrong?

AC

getabc avatar Jul 09 '15 15:07 getabc

@getabc, thanks for the report. I do not know what the problem might be. Is it possible for you to post the debug log output of the minion running under NSSM when you try to install the new packages?

jfindlay avatar Jul 09 '15 17:07 jfindlay

@jfindlay i found the following error in the log file ...

2015-07-13 12:38:31,503 [salt.minion      ][INFO    ][1996] User sudo_andrewc Executing command pkg.install with jid 20150713165320587827
2015-07-13 12:38:31,505 [salt.minion      ][DEBUG   ][1996] Command details {'tgt_type': 'glob', 'jid': '20150713165320587827', 'tgt': 'AC1*.ktm.*', 'ret': '', 'user': 'sudo_andrewc', 'arg': ['Node', {'version': '0.12.6', '__kwarg__': True}], 'fun': 'pkg.install'}
2015-07-13 12:38:31,507 [salt.minion      ][INFO    ][1996] Starting a new job with PID 1996
2015-07-13 12:38:31,523 [salt.utils.lazy  ][DEBUG   ][1996] Could not LazyLoad pkg.normalize_name
2015-07-13 12:38:31,526 [salt.utils.winapi][DEBUG   ][1996] Initializing COM library
2015-07-13 12:38:31,533 [salt.utils.winapi][DEBUG   ][1996] Uninitializing COM library
2015-07-13 12:38:33,295 [salt.loaded.int.module.cmdmod][INFO    ][1996] Executing command ['msiexec', '/i', 'c:\\salt\\var\\cache\\salt\\minion\\files\\base\\win\\repo\\node\\node-v0.12.6-x64.msi', '/quiet', '/qn', '/norestart'] in directory 'C:\\Windows\\system32\\config\\systemprofile'
2015-07-13 12:38:40,740 [salt.loaded.int.module.cmdmod][ERROR   ][1996] Command ['msiexec', '/i', 'c:\\salt\\var\\cache\\salt\\minion\\files\\base\\win\\repo\\node\\node-v0.12.6-x64.msi', '/quiet', '/qn', '/norestart'] failed with return code: 1603
2015-07-13 12:38:40,741 [salt.loaded.int.module.cmdmod][ERROR   ][1996] output:

Any idea what "failed with return code: 1603" means?

getabc avatar Jul 13 '15 06:07 getabc

I also tried to get the msiexec installer output to a log file - see below- but the command got executed,

'/quiet', '/qn', '/norestart','/L*V','"C:\\temp\\node-msi.log"'
Node:
  0.12.6:
    installer: 'salt://win/repo/node/node-v0.12.6-x64.msi'
    full_name: 'Node.js v0.12.6'
    reboot: False
    install_flags: ' /quiet /qn /norestart /L*V "C:\\temp\\node-msi.log"'
    msiexec: True
    uninstaller: 'salt://win/repo/node/node-v0.12.6-x64.msi'
    uninstall_flags: ' /qn /x'

getabc avatar Jul 13 '15 07:07 getabc

@getabc, what was the salt command you were using in either case?

jfindlay avatar Jul 13 '15 16:07 jfindlay

@jfindlay commands below,

salt-run winrepo.genrepo
salt 'AC1*.ktm.*' pkg.refresh_db
salt 'AC1*.ktm.*' pkg.install Node version=0.12.6

getabc avatar Jul 14 '15 01:07 getabc

@getabc see my comment https://github.com/saltstack/salt/issues/25472#issuecomment-122233739 to allow you to debug this msi install to a log file. Try using 'forward' slashes instead of 'backward' slashes for the msi log file name.

TheBigBear avatar Jul 17 '15 10:07 TheBigBear

finally got the msi log - big thanks goes out to @TheBigBear

interesting bit in the log file

WixCreateInternetShortcuts:  Entering WixCreateInternetShortcuts in C:\Windows\Installer\MSI63EC.tmp, version 3.9.1208.0
WixCreateInternetShortcuts:  Creating IUniformResourceLocatorW shortcut 'c:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Node.js\Node.js website.url' target 'http://nodejs.org'
WixCreateInternetShortcuts:  Error 0x80070003: failed to save shortcut 'c:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Node.js\Node.js website.url'
WixCreateInternetShortcuts:  Error 0x80070003: failed to create Internet shortcut
CustomAction WixCreateInternetShortcuts returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)

final exit information

MSI (s) (3C:60) [21:51:01:995]: Note: 1: 1708 
MSI (s) (3C:60) [21:51:01:995]: Product: Node.js -- Installation failed.

MSI (s) (3C:60) [21:51:01:995]: Windows Installer installed the product. Product Name: Node.js. Product Version: 0.12.7. Product Language: 1033. Manufacturer: Joyent, Inc. and other Node contributors. Installation success or error status: 1603.

MSI (s) (3C:60) [21:51:01:995]: Deferring clean up of packages/files, if any exist
MSI (s) (3C:60) [21:51:02:011]: MainEngineThread is returning 1603
MSI (s) (3C:C8) [21:51:02:011]: RESTART MANAGER: Session closed.
MSI (s) (3C:C8) [21:51:02:011]: No System Restore sequence number for this installation.
=== Logging stopped: 7/17/2015  21:51:01 ===
MSI (s) (3C:C8) [21:51:02:011]: User policy value 'DisableRollback' is 0
MSI (s) (3C:C8) [21:51:02:011]: Machine policy value 'DisableRollback' is 0
MSI (s) (3C:C8) [21:51:02:011]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (3C:C8) [21:51:02:011]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (3C:C8) [21:51:02:011]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (3C:C8) [21:51:02:011]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (s) (3C:C8) [21:51:02:011]: Restoring environment variables
MSI (s) (3C:C8) [21:51:02:011]: Destroying RemoteAPI object.
MSI (s) (3C:DC) [21:51:02:011]: Custom Action Manager thread ending.
MSI (c) (80:74) [21:51:02:011]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (80:74) [21:51:02:011]: MainEngineThread is returning 1603
=== Verbose logging stopped: 7/17/2015  21:51:02 ===

getabc avatar Jul 17 '15 12:07 getabc

@getabc Try adding ALLUSERS="1" to your install flags. The other option is to run the salt-minion under an account with admin privileges, but I'm not sure about the security implications there. @UtahDave ? ^^^^

twangboy avatar Jul 27 '15 23:07 twangboy

@twangboy @UtahDave that worked perfectly!

Only one thing to note, the installer process interacted with the desktop. I would have expected it to be silent with quiet flag set, but I am quite happy with the result.

We tried using an account with admin privileges, but as you pointed out there are security implications.

getabc avatar Jul 28 '15 00:07 getabc

@twangboy @UtahDave quick update.

With the ALLUSERS="1" flag set, the system is not upgrading, but installing nodejs as a new package. After the salt pkg.install my Windows programs lists nodejs 0.12.6 and 0.12.7 as installed. Here are the two scenarios I tested against.

Current configuration Install nodejs 0.12.6 from desktop

Execute salt nodejs upgrade

salt 'AC1*.ktm.*' pkg.install 'Node.js' version=0.12.7

Result: nodejs 0.12.6 & 0.12.7

Clean configuration nodejs is not installed

Execute salt nodejs install

salt 'AC1*.ktm.*' pkg.install 'Node.js' version=0.12.6

Result: nodejs 0.12.6

Execute salt nodejs upgrade

salt 'AC1*.ktm.*' pkg.install 'Node.js' version=0.12.7

Result: nodejs 0.12.7

I tried with both the ALLUSERS="1" and ALLUSERS="2"flag, but same result.

I can uninstalled nodejs and start for scratch, but I'm not sure why two occurrences would appear.

getabc avatar Jul 28 '15 05:07 getabc

@getabc I get the same results if I install nodejs 0.12.6 manually and then install 0.12.7 using the ALLUSERS="1" option. However, if 0.12.6 is installed also with the ALLUSERS="1" then the upgrade happens properly.

twangboy avatar Jul 28 '15 15:07 twangboy

Created an issue to solve this for future installations: https://github.com/saltstack/salt/issues/25839

twangboy avatar Jul 29 '15 17:07 twangboy