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

sysctl gives returned error 255 first time #53

Closed
sheijmans opened this issue Aug 28, 2013 · 15 comments
Closed

sysctl gives returned error 255 first time #53

sheijmans opened this issue Aug 28, 2013 · 15 comments

Comments

@sheijmans
Copy link

Hi,

when using sysctl in a manifest, the first time it returns an error 255, why does this happen?

# cat test_sysctl.pp
sysctl { "net.core.rmem_max":
  ensure  => present,
  value   => "2096304",
  comment => "Oracle Weblogic requirement.",
}
# puppet apply  test_sysctl.pp
Error: Execution of '/sbin/sysctl -w net.core.rmem_max="2096304"' returned 255: error: "Invalid argument" setting key "net.core.rmem_max"

Error: /Stage[main]//Sysctl[net.core.rmem_max]/ensure: change from absent to present failed: Execution of '/sbin/sysctl -w net.core.rmem_max="2096304"' returned 255: error: "Invalid argument" setting key "net.core.rmem_max"

Notice: Finished catalog run in 0.19 seconds
# puppet apply  test_sysctl.pp
Notice: Finished catalog run in 0.18 seconds

Regards,
Stefan

@sheijmans
Copy link
Author

Just tested with version 0.7.0 and it works fine, perhaps to be related with;

* sysctl: ignore whitespace inside values during comparisons, fixes #50

#50

@domcleal
Copy link
Contributor

@sheijmans do you mean it's broken on the current version, but working on an older one?

@sheijmans
Copy link
Author

@domcleal yes it is broken in the current version (v1.0.0) for the above manifest, it works in v0.7.0.

@sheijmans sheijmans reopened this Aug 29, 2013
@domcleal
Copy link
Contributor

Thanks for confirming. Which OS is this?

@sheijmans
Copy link
Author

This was on RHEL64, I will also check it on RHEL59.

@sheijmans
Copy link
Author

On RHEL59 it also works with v0.7.0 and with v1.0.0 the same message as on RHEL64 but the second time you run it, it doesn't work as it does on RHEL64.

@kitchen
Copy link
Contributor

kitchen commented Aug 30, 2013

I'm running into this same issue on ubuntu 12.04 with v1.0.0. It does not clear itself up.

@kitchen
Copy link
Contributor

kitchen commented Aug 30, 2013

Error: Execution of '/sbin/sysctl -w kernel.shmall="4194304"' returned 255: error: "Invalid argument" setting key "kernel.shmall"

Error: /Stage[main]/Profile::Nbuild::Postgresql::Server/Sysctl[kernel.shmall]/value: change from 4194304 to 4194304 failed: Execution of '/sbin/sysctl -w kernel.shmall="4194304"' returned 255: error: "Invalid argument" setting key "kernel.shmall"
Error: Execution of '/sbin/sysctl -w kernel.shmmax="17179869184"' returned 255: error: "Invalid argument" setting key "kernel.shmmax"

Error: /Stage[main]/Profile::Nbuild::Postgresql::Server/Sysctl[kernel.shmmax]/value: change from 17179869184 to 17179869184 failed: Execution of '/sbin/sysctl -w kernel.shmmax="17179869184"' returned 255: error: "Invalid argument" setting key "kernel.shmmax"

@domcleal
Copy link
Contributor

Ah, this works in a shell because the shell will parse the quotes and remove them when executing the command. In Puppet, it's running the command directly and passing the quotes straight into the arguments.

@kitchen
Copy link
Contributor

kitchen commented Aug 30, 2013

Ok, I'll make a PR for this as it's affecting me right now :)

give me a few minutes!

@razorsedge
Copy link

+1

@treydock
Copy link
Contributor

+1

One workaround I've found is setting apply => false and notify => Exec['reload sysctl'] and defining an Exec to apply sysctl.conf

  exec { 'reload sysctl':
    command     => 'sysctl -p',
    refreshonly => true,
    path        => '/sbin/:/usr/sbin/:/usr/bin/:/bin/',
  }

@jeffNagra
Copy link

+1

domcleal pushed a commit that referenced this issue Oct 5, 2013

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Resolves: #53
@domcleal domcleal mentioned this issue Oct 5, 2013
@domcleal
Copy link
Contributor

domcleal commented Oct 5, 2013

Thanks for all the reports, and to @kitchen for fixing the bug. Sorry it took me ages to release.

I've just put out v1.0.1, but hit an error uploading to the Forge, so in the meantime, grab it from GitHub releases here:

https://github.com/hercules-team/augeasproviders/releases/tag/v1.0.1
https://github.com/hercules-team/augeasproviders/releases/download/v1.0.1/domcleal-augeasproviders-1.0.1.tar.gz

@domcleal domcleal closed this as completed Oct 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@kitchen @domcleal @treydock @razorsedge @sheijmans @jeffNagra and others