How to stop named auto start

nexploration

New member
Joined
Oct 21, 2015
Messages
4
Hi,

I'm running Rocky Linux 8.
As I don't need the named service, I set

1. named=OFF in /usr/local/directadmin/data/admin/services.status
2. systemctl stop named
3. systemctl disable named
4. systemctl daemon-reload

according to https://docs.directadmin.com/other-...-to-run-dns-services-on-my-directadmin-server

The name service was stopped, but it start to run again every time I restart the server.

Is there anything else I missed? I was successful to stop dovecot, popb4smtp services with the above method.

Thank you very much for help.
 
remove "named" from that file /usr/local/directadmin/data/admin/services.status
 
maybe need restart directadmin ?

It must have Message Notice in directadmin panel when named down, so DA will tryied restart that service inside "services.status" file.

if not in list there, it should work now. for your issued.
 
What I do now is turn off named with the command
> systemctl stop named
> systemctl disable named
> systemctl daemon-reload
> systemctl restart directadmin

At this point the named is not running, but there is no message notice in directadmin panel.
Then I restart the server and check the running daemon with the comment
> netstate -tlup

the named daemon is on. So the issue still there..
 
ok try mask service to prevemt starting by other script

systemctl mask --now named

with this will symlink named service to "/dev/null"
 
Have you looked to see if it chrooted?

Code:
systemctl stop named
systemctl stop named-chroot
systemctl unmask --now named
systemctl unmask --now named-chroot
systemctl disable --now named
systemctl disable --now named-chroot
systemctl mask --now named
systemctl mask --now named-chroot


you also may need to unmask then change then mask again.

It is systemd protecting you

You allso may need this to
This will let DirectAdmin think that it's reloading named, while the script will actually do nothing.

With these changes, the DNS settings will still be made, but no program will be running to host them so they will have no effect.

If you're running on a systemd setup (CentOS 7), then there won't be an /etc/init.d/named file. It will be at:

/etc/systemd/system/named.service


or

/usr/lib/systemd/system/named.service


and you'd need to make its contents look like:

[Unit]
Description=Named Placebo
After=syslog.target network.target
Requires=network.target
Documentation=http://help.directadmin.com/item.php?id=25

[Service]
Type=oneshot
ExecStart=/usr/bin/echo -n ''


which should just run the "echo" command without displaying anything, and should return a zero result. You might also need to run:

systemctl daemon-reload


to reload the new named.service script.
 
Thanks for your suggestions.

> systemctl mask --now named
this is no effect, the /etc/systemd/system/named.service still exist after run the above command


and named-chroot is not enabled
> systemctl stop named-chroot
Failed to stop named-chroot.service: Unit named-chroot.service not loaded.


The content of /etc/systemd/system/named.service

[Unit]
Description=Berkeley Internet Name Domain (DNS)
Wants=nss-lookup.target
Wants=named-setup-rndc.service
Before=nss-lookup.target
After=named-setup-rndc.service
After=network.target

[Service]
Type=forking
Environment=NAMEDCONF=/etc/named.conf
EnvironmentFile=-/etc/sysconfig/named
Environment=KRB5_KTNAME=/etc/named.keytab
PIDFile=/run/named/named.pid

ExecStartPre=/bin/bash -c 'if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi'
ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} $OPTIONS
ExecReload=/bin/sh -c 'if /usr/sbin/rndc null > /dev/null 2>&1; then /usr/sbin/rndc reload; else /bin/kill -HUP $MAINPID; fi'

ExecStop=/bin/sh -c '/usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID'

PrivateTmp=true

[Install]
WantedBy=multi-user.target
 
Back
Top