Installing Caddy in WSL: systemctl not supported

1. Caddy version (caddy version):


2. How I run Caddy:

a. System environment:

Windows 10 WSL Ubuntu 18.04

b. Command:


c. Service/unit/compose file:




3. The problem I’m having:

I am trying to install Caddy, following the directions here:

When trying to run:
sudo systemctl daemon-reload
sudo systemctl enable caddy
sudo systemctl start caddy

I get an error message (listed below).

What I want help with is how to substitute the systemctl command with service. More details in section 5.

4. Error messages and/or full log output:

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

5. What I already tried:

WSL does not support systemd. A possible solution is to upgrade my WSL to WSL2 (requiring me to sign up for Windows 10 Insider Preview Build, which I would like to avoid going to an unstable release for my main computer). With WSL2, this can be used:

If possible, what I would like to do is use service start to substitute systemctl.

I’ve seen examples online of this with docker, mongodb, postgresql, etc:

I’ve tried to replicate those examples with sudo service start caddy in /usr/bin/caddy with no luck. I get a start: unrecognized service error. To fix this error, I tried doing chmod -R 770 caddy and chgrp -R caddy caddy. It did not resolve the error:

6. Links to relevant resources:

Ultimately this isn’t really a question about Caddy but about WSL. I have WSL2 set up so I can’t really try anything to help.

Maybe something like supervisord works instead?

FYI the service command is just a shortcut layer to systemctl. I’m pretty sure it won’t work either as long as systemd isn’t used.

Did you use genie for your WSL2 setup? I’m willing to upgrade if it’s the simplest option.

I simply don’t run Caddy as a service inside WSL. I only use it debugging issues that people on these forums encounter. I use NSSM to run caddy.exe as a service on Windows.

You might not even need a process manager, you could just use the caddy start command which runs Caddy as a background process. You can run caddy stop to stop it, etc.

This topic was automatically closed after 30 days. New replies are no longer allowed.