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?
3 Answers
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/null
you tell systemd to never start the service in question and completely block its execution. Unit files stored in/etc/systemd/system
override those from/lib/systemd/system
that 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.service
you hence make sure that systemd will never read the upstream shipped service file/lib/systemd/system/ntpd.service
.
systemd will recognize units symlinked to/dev/null
and show them as masked. If you try to start such a service manually (via systemctl start for example) this will fail with an error.
-
Thank you that is an option but I'd like to know why it is started in the first place. I didn't enable it and none of the nfs services are running by default.– DavidDec 27, 2014 at 7:53
-
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[1]: 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[1]: Closed RPCbind Server Activation Socket.
Mar 31 16:17:48 myhost systemd[1]: 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'
-
Thx, but the service is disabled. There is not even a directory /etc/systemd/system/sockets.target.wants on my machine and no rpcbind.service in multi-user.target.wants.– DavidDec 27, 2014 at 7:14
-
Then I don't think the service is being started by systemd, it may be that another service is starting rpcbind. You could try looking at
systemctl list-unit-files --type=service
which will show all services with systemctl. Dec 27, 2014 at 7:17 -
-
Are you actually using NFS? If not then all of the following services may be affecting it/starting rpcbind;
nfs-config
,rpc-statd
&nfs-server
. Dec 27, 2014 at 7:34 -
In fact I've just seen @jasonwryan's response, that looks like a better option :). Dec 27, 2014 at 7:34