WSL2 Error - "System has not been booted with systemd as init system (PID 1). Can't operate."

25 Feb 2022, 3:18 p.m.
01:20 minutes

This article demonstrates how to fix the error "System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down" when using WSL version 2.

    This article demonstrates how to fix the error “System has not been booted with systemd as init system (PID 1). Can’t operate. Failed to connect to bus: Host is down” when using WSL version 2.

    The error message

    This example is done using WSL 2 with a Linux-based application.

    The below error message is displayed:

    System has not been booted with systemd as init system (PID 1). Can't operate.
    Failed to connect to bus: Host is down
    

    How to fix it

    To fix, operate the service using /etc/init.d/ instead:

    sudo /etc/init.d/<service> <operation>
    

    Where the operation is start, status, stop, restart, etc and service is the service you need to operate.

    For example, to start postgresql, this command looks like:

    sudo /etc/init.d/postgresql start
    

    Why this error occurs

    At the time of this article, WSL 2 does not support the systemd command. To work around this, /etc/init.d is used.

    Example

    The below screen capture displays running into the error when attempting to enable the postgresql service.

    The below screen capture displays a workaround to start postgresql using /etc/init.d instead.

    The below screen capture displays that the service was successfully started via the status operation.

    Captcha: What's the standard TCP port of the following service?

    captcha

    0 comments