System->Admin->Networking Change hostname trashes hosts file

Bug #103960 reported by Dave M
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GST
Won't Fix
Wishlist
gnome-system-tools (Ubuntu)
Confirmed
Medium
Ubuntu Desktop Bugs

Bug Description

System->Admin->Networking Change hostname trashes hosts file

I am using Ubuntu v6.06 (dapper). I have a large hosts file (over 5k entries, most pointing to 127.0.0.1) that I use to block unwanted sites.

When I used System->Admin->Networking to change my host name it took a long time to complete. Then I could no longer use sudo or any System->Admin menu items. If I run sudo (from the console) I get the error "sudo: unable to lookup Ubuntu via gethostbyname()" ("Ubuntu" is my new host name). Looking at the bad (after changing hostname) and good (before changing hostname) /etc/hosts files I see:

-begin bad hosts file---------------------------------------------------------------------------------------------------
# localhost: Needs to stay like this to work -------------------
127.0.0.1 localhost pop3.norton.antivirus pop3.spa.norton.antivirus 07.moosq.com 1.httpdads.com 102.112.2o7.net 112.2o7.net 123banners.com 12greatsoft.biz 15.moosq.com 17greatsoft.biz 193.125.201.50 2.idsbi.com 203.geekpost.com 206.161.200.105 207-87-18-203.wsmg.digex.net 209.66.114.130 216.200.3.32 22469.com 2366.pinoycentral.com 239.255.255.250 247realmedia.com 2o7.net 3.adbrite.com 334es5s.com 3wisp.com 4.idsbi.com 64.124.45.181 66.250.130.194 66.40.16.131 85.spylog.com a.about.com a.as-eu.falkag.net a.boom.ro a.mktw.net a.tribalfusion.com a.tribalfusion.com a.websponsors.com a.youlllovethisdatingsite.com a1.interclick.com a1040.g.akamai.net a1066.g.akamai.net a207.p.f.qz3.net a3.suntimes.com a408.g.akamai.net aaafreexxx.com aavalue.com abc.com-yahoo.com ablt.com abril.ad.uol.com.br abscbn.spinbox.net Absolute.ONTWOHGFJ.COM acces-direct.net accipiter.speedera.net accipiter.speedera.net/sbc-images.adbureau.net/sbc accountservices.passport.net accusal.qwwx4d.com acesseattle.com actionsplash.com actuating.org acvspgbrpgsjr.adware-business.com acxiom.com ad.abcnews.com ad.aboutwebservices.com ad.adition.net ad.adlegend.com ad.admarketplace.net ad.adnetwork.com.br ad.adsmart.net ad.adtraffic.com ad.adtraq.com ad.adultcheck.com ad.advisor.com ad.aftonbladet.se ad.atlas.cz ad.au.doubleclick.net ad.bannerpoint.ru ad.be.doubleclick.net ad.blm.net ad.boardhost.com ad.ca.doubleclick.net ad.candybar.co.kr ad.ch.doubleclick.net ad.cn.doubleclick.net ad.crosswalk.com ad.de.doubleclick.net ad.deviantart.com ad.dialpad.com ad.dk.doubleclick.net ad.dogpile.com ad.doubleclick.com ad.doubleclick.net ad.doubleclick.net ad.erektor.ru ad.es.doubleclick.net ad.espn.starwave.com ad.fr.advertissimo.net ad.fr.doubleclick.net ad.free6.com ad.harmony-central.com ad.hinet.net ad.hk.doubleclick.net ad.horvitznewspapers.net ad.howstuffworks.com ad.img.yahoo.co.kr ad.inetfast.com ad.infoseek.com ad.it.doubleclick.net ad.itmedia.co.jp ad.iwin.com ad.jamster.com ad.jp.doubleclick.net ad.kimo.com.tw ad.kr.doubleclick.net ad.linkexc
 Ubuntu

# The following lines are desirable for IPv6 capable hosts
ff00::0 ip6-mcastprefix

#####################################################################
# The Hosts File Project http://hostsfile.mine.nu
# Global Advert Servers Blocklist - Personal Edition
#####################################################################
# Release 13/07/2006
# Servers Verified as up and running 04/03/2006 (by dns resolving)
# Updated sorted and maintained by Andrew Short (sh0rtie)
# Contact: <email address hidden>
######################################################################
# You must keep the below lines
######################################################################

