# Enable systemd in WSL

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/)
- [Configure and run WSL with various Linux distributions](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/setup/)
- [Run graphical Linux applications](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/wslg/)
- [Enable systemd in WSL](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/systemd/)
- [Use SSH to connect to WSL](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/ssh/)
- [Connect to WSL using RDP and VNC](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/rdp/)
- [Developing with VS Code on WSL](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/vscode/)
- [Import file systems into WSL](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/import/)
- [Backup a WSL filesystem](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/backup/)
- [Next Steps](https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/_next-steps/)

You can enable `systemd` in Linux distributions such as Ubuntu.

When you enable `systemd`, services such as SSH and docker will start automatically.

Use a text editor (as root or using `sudo`) to create (or modify if it exists) the file `/etc/wsl.conf`

Add the following lines to `/etc/wsl.conf`:

```
[boot]
systemd=true
```

Open a Windows Command Prompt or PowerShell. Run the following commands to terminate and restart the distribution:

```
wsl --terminate Ubuntu-22.04
wsl -d Ubuntu-22.04
```

Confirm `systemd` is running:

```
systemctl list-unit-files --type=service
```

Individual services can also be queried to confirm they are running:

```
systemctl status cron
```
