Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

/etc/hosts works but gets overwritten every boot

On my system (10.6.8) I can edit /etc/hosts and the changes take effect immediately. The problem is that every time I reboot, my changes are overwritten. Does anyone know what could cause this? BTW this is the exact same unsolved issue found in this dead archived thread.

iMac 27" i7 Quad Core 2.8Ghz, Mac OS X (10.6.2)

Posted on Feb 8, 2012 10:06 PM

Reply
8 replies

Feb 9, 2012 1:03 AM in response to X423424X

"servy" is a computer on my lan that uses DHCP and registers its name with my router which serves DNS. If I comment out the line for "servy" in my hosts file, it immediately takes effect and I can successfully ping it, or lookup its address with "dscacheutil -q host -a name servy", but as soon as I reboot, the /etc/hosts file no longer has the comment in that line. It's like there's a "last known good" copy of the hosts file somewhere and OSX or some service is restoring it every boot.


timac:~ tim$ cat /etc/hosts

##

# Host Database

#

# localhost is used to configure the loopback interface

# when the system is booting. Do not change this entry.

##

127.0.0.1 localhost

255.255.255.255 broadcasthost

::1 localhost

fe80::1%lo0 localhost

192.168.2.100 servy


timac:~ tim$ ls -la ~/Library/LaunchAgents/

total 32

drwx------ 6 tim staff 204 Nov 13 19:22 .

drwx------+ 42 tim staff 1428 Dec 6 21:21 ..

-rw-r--r-- 1 tim staff 892 Nov 13 2009 com.apple.CSConfigDotMacCert-timblaktu@me.com-SharedServices.Agent.plist

-rw-r--r-- 1 tim staff 425 Nov 13 19:22 com.apple.FolderActions.enabled.plist

-rw-r--r-- 1 tim staff 517 Nov 13 19:22 com.apple.FolderActions.folders.plist

-rw-r--r-- 1 tim staff 677 Oct 22 17:06 org.virtualbox.vboxwebsrv.plist

timac:~ tim$ ls -la /Library/LaunchAgents/

total 16

drwxr-xr-x 4 root wheel 136 Jan 9 12:31 .

drwxrwxr-t+ 56 root admin 1904 Mar 5 2010 ..

-rw-r--r-- 1 root wheel 635 Sep 9 09:04 com.cisco.anyconnect.gui.plist

-rw-r--r-- 1 root wheel 786 Jul 10 2011 com.google.keystone.agent.plist

timac:~ tim$ ls -la /Library/LaunchDaemons/

total 24

drwxr-xr-x 6 root wheel 204 Jan 9 12:31 .

drwxrwxr-t+ 56 root admin 1904 Mar 5 2010 ..

-rw-r--r-- 1 root wheel 485 Aug 31 2009 com.DuetDaemon.plist

-rw-r--r-- 1 root wheel 669 Feb 17 2011 com.apple.third_party_32b_kext_logger.plist

-rw-r--r-- 1 root wheel 562 Sep 9 09:04 com.cisco.anyconnect.vpnagentd.plist

-rw-r--r-- 1 root wheel 790 Jul 10 2011 com.google.keystone.daemon.plist

timac:~ tim$ ls -la /Library/StartupItems/

total 0

drwxr-xr-x 4 root wheel 136 Dec 31 2010 .

drwxrwxr-t+ 56 root admin 1904 Mar 5 2010 ..

drwxr-xr-x 5 root wheel 170 Jan 10 09:23 VirtualBox

drwxr-xr-x 4 root wheel 136 Mar 7 2010 rEFItBlesser

Feb 9, 2012 1:21 AM in response to timblaktu

Just so I understand. You comment out the servy line in hosts. You reboot. The line is still there but no longer commented out? Or is the line missing entirely.


You didn't list the login items.


As an experiment, before seeing if any of these startup items may be the cause, reboot in safe mode. All of these will be be suppressed. See if hosts is modified under the safe boot.

Feb 9, 2012 8:38 AM in response to X423424X

Thanks! Cisco AnyConnect VPN client overwrites /etc/hosts with /etc/hosts.ac every boot. Problem solved. I guess I only looked through 40 or so hits on "/etc/hosts overwritten on reboot". Should have been more persistent or creative with my search terms. I guess I gave up after finding someone with the exact same problem here on apple discussions that went unsolved (link in my OP). Thanks again!

Apr 6, 2016 7:20 AM in response to Bernhard Ammann

Your problem, hardware or software, may not be exactly the same as that of the original poster of this older thread, and it can be very confusing for everybody if we try to answer more than one question in each thread, which can also result in you applying the wrong advice to your particular problem.


In order for us to give your problem our proper attention to try to solve it, would you kindly start your own thread, describing the trouble you are having in the fullest detail, including completing your details to show what Mac or iDevice you are using, what operating system, and what version of the application in question. Please remember to post in the forum relevant to your hardware or version of OS X. A full list of all the support forums is here:


http://discussions.apple.com/index.jspa

/etc/hosts works but gets overwritten every boot

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.