Interview Prep/Linux/Boot, time, cron and kernel

`systemctl` reports `System has not been booted with systemd as init system (PID 1). Can't operate.`

IntermediateTroubleshootingBoot, time, cron and kernel
Answer

Likely causes → You're inside a container, a chroot or WSL instance without systemd, where PID 1 is something else.

Diagnose →

ps -p 1 -o comm=
cat /proc/1/cgroup | head -3

Fix → In containers, run processes directly or use the image's entrypoint. In a chroot (rescue), use systemctl --root=/mnt/sysroot enable foo for offline changes. On WSL, enable systemd in /etc/wsl.conf ([boot] systemd=true).

Prevent → Don't rely on systemd in container images.

All Linux questions Roadmap: Linux

More on Boot, time, cron and kernel