My Arch Linux's systemd starts
rpcbind automatically. What do I have to do to stop
systemd to do this? There are no remote filesystems in
/etc/fstab. The only thing I found why rpcbind gets started is that is supposedly wanted by multi-user target but there is no service in the directory. How can I figure out why it is really started?
My Arch Linux's systemd starts
There is an open bug report on the Arch tracker.
Your best be would be to mask the service:
systemctl mask rpcbind.service
See Lennart Poettering's series of blog posts, systemd for Administrators, Part V for details on masking:
3. You can mask a service. This is like disabling a service, but on steroids. It not only makes sure that service is not started automatically anymore, but even ensures that a service cannot even be started manually anymore. This is a bit of a hidden feature in systemd, since it is not commonly useful and might be confusing the user. But here's how you do it:
By symlinking a service file to
$ ln -s /dev/null /etc/systemd/system/ntpd.service $ systemctl daemon-reload
/dev/nullyou tell systemd to never start the service in question and completely block its execution. Unit files stored in
/etc/systemd/systemoverride those from
/lib/systemd/systemthat carry the same name. The former directory is administrator territory, the latter terroritory of your package manager. By installing your symlink in
/etc/systemd/system/ntpd.serviceyou hence make sure that systemd will never read the upstream shipped service file
systemd will recognize units symlinked to
/dev/nulland show them as masked. If you try to start such a service manually (via systemctl start for example) this will fail with an error.
If there's no
wanted/rpcbind.service present it's most likely not being started directly but being started via socket activation. You can tell if that's how it was most recently started by looking for
indirect instead of
static in the
Loaded line of the status output (note that
systemctl automatically added the
.service to the unit name as it wasn't included on the command line):
$ systemctl status rpcbind ● rpcbind.service - RPC bind service Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor preset: enabled) Active: active (running) since Fri 2017-03-31 15:39:29 WIB; 37min ago Main PID: 6763 (rpcbind) CGroup: /system.slice/rpcbind.service └─6763 /sbin/rpcbind -w
Regardless, you can check to see if you have socket activation enabled:
$ systemctl status rpcbind.socket ● rpcbind.socket - RPCbind Server Activation Socket Loaded: loaded (/usr/lib/systemd/system/rpcbind.socket; disabled; vendor preset: enabled) Active: active (listening) since Fri 2017-03-31 15:39:29 WIB; 37min ago Listen: /var/run/rpcbind.sock (Stream) [::]:111 (Stream) 0.0.0.0:111 (Stream)
(In the example above I'd disabled the unit but not yet stopped the existing listener that starts
rpcbind when it receives a request.)
Executing the following should kill both and make sure they never start:
$ systemctl disable rpcbind.service rpcbind.socket $ systemctl stop rpcbind.service rpcbind.socket
A status check should then produce something along the lines of:
$ systemctl status rpcbind.service rpcbind.socket ● rpcbind.service - RPC bind service Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor preset: enabled) Active: inactive (dead) since Fri 2017-03-31 16:17:05 WIB; 49s ago Main PID: 6763 (code=exited, status=0/SUCCESS) [...log messages...] Mar 31 16:17:05 myhost systemd: Stopped RPC bind service. ● rpcbind.socket - RPCbind Server Activation Socket Loaded: loaded (/usr/lib/systemd/system/rpcbind.socket; disabled; vendor preset: enabled) Active: inactive (dead) since Fri 2017-03-31 16:17:48 WIB; 6s ago Listen: /var/run/rpcbind.sock (Stream) [::]:111 (Stream) 0.0.0.0:111 (Stream) [...log messages...] Mar 31 16:17:48 myhost systemd: Closed RPCbind Server Activation Socket. Mar 31 16:17:48 myhost systemd: Stopping RPCbind Server Activation Socket.
With systemd the way to stop services starting at boot is to use the
disable option, so in this instance you would use the command
systemctl disable rpcbind, below is an example of the output I see when running on my Fedora 20 system;
chris::test::07:08:29-> sudo systemctl disable rpcbind rm '/etc/systemd/system/multi-user.target.wants/rpcbind.service' rm '/etc/systemd/system/sockets.target.wants/rpcbind.socket'