To flush DNS cache in Tumbleweed , I used to type:
sudo systemctl restart nscd.service
but see that this doesn’t work anymore. ![]()
Failed to restart nscd.service: Unit nscd.service not found.
Can anyone suggest a replacement?
To flush DNS cache in Tumbleweed , I used to type:
sudo systemctl restart nscd.service
but see that this doesn’t work anymore. ![]()
Failed to restart nscd.service: Unit nscd.service not found.
Can anyone suggest a replacement?
Replaced by systemd-resolved ?
I am not using Tumbleweed but Leap 15.6 and nscdis running here. Thus this info is only from doing some research.
Reading man systemd-resolved, I ended up in man resolvectl where I see the command
flush-caches
Flushes all DNS resource record caches the service maintains locally. This is mostly equivalent to sending the SIGUSR2 to the systemd-resolved service.
HTH.
Thanks for the reply, hcvv. Systemd-resolved is available from the main repository, but I’m leery of installing it if I can use another command to do what restart nscd.service did before.
Well, it seems that my idea that nscd was replaced by systemd-resolvd is incorrect.
You have both not installed?
I assume you have to find out what replaced nscd with respect to DNS cashing.
@Tuner nscd was dropped from Tumbleweed a year ago? If you need to clear the cache then AFAIK it’s systemd-resolved and use resolvectl.
Please be aware that yet another Name Service Caching Daemon is probably lurking in your system:
> rpm --query --whatprovides /usr/lib/systemd/system/dnsmasq.service
dnsmasq-2.90-160000.2.2.x86_64
> rpm --query --whatrequires dnsmasq
NetworkManager-dns-dnsmasq-1.0-bp160.1.7.noarch
libvirt-daemon-driver-network-11.4.0-160000.3.1.x86_64
>
> systemctl list-unit-files | grep -Ei 'UNIT FILE|dnsmasq'
UNIT FILE STATE PRESET
dnsmasq.service disabled disabled
605 unit files listed.
>
But, I’m not suggesting that, you should use “dnsmasq”.
There were good reasons for deprecating “nscd” and, there are investigations which show that, DNS caching is not really needed and, may well be counter-productive with modern Linux systems and networking devices.
Thanks for the additional feedback, malcolmlewis and dcurtisfra.
Dcurtisfra, it turns out I DO have dnsmasq installed, and this site:
https://www.baeldung.com/linux/dns-cache-local-flushing
helped me find that the cache size is 150.
(Via $ grep "cache-size" /etc/dnsmasq.conf)
So, I’ve changed my batch file to flush DNS to:
sudo systemctl restart dnsmasq
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.