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

**Code:** `System has not been booted with systemd` · **Category:** Linux · **Seen on:** Linux

You ran systemctl inside an environment without systemd as PID 1 — a Docker container or older WSL.

## Meaning

Containers run your app as PID 1, not systemd, and WSL only enables systemd when configured. Start the service directly (service nginx start, or run the binary) or enable systemd in WSL.

## Common causes

- Running systemctl inside a Docker container
- WSL without systemd enabled
- chroot/rescue environments

## Quick fix

1. In containers, run the process directly in the foreground (CMD)
2. Use service <name> start where SysV scripts exist
3. On WSL, enable systemd in /etc/wsl.conf and restart WSL

## Detailed fix by platform

### WSL

1. 

```bash
# /etc/wsl.conf
[boot]
systemd=true
# then in PowerShell: wsl --shutdown
```


### Docker

1. `CMD ["nginx", "-g", "daemon off;"]`

## How to diagnose

1. **PID 1** — ps -p 1 -o comm=
2. **Environment** — Container, WSL or VM?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/linux/system-not-booted-with-systemd)
