Skip to content

Commit

Permalink
TIL: systemd mask / unmask service
Browse files Browse the repository at this point in the history
  • Loading branch information
pew committed Dec 26, 2024
1 parent e34859c commit 7bc9cc6
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions man/systemd.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
date created: Monday, April 22nd 2019, 6:51:17 pm
date modified: Sunday, September 8th 2024, 10:21:31 am
date modified: Thursday, December 26th 2024, 11:48:10 am
tags:
- systemd
- systemctl
Expand Down Expand Up @@ -230,32 +230,42 @@ journalctl -f -u your-name.service

### disable / mask service, prevent from starting & unmask

using *disable* stops the service from starting automatically, but it can be started manually. *mask* prevents the service from being started at all by creating a symlink to `/dev/null`
***disabling*** a service prevents it from being started automatically on boot but it can still be interacted with, or started by other services. ***masking*** a service means it can't even be started using systemd, it'll essentially create a symlink to `/dev/null`

#### mask / unmask services

**list masked services:**

```shell
systemctl list-unit-files | grep masked
```

**disable a service from starting automatically:**
**mask a service / prevent service from being started at all:**

it can be started manually, for example by NetworkManager
```shell
systemctl mask wpa_supplicant.service
```

the output will also tell you that the service has been linked to `/dev/null`:

```shell
systemctl disable wpa_supplicant.service
Created symlink /etc/systemd/system/wpa_supplicant.service → /dev/null.
```

**prevent service from being started at all:**
**unmask a service:**

```shell
systemctl mask wpa_supplicant.service
systemctl unmask bluetooth.service
```

the output will also tell you that the service has been linked to `/dev/null`:
#### disable a service

**disable a service from starting automatically:**

it can be started manually, for example by NetworkManager

```shell
Created symlink /etc/systemd/system/wpa_supplicant.service → /dev/null.
systemctl disable wpa_supplicant.service
```

### list active services
Expand Down

0 comments on commit 7bc9cc6

Please sign in to comment.