[systemd-devel] CentOS 7 system using abstract namespace socket for notifications

Lennart Poettering lennart at poettering.net
Mon Jun 6 20:16:23 UTC 2016


On Sun, 05.06.16 04:49, Dennis Jacobfeuerborn (dennisml at conversis.de) wrote:

> Hi,
> I'm trying to make my javascript application compatible with the systemd
> service notification mechanism but currently have the problem that while
> everything works fine on my Fedora 22 system this is not the case when I
> run the same code on a CentOS 7 system.
> 
> I tracked this down to the fact that on the Fedora system a filesystem
> socket is used but on the CentOS 7 an abstract namespace socket with the
> name "@/org/freedesktop/systemd1/notify" is used which requires
> different handling.
> 
> I have two questions:
> 1) Why are the two systems using different types of sockets?

We used the abstract namespace socket in older systemd
versions. However, it's problematic in containers that do not use
network namespacing, as that socket on the host will conflict with the
same socket in any container, if systemd is running there too. (This
is because abstract namespace sockets are subject to network
namespacing, while file system sockets are subject to file system
namespacing. And all container managers apply the latter, but only
some the former.)

> 2) Is this configurable? If so how and if not what other way is there to
> test my service with abstract namespace notification sockets on my
> development machine?

No. This is not configurable, and it shouldn't be hardcoded anyway, as
it might be completely random, and subject to change. In fact, it's
not only different in various systemd versions but also depending on
whether you are run as --user or --system instance. Use $NOTIFY_SOCKET
to figure out what the socket for you is. And when putting together
the sockaddr_un simply replace an "@" as first char of the value by a
NUL byte, which tells Linux that this is an abstract namespace socket.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list