You are not logged in.

#1 2012-08-30 03:42:18

archtaku
Member
Registered: 2010-07-02
Posts: 84

systemd "static" unit file state

So, I booted into systemd for the first time today and have been poking around a bit trying to learn. I ran systemctl list-unit-files and noticed that a significant amount of them had a state of "static", rather than "enabled" or "disabled". I looked in the manpages for systemd and systemctl, as well as doing several different web searches, but haven't found an explanation of what "static" means in this context. Can anyone help shed some light on this.

Offline

#2 2012-08-30 09:03:55

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 748

Re: systemd "static" unit file state

Basically it means, that you can't disable those services. You can either manually remove relevant symlinks from /usr/lib/systemd/system/, or you can mask those services - systemd will ignore them even though they are statically enabled.

[1] http://permalink.gmane.org/gmane.comp.s … devel/4927

Offline

#3 2012-08-30 15:22:06

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: systemd "static" unit file state

In particular, "static" means "enabled because something else wants it". Think by analogy to pacman's package install reasons:

enabled :: explicitly installed
static :: installed as dependency
disabled :: not installed

Offline

#4 2012-08-30 15:52:08

archtaku
Member
Registered: 2010-07-02
Posts: 84

Re: systemd "static" unit file state

Fantastic, thanks. I had already guessed this was the case (unable to disable, pulled in as dependency) but couldn't find any confirming/dis-confirming information online.

Offline

#5 2012-11-14 21:46:23

netsuso
Member
Registered: 2012-11-14
Posts: 1

Re: systemd "static" unit file state

Just in case someone falls here (as me) and gets confused about this post... smile

Static units are those which cannot be enabled/disabled, but it doesn't mean they are always executed. They will only if another unit depends on them, or if they are manually started.

Actually, static units are simply those without an [Install] section. As enabling units means just creating a symlink to wherever [Install] mandates, those units without [Install] section cannot be enabled, as systemctl doesn't know where to place the symlink.

Of course, you can still manually create a symlink from a static unit to (for instance) /etc/systemd/system/multi-user.target.wants/, and it will be executed as any other enabled unit. But I suppose static units are not intended to be enabled in that way, and most probably you shouldn't need to do it wink

Offline

#6 2012-11-14 21:49:24

archtaku
Member
Registered: 2010-07-02
Posts: 84

Re: systemd "static" unit file state

I did not know that distinction, thanks!

Offline

#7 2020-02-22 15:35:53

bzhao
Member
Registered: 2015-10-31
Posts: 11

Re: systemd "static" unit file state

good posts!

Offline

#8 2020-02-22 15:47:49

bzhao
Member
Registered: 2015-10-31
Posts: 11

Re: systemd "static" unit file state

you can list them all by:
systemctl list-unit-files --state=static

Offline

#9 2020-02-22 17:20:03

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: systemd "static" unit file state

Using this opportunity to close this very old thread.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB