[systemd-devel] Is it intentional that "systemctl cat" outputs "# /dev/null" for a masked unit?

Lennart Poettering lennart at poettering.net
Tue Feb 2 14:57:51 UTC 2021


On Di, 02.02.21 10:34, Ulrich Windl (Ulrich.Windl at rz.uni-regensburg.de) wrote:

> Well,
>
> the subject says it all: I had masked a socket unit and the related non-socket-unit failed to start.
> Trying to see the definition of the unit with "systemctl cat" I only saw "# /dev/null".
> Is that intended? "systemctl show" still shows a lot of data...
>
> My idea was when "unmask" knows how to get the unit, why shouldn't "cat" be able to, too?

Well, the idea is that "systemctl cat" presents what PID 1 would
see. When a unit file is masked, it overlayed with a symlink to
/dev/null typically, that's what you see hence.

"systemctl show" will show you only default values in this case, and
stuff that other units applied onto the masked unit (i.e. the other
end of deps and such). It will not show you anything that is from the
unit file that is masked. Which is kinda the point of masking: hiding
away the original unit file, and making sure systemd (or systemctl
cat) won't use them for anything.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list