Rebooting system resets /etc/hosts

since upgrade to suse 11.3 every time I reboot pc the file /etc/hosts is reset to default value. I am a web developer so I need to put in there my aliases for It is annoying to do it again and again. Luckily, I don’t restart my system very often but still I would like to avoid that.

What should I do to stop this resetting? Or is there another place in 11.3 where should I put my entries?

What are the contents of the file?

# hosts         This file describes a number of hostname-to-address
#               mappings for the TCP/IP subsystem.  It is mostly
#               used at boot time, when no name servers are running.
#               On small systems, this file can be used instead of a
#               "named" name server.
# Syntax:
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#       localhost.localdomain   localhost

# special IPv6 addresses
::1             localhost ipv6-localhost ipv6-loopback

fe00::0         ipv6-localnet

ff00::0         ipv6-mcastprefix
ff02::1         ipv6-allnodes
ff02::2         ipv6-allrouters
ff02::3         ipv6-allhosts       redBook.redBook redBook

This is the default value. However I want to change the line starting to something like…       localhost.localdomain   localhost myweb1 myweb2 myweb2

…but it disappears every time I reboot the system.

Not sure what’s doing that, may depend on your network settings, but you can work around it by binding those names for another loopback address, like this: myweb1 myweb2 myweb3

In fact you can see an example of that in the file you posted. All the 2^24-2 addresses in are equally good for a loopback address.

Hello tobice,

Have you checked if “Change hostname via DHCP” is set in YaST?

Go to YaST – Network Settings – Hosname/DNS tab and see if the above settings box is ticked.

If it is then hopefully unchecking it will stop the problem.

Worth a try.



And I would do it again by editing /etc/hosts? You think that if I put the names just on another line it won’t disappear? I don’t see any reason :slight_smile:

Unfortunately I am uploading some big stuff on the net so I won’t be able to restart my system and try it in the next few hours.

It has been already unchecked so this not the cause of this problem however thanks for the idea :slight_smile:

It may be netconfig that’s regenerating the lines so you may have to change it in YaST, and define an alias rather than change the localhost entry. I use ifup so I have control over /etc/hosts. Also things may have changed in 11.3, I’m still on 11.2 on this machine.

Where should I look for netconfig in Yast? I have openSuse in Czech language so the names are a little bit different. Btw I am using networkmanager for network configuration so there also might be a problem. However in 11.2 it worked nicely even with NM so something has changed probably.

YaST > Network Devices > Network Settings probably.

Weird, I really don’t know why, but it DOES work! I used instead of and it doesn’t get removed after reboot. So thank you, problem solved :slight_smile: