How do i make sure a service does not start automatically or manually on systemd?



  • You can mask the service.

    mask NAME...
    Mask one or more unit files, as specified on the command line. This will link these units
    to /dev/null, making it impossible to start them. This is a stronger version of disable,
    since it prohibits all kinds of activation of the unit, including enablement and manual
    activation. Use this option with care. This honors the --runtime option to only mask
    temporarily until the next reboot of the system. The --now option can be used to ensure
    that the units are also stopped.

    $ sudo systemctl mask snapd.service 
    Created symlink from /etc/systemd/system/snapd.service to /dev/null.
    

    Now the even manually trying an action with this service will not be allowed, until it is unmasked.

    $ sudo systemctl restart snapd.service 
    Failed to restart snapd.service: Unit snapd.service is masked.
    

Log in to reply
 

© Lightnetics 2024