-
Notifications
You must be signed in to change notification settings - Fork 452
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
wrong init_package on ubuntu 14.04 #917
Comments
This however gives the correct output. Maybe could be used as an additional check?
|
I'm open to changing this. It's been a frustration of mine since the init_package attribute was launched in the first place. It would need to go into Ohai 14 since it's a breaking change, but I think it would make a lot of people quite happy. |
So that works when it's upstart but systemd does not support the |
the other problem is init_package should also be init_packages since there's the possibility of supporting more than 1. RHEL 6 for example does sys-v and upstart. |
Ya most distros actually provide more than one init system. Ubuntu has supported |
Seeing the output from a bunch of systems should let us know if we still need more checks to properly determine. #!/usr/bin/env ruby
proc_comm = ''
init_system = ''
if File.exists?('/proc/1/comm')
File.open('/proc/1/comm') do |f|
proc_comm = f.gets.chomp
end
if proc_comm == 'systemd'
init_system = 'systemd'
elsif proc_comm == 'init'
command = `sudo /sbin/init --version`
version_string = command.first.split("\n")
if version_string.match(/upstart/)
init_system = 'upstart'
else
init_system = 'init'
end
end
end
p init_system Another option for systemd detection that is probably less reliable (and unlikely needed) would be to grep the |
If anyone who has access to a very diverse set of platforms could run the script posted above and share the outputs in a gist that would be great. If we can confirm that the added checks help ensure the appropriate outcome I can work on a PR. On the note of specialized systems like |
So we discussed this one internally and we've decided to actually leave this one as-is. We want to avoid a lot of one off logic in this detection and instead rely on exactly what the OS returns to us. Since Ubuntu 14.04 is going EOL early next year I suspect most people have already implemented workarounds for this in their code. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
init_package should report upstart, but it reports init. the contents of /proc/1/cmdline is not enough for determining the init system:
I've seen reports that it does not work with later versions of the OS either, which run systemd
Ohai Version
master
Platform Version
Ohai Output
init
The text was updated successfully, but these errors were encountered: