LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-18-2005, 09:32 PM   #1
jindo
LQ Newbie
 
Registered: Jul 2005
Location: VietNam
Posts: 11

Rep: Reputation: 0
Help me: slowly booting when adding an entry in /etc/hosts


Hi,
when I add an entry in the /etc/hosts, such as:
192.168.1.15 firefly
my FC4 box will boot slowly. It seems stopping at: "Enabling swap space:.....". I don't know how to fix this problem. Can you help me?
 
Old 09-19-2005, 02:51 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
there's just no way at all these two things could have anything in common... what else did you touch?
 
Old 09-19-2005, 02:54 AM   #3
roopunix
Member
 
Registered: Feb 2004
Location: Kathmandu
Distribution: Redhat/fedora/Suse [Wanna Drive With Debian]
Posts: 208

Rep: Reputation: 30
check to see if you have any swap partition .

#df -h
#fdisk -l

if no delete the swap entry from /etc/fstab
 
Old 09-19-2005, 04:01 AM   #4
jindo
LQ Newbie
 
Registered: Jul 2005
Location: VietNam
Posts: 11

Original Poster
Rep: Reputation: 0
the swap is ok.
it seems stopping after "Enabling swap space: ............ [OK]".
any change in /etc/hosts makes this problem.
Extra info.: My machine gets an IP addr from a DHCP server and I should add its hostname into the /etc/hosts to avoid the warning "Log in anyway?" after checking username and password.
Can you give me a solution ?
 
Old 09-19-2005, 07:59 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
If you're getting your IP from DHCP then the only IP for your local host in /etc/hosts should be the "localhost" entry:

127.0.0.1 myhostname localhost


In the above 127.0.0.1 is the loopback interface (lo in ifconfig). localhost is a keyword (you can have localhost.domain where domain is your actual domain) and myhostname would be the name you've given to your host.

The above should be the FIRST uncommented entry in your /etc/hosts file.

You can NOT specify any other IP address for myhostname as it will change due to being obtained from DHCP (especially if the DHCP is coming from your ISP - in house networks typically have longer reservations so you might get away with it on one of those but why risk it?).

While prior poster is correct that starting swap space should have nothing to do with your hosts entries what may be occurring is that the init script that starts right after your swap space is hanging.

Do grep swap /etc/rc?.d/* to find out which file is running swapon. This should be something like:
/etc/rcS.d/S35mountall.sh

You would then look for the next higher number in that directory as that is the next thing being started (ls /etc/rcS.d/S*). Check out that item as it is likely what is hanging. It is possible it is the mountall itself that is hanging if you have configured any NFS mounts.
 
Old 09-20-2005, 03:48 AM   #6
jindo
LQ Newbie
 
Registered: Jul 2005
Location: VietNam
Posts: 11

Original Poster
Rep: Reputation: 0
Thank you, jlightner.
when typing: grep swap /etc/rc?.d/* , i got:
/etc/rc0.d/S01halt:# Turn off swap, then unmount file systems.
/etc/rc0.d/S01halt:[ -f /proc/swaps ] && SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps`
/etc/rc0.d/S01halt:[ -n "$SWAPS" ] && runcmd $"Turning off swap: " swapoff $SWAPS
/etc/rc6.d/S01reboot:# Turn off swap, then unmount file systems.
/etc/rc6.d/S01reboot:[ -f /proc/swaps ] && SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps`
/etc/rc6.d/S01reboot:[ -n "$SWAPS" ] && runcmd $"Turning off swap: " swapoff $SWAPS

I don't know what's wrong with the swap. My /etc/fstab is configured:
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/ / ext2 defaults 1 1
/dev/devpts /dev/pts devpts gid=5,mode=620 0 0
/dev/shm /dev/shm tmpfs defaults 0 0
/dev/proc /proc proc defaults 0 0
/dev/sys /sys sysfs defaults 0 0
/etc/hda7 swap swap defaults 0 0
/dev/fd0 /media/floppy auto pamconsole,exec,noauto,managed 0 0
/dev/hdc /media/cdrom auto pamconsole,exec,noauto,managed 0 0

I think the swap option is not wrong.
When I edit the /etc/hosts as the default:
127.0.0.1 localhost.domain localhost
the machine runs ok. Howerver, after login, I get the notice: "Could not lookup internet address for -mymachinename- ... correct the problem by adding -mymachinename- to the /etc/hosts" "Log in Anyway?".
Any change in the /etc/hosts will makes the machine startup very slowly.
I don't know how to fix this problem. Can you help me?
 
Old 09-29-2005, 10:45 AM   #7
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
My bad. My example was from my Debian box. On my RedHat AS 3 box the swapon is done in /etc/rc.d/sysinit instead.

You might want to have a look at that and see what it does.

No reason updating /etc/hosts should cause this problem unless you're putting an entry above the 127.0.0.1 line. However as noted if you're using DHCP you should not be adding an entry to /etc/hosts for your real IP as that IP can change on reboot.

Entry for localhost should be:
127.0.0.1 localhost.localdomain localhost

You can also insert your real hostname in the above line:
127.0.0.1 realhostname localhost.localdomain localhost

Just make sure the localhost stuff is still there as many network startup and/or daemon processes use that.

If NOT doing dhcp to get your IP address the next line down can be the real IP and the real hostname. So you leave the 127.0.0.1 lline as in my first example then create a new line similar to:

xxx.xxx.xxx.xxx realhostname@realdomain realhostname

The real domain is the DNS domain you're on (e.g. linuxquestions.org). The realhostname after the space is an short name alias for the ereal name so you don't always have to type in the fully qualified domain name (FQDN).

Again only add that entry if you're NOT using DHCP to get your IP or if your IP is static (a DHCP pool with only 1 IP allowed).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc/hosts entry? batard Linux - Newbie 5 03-25-2005 01:22 PM
Webpage loads slowly using virtual hosts in Apache 2.0 Linux Redhat 9 dste0713 Linux - General 0 01-21-2004 12:35 PM
hosts MX entry twistedpair Linux - Networking 1 01-10-2004 03:01 AM
Adding shell commands to hosts.deny and hosts.allow ridertech Linux - Security 3 12-29-2003 03:52 PM
hosts entry for a lan unit with no dns entry linxtc Linux - Networking 1 10-03-2003 08:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration