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

pkg.latest fails on Lithium on arch linux #23667

Closed
ghost opened this issue May 13, 2015 · 9 comments
Closed

pkg.latest fails on Lithium on arch linux #23667

ghost opened this issue May 13, 2015 · 9 comments
Labels
Bug broken, incorrect, or confusing behavior Execution-Module fixed-pls-verify fix is linked, bug author to confirm fix P1 Priority 1 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@ghost
Copy link

ghost commented May 13, 2015

This used to work just fine with salt 2014.7.5

----------
          ID: linux
    Function: pkg.latest
      Result: False
     Comment: An error was encountered while checking the newest available version of package(s): Unable to run command ['LANG=C', 'pacman', '-Sy'] with the context {'with_communicate': True, 'shell': False, 'env': {'LANG': 'en_US.UTF-8', 'TERM': 'xterm-color', 'SHELL': '/bin/bash', 'SHLVL': '2', 'SSH_TTY': '/dev/pts/0', 'SSH_AUTH_SOCK': '/tmp/ssh-1DkyMchlrJ/agent.32092', 'SSH_CLIENT': '10.0.0.2 53802 22', 'PWD': '/root', 'LOGNAME': 'root', 'USER': 'root', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl', 'MAIL': '/var/mail/root', 'PYTHONUNBUFFERED': 'true', 'SSH_CONNECTION': '10.0.0.2 53802 10.0.0.14 22', 'HOME': '/root', 'LC_ALL': 'C', '_': '/usr/bin/salt-call'}, 'stdout': -1, 'close_fds': True, 'stdin': None, 'stderr': -1, 'cwd': '/root'}, reason: [Errno 2] No such file or directory
     Started: 09:05:50.674616
    Duration: 4.302 ms
     Changes:  

Pacman exists:

# which pacman
/usr/bin/pacman

And as you can see, /usr/bin/ is listed in the PATH being used for the command.

@rallytime
Copy link
Contributor

Thanks for this report @Investocat. We discovered this bug recently as well as an artifact of the change documented here - see the warning. It was fixed with #23424, and then I have back-ported this change to 2015.5 right now with #23690. This will be fixed in 2015.5.1.

The quick workaround for now would just be to add python_shell=True to your affected state, or you can also see the other workarounds in the link above.

@rallytime rallytime added Execution-Module Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around fixed-pls-verify fix is linked, bug author to confirm fix P1 Priority 1 labels May 13, 2015
@rallytime rallytime added this to the Approved milestone May 13, 2015
@codekoala
Copy link
Contributor

Perhaps I don't understand what's supposed to be handled by the referenced issues, but this only worked for me when I removed the LANG=C before pacman -Sy. It becomes obvious that this is the problem because it's the first item in the command list (which must be an executable, not an environment variable). Python's subprocess.Popen has an env parameter for environment variables.

@codekoala
Copy link
Contributor

Nevermind. I see it now. I thought the file I edited already included the python_shell=True.

@jfindlay jfindlay added the Platform Relates to OS, containers, platform-based utilities like FS, system based apps label May 26, 2015
@murdegern
Copy link

This doesn't seem fixed in 2015.5.1, or I have another error. For me, it says

      ID: pkg_uptodate
Function: pkg.uptodate
  Result: False
 Comment: error: target not found: |
          error: target not found: egrep
          error: target not found: ^\s|^:Root      : /
          Conf File : /etc/pacman.conf
          DB Path   : /var/lib/pacman/
          Cache Dirs: /var/cache/pacman/pkg/  
          Lock File : /var/lib/pacman/db.lck
          Log File  : /var/log/pacman.log
          GPG Dir   : /etc/pacman.d/gnupg/
          Targets   : |  egrep  ^\s|^:
          :: Synchronizing package databases...
          downloading core.db...
          downloading extra.db...
          downloading community.db...
          downloading alarm.db...
           aur is up to date
           enda is up to date
 Started: 09:44:16.213174
Duration: 4817.127 ms
 Changes:  

which I think is the same problem - the pipes and egrep are interpreted as parameters to pacman.

As for the quick fix: How do I add python_shell=True to a YAML state file?

@rallytime
Copy link
Contributor

@murdegern I think I may have misspoken above about adding python_shell to the state file. So you can either do one of the options in the release notes warning or you could also download the latest salt/modules/pacman.py files from the 2015.5 branch that now includes the fix from @aneeshusa (#24490) and put it in your _modules directory and deploy it to your minions. That will override your current file from 2015.5.1 with the pacman.py file with the fix.

Or, the fix will be available in 2015.5.3.

@thatch45
Copy link
Contributor

thatch45 commented Jun 9, 2015

@gtmanfred you may consider adding #24490 as a patch to the Arch package

@rallytime
Copy link
Contributor

Also, I was able to reproduce the failure from @murdegern and then tested the fix from @aneeshusa and it fixed the errors seen above. Since the original bug report was fixed some time ago, and the secondary problem has also been fixed, I am going to close this issue.

If this pops up again after applying the fixes from above, please leave a comment and we will be happy to reopen. Thanks!

@gtmanfred
Copy link
Contributor

@thatch45 I will add it now.

SomeoneSerge pushed a commit to SomeoneSerge/arch-community-packages that referenced this issue Sep 4, 2016
Will be fixed in 2015.5.3 next week

saltstack/salt#23667

git-svn-id: file:///srv/repos/svn-community/svn@135100 9fca08f4-af9d-4005-b8df-a31f2cc04f65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module fixed-pls-verify fix is linked, bug author to confirm fix P1 Priority 1 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

6 participants