DEV Community

iapilgrim
iapilgrim

Posted on

How to Permanently Disable a systemd Service on Ubuntu

Sometimes you install software that registers itself as a systemd service and starts automatically at boot. If you don’t want it running anymore, you can disable or even mask it so it never starts again. Here’s a step-by-step guide using vllm.service as an example.


Step 1: Stop the Service Immediately

First, stop the service if it’s currently running:

sudo systemctl stop vllm.service
Enter fullscreen mode Exit fullscreen mode

Step 2: Disable the Service at Boot

Prevent the service from starting automatically on reboot:

sudo systemctl disable vllm.service
Enter fullscreen mode Exit fullscreen mode

This removes the symlink from the systemd startup sequence.


Step 3: Mask the Service (Optional but Stronger)

Masking a service ensures it cannot be started manually or by another dependency.

If the unit file already exists in /etc/systemd/system/, you’ll need to rename or remove it before masking:

sudo mv /etc/systemd/system/vllm.service /etc/systemd/system/vllm.service.backup
sudo systemctl daemon-reload
sudo systemctl mask vllm.service
Enter fullscreen mode Exit fullscreen mode

Step 4: Verify the Status

Check whether the service is disabled or masked:

systemctl is-enabled vllm.service
systemctl status vllm.service
Enter fullscreen mode Exit fullscreen mode
  • disabled → won’t start at boot
  • masked → cannot be started at all

Step 5: (Optional) Re-enable Later

If you change your mind, simply unmask and re-enable:

sudo systemctl unmask vllm.service
sudo systemctl enable vllm.service
Enter fullscreen mode Exit fullscreen mode

Final Thoughts

  • Disable if you just don’t want it auto-starting.
  • Mask if you want to block it completely.
  • Remove the unit file if you’re sure you’ll never use it again.

This approach ensures the service stays off permanently, even after rebooting.

Top comments (0)