You are not logged in.

#1 2020-02-07 14:30:16

early_adopter
Member
Registered: 2011-03-30
Posts: 27

Why does systemctl status not show the wg-quick service?

I have a running wg-quick service. When I do a

systemctl status wg-quick@name-name.service

it confirms that it's active. However when I do a

systemctl status

it does not include wg-quick in the listing. Why is that?

Offline

#2 2020-02-07 14:49:28

zaxmyth
Member
From: Seattle / San Francisco
Registered: 2019-03-25
Posts: 25
Website

Re: Why does systemctl status not show the wg-quick service?

If you look carefully at the output of

systemctl status wg-quick@name-name.service

you'll notice that it says "Active: active (exited)"  This is because the wg-quick@ service is a "oneshot" service meaning it just fires once and exits. You can see the contents of the service unit by running

systemctl cat wg-quick@name-name.service

where you can see something like this

...
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/wg-quick up %i
ExecStop=/usr/bin/wg-quick down %i
Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity

You'll also notice that it has "RemainAfterExit=yes" and this will make it continue to show as active even though it has finished running. This is so that you can have other services start after wg-quick@ starts. You can read more about this is the man page.

The output of

systemctl status

is only showing running services.

Hopefully that helps!

Last edited by zaxmyth (2020-02-07 14:54:39)

Offline

#3 2020-02-07 15:23:11

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: Why does systemctl status not show the wg-quick service?

zaxmyth wrote:
systemctl status

is only showing running services.

It does not shows services, but cgroups and processes running in those cgroups. systemd creates a control group for each service which automatically disappears when the service has no running processes.

To get services and other units, give no option or use

systemctl list-units

If you want a representation of the dependency tree, then use

systemctl list-dependencies

Last edited by progandy (2020-02-07 15:24:50)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#4 2020-02-09 14:14:45

early_adopter
Member
Registered: 2011-03-30
Posts: 27

Re: Why does systemctl status not show the wg-quick service?

Thanks for your kind answers, @zaxmyth and @progandy

Offline

#5 2020-02-09 14:46:41

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Why does systemctl status not show the wg-quick service?

Please remember to mark your thread [SOLVED] (edit the title of your first post).

Offline

Board footer

Powered by FluxBB