microsoft / azurelinux

Linux OS for Azure 1P services and edge appliances
MIT License
4.15k stars 514 forks source link

Missing feature systemd/systemctl? #9886

Open TheOnlyWei opened 1 month ago

TheOnlyWei commented 1 month ago

Is your feature request related to a problem? Please describe. I would like the core Azure Linux Mariner image to contain systemctl command as advertised by this document: https://microsoft.github.io/azurelinux/docs/#managing-services-with-systemd

However, the latest version (mcr.microsoft.com/cbl-mariner/base/core:2.0.20240628) doesn't seem to have systemctl command.

root [ / ]# systemctl
bash: systemctl: command not found

This is the version I am using. Let me know if I am using the wrong one.

docker pull mcr.microsoft.com/cbl-mariner/base/core:2.0.20240628

Describe the solution you'd like Have systemctl available for Azure Linux Mariner.

elsaco commented 1 month ago

@TheOnlyWei this is the core version! Try the full version if you want systemd or run tdnf install systemd

TheOnlyWei commented 1 month ago

@elsaco

  1. Do you have a link to the version? I don't find any "full" versions when I search "mariner" in the Microsoft Artifact Registry: https://mcr.microsoft.com/en-us/catalog?search=mariner

  2. If I install it with tdnf install systemd -y, it doesn't work in the container due to this error:

    root [ / ]# systemctl
    System has not been booted with systemd as init system (PID 1). Can't operate.
    Failed to connect to bus: Host is down
  3. Here is a README inside the /etc/init.d folder of the core version saying systemd should be installed:

    
    root [ /etc/init.d ]# cat README
    You are looking for the traditional init scripts in /etc/rc.d/init.d,
    and they are gone?

Here's an explanation on what's going on:

You are running a systemd-based OS where traditional init scripts have been replaced by native systemd services files. Service files provide very similar functionality to init scripts. To make use of service files simply invoke "systemctl", which will output a list of all currently running services (and other units). Use "systemctl list-unit-files" to get a listing of all known unit files, including stopped, disabled and masked ones. Use "systemctl start foobar.service" and "systemctl stop foobar.service" to start or stop a service, respectively. For further details, please refer to systemctl(1).

Note that traditional init scripts continue to function on a systemd system. An init script /etc/rc.d/init.d/foobar is implicitly mapped into a service unit foobar.service during system initialization.

Thank you!

Further reading: man:systemctl(1) man:systemd(1) http://0pointer.de/blog/projects/systemd-for-admins-3.html https://www.freedesktop.org/wiki/Software/systemd/Incompatibilities


So, we can't use the alternative either. This makes this seem like a bug.