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
service_mgr: detect systemd, even offline #66071
service_mgr: detect systemd, even offline #66071
Conversation
if not os.path.exists('/sbin/init'): | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bcoca if I were to remove this section, would you be okay merging it? This would leave only the SUSE family of distros out in the cold. All other systemd-based distros I tried have /sbin/init
as a symlink to systemd
. Same for debian jessie when in systemd mode. If you switch it to sysVinit mode, /sbin/init
is no longer a symlink to systemd
but is instead the SysV binary.
I could find no non-systemd distro where systemctl
is an available package and /sbin/init
is missing... If you can identify such a distro, I can look to see how to handle it.
FWIW, the linux service_mgr code has been unmodified since you originally introduced it, except for a small tweak for openrc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
off top of my head, gentoo (i used it w/o systemd, but with systemctl installed), but mostly i would just look at previous tickets that posed the issue (i installed systemctl on my workstation just to test this).
IIRC the most common case was using a container for a distro that defaults to systemd, while the host is not using systemd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking. I've removed these lines. I've found that OpenSUSE and friends have an optional systemd-sysvinit
package that provides this symlink. (Their initrd has /init
symlinked to /usr/lib/systemd/systemd
, so no technical need for /sbin/init to be symlinked given that they're using an initrd.)
This issue has been discussed extensively in several IRC meetings and we are reluctantly going to merge this. There a lot of potential unknown issues this autodetection could introduce. While this change is helpful in the use case described above, it very well may break other use cases. We just don't know. This is why we added the That's still the approach we favor over improving the autodetection, but @jamescassell has advocated heavily for this change and is willing to help with the fallout. rebuild_merge |
SUMMARY
Currently, systemd is only detected as the service manager if systemd is actually running. This also adds a check that will detect systemd ever if it is not currently running, such as during a container bulid.
ISSUE TYPE
COMPONENT NAME
service_mgr
ADDITIONAL INFORMATION