azurelinux icon indicating copy to clipboard operation
azurelinux copied to clipboard

Missing feature systemd/systemctl?

Open TheOnlyWei opened this issue 1 year ago • 3 comments

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.

TheOnlyWei avatar Jul 19 '24 07:07 TheOnlyWei

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

elsaco avatar Jul 19 '24 17:07 elsaco

@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
  1. 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.

TheOnlyWei avatar Jul 19 '24 21:07 TheOnlyWei

@TheOnlyWei this is a late reply, but systemd is not available, and generally not needed/recommended in containers. To use systemctl command in Azure Linux, you can follow this quick start guide to create a VM on Hyper-V. Then you can use systemctl to manage services.

trungams avatar Sep 19 '24 01:09 trungams

some light github necromancy and clean-up.

@trungams is correct. Using systemd in a container is not recommended except in very specific edge cases.

jperrin avatar Dec 14 '24 00:12 jperrin