#127.0.0.1 images.ibsys.com

#Daves Bad sites 070223
-end bad hosts file-----------------------------------------------------------------------------------------------------

-begin good hosts file---------------------------------------------------------------------------------------------------
# localhost: Needs to stay like this to work -------------------
127.0.0.1 localhost
127.0.1.1 davem-ubuntu

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

#####################################################################
# The Hosts File Project http://hostsfile.mine.nu
# Global Advert Servers Blocklist - Personal Edition
#####################################################################
# Release 13/07/2006
# Servers Verified as up and running 04/03/2006 (by dns resolving)
# Updated sorted and maintained by Andrew Short (sh0rtie)
# Contact: <email address hidden>
######################################################################
# You must keep the below lines
127.0.0.1 pop3.norton.antivirus
127.0.0.1 pop3.spa.norton.antivirus
######################################################################

127.0.0.1 07.moosq.com
127.0.0.1 1.httpdads.com
127.0.0.1 102.112.2o7.net
127.0.0.1 112.2o7.net
127.0.0.1 123banners.com
127.0.0.1 12greatsoft.biz
............................continues for over 5K lines..........
-end good hosts file-----------------------------------------------------------------------------------------------------

Fortunately I had an old copy of my hosts file. I went into recovery mode and restored the file, edited it manually and all seems well.

Tags: dapper
Revision history for this message
Dave M (davem-mich) wrote :

Attached is the full hosts file that caused the problem.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug

Changed in gnome-system-tools:
assignee: nobody → desktop-bugs
importance: Undecided → Medium
Revision history for this message
Andres Herrera (andresh) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. The issue that you reported is one that should be reproducible with the live environment of the Desktop CD of the development release - Hardy Heron. It would help us greatly if you could test with it so we can work on getting it fixed in the next release of Ubuntu. You can find out more about the development release at [WWW] http://www.ubuntu.com/testing/ . Thanks again and we appreciate your help.

Andres Herrera (andresh)
Changed in gnome-system-tools:
status: New → Incomplete
Revision history for this message
Pedro Villavicencio (pedro) wrote :

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!.

Changed in gnome-system-tools:
status: Incomplete → Invalid
Revision history for this message
Fibonacci (fibonacci-prower) wrote :

Whenever one opens network-admin, and then clicks on the "Host" tab, all entries on /etc/hosts are lumped into as few lines as possible, causing problems such as bug 386791.

To reproduce:
1- Create or download a long /etc/hosts file, with many entries pointing to the same IP (adblocking files are good for that purpose).
2- Run network-admin *as root*, and click on the Hosts tab. You don't need to actually make any change.
3- Close network-admin.

What I expect to happen:
/etc/hosts has not changed.

What really does happen:
All entries on /etc/hosts that point to the same IP are now in the same line, thus creating extremely long lines, and segfaults in getaddrinfo.

It's surprising to see that after 2+ years, this has still not been fixed.

Changed in gnome-system-tools (Ubuntu):
status: Invalid → New
Revision history for this message
Fibonacci (fibonacci-prower) wrote :

Just realised I could confirm it myself...

Changed in gnome-system-tools (Ubuntu):
status: New → Confirmed
Revision history for this message
Fibonacci (fibonacci-prower) wrote :

Has there been any progress on this bug?

Revision history for this message
Adam Niedling (krychek) wrote :

Which versions of Ubuntu are still affected by this bug? I checked 10.04 and 12.04 and I can't even find a way to change the hostname in them. (At least there is no System->Admin->Networking)

Revision history for this message
Milan Bouchet-Valat (nalimilan) wrote :

Of course, you need to install gnome-network-admin, and it's been that way for ages.

Revision history for this message
Vadim Rutkovsky (roignac) wrote :

Can't reproduce this in gnome-network-admin 3.0.0-2ubuntu1 using hosts file from comment #1
Could somebidy affected by this try to reproduce this in Precise or Oneiric?

Changed in gst:
importance: Undecided → Unknown
status: New → Unknown
Changed in gst:
importance: Unknown → Wishlist
status: Unknown → New
Changed in gst:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.