How do you permanently disable a default configuration in a systemd unit file?
Issue
It is necessary to permanently disable a default systemd configuration for a specific unit file.
For example in the rpcbind service comes with IPv6 configuration enabled by default:
# cat /usr/lib/systemd/system/rpcbind.service
[Unit]
Description=RPC bind service
DefaultDependencies=no
# Make sure we use the IP addresses listed for
# rpcbind.socket, no matter how this unit is started.
Wants=rpcbind.socket
After=rpcbind.socket
After=systemd-tmpfiles-setup.service
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/rpcbind
ExecStart=/sbin/rpcbind -w $RPCBIND_ARGS
# cat usr/lib/systemd/system/rpcbind.socket
[Unit]
Description=RPCbind Server Activation Socket
[Socket]
ListenStream=/var/run/rpcbind.sock
ListenStream=[::]:111 <-------------
ListenStream=0.0.0.0:111
BindIPv6Only=ipv6-only <------------
[Install]
WantedBy=sockets.target
It is possible to manually remove those lines, but they will be back upon update. How do we remove them permanently?
Environment
Red Hat Enterprise Linux 7
Systemd
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.