LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-17-2008, 10:17 AM   #1
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
what to do after netconfig so all changes are visible


I'm changing the network configuration using netconfig on a Slackware 12 box.

If I check ifconfig and hostname the changes have not been made. Changes have however been made to /etc/hosts and /etc/rc.d/rc.inet1.conf.

Which script/program do I need to run to make the changes take effect. I tried /etc/rc.d/rc.inet1 but that did not help.
 
Old 04-17-2008, 10:32 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
Did you restart the service yet?
Code:
/etc/rc.d/rc.inet1 restart
 
Old 04-17-2008, 10:50 AM   #3
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Original Poster
Rep: Reputation: 282Reputation: 282Reputation: 282
Thanks for the reply

I did run it (as said in the first post) but as I did not see the MAIN section in that file I assumed that it could be run without arguments.

It does not solve the whole issue as hostname and the login prompt still reflect the old names. But at least the IP info is there.

Last edited by Wim Sturkenboom; 04-17-2008 at 10:55 AM. Reason: fixed typo and added some extra info
 
Old 04-17-2008, 11:01 AM   #4
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
To change your system's hostname issue "/bin/hostname <new-name>" - "man hostname" will help.
 
Old 04-18-2008, 01:44 AM   #5
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Original Poster
Rep: Reputation: 282Reputation: 282Reputation: 282
Thanks for the reply. I know that I can do so, but I already have entered the hostname using netconfig and hence expect it to be set straight away.

I've done a little analysis. I had a look at /sbin/netconfig (I was surprised to find that it's a script) and found that it sets the hostname/domainname in /etc/HOSTNAME once both are specified (a minor bug as a user can still cancel the configuration at a later stage and ends up with an unexpected incorrect hostname after the next reboot).
Further at boottime, rc.M is responsible for setting the hostname. As running that file on a fully booted system more than likely has a lot of implications, I'm afraid (but not sure) that it can not be used.

For me the solution is to run the hostname command from within the netconfig script to set the hostname; this way the hostname command without parameters will at least reflect the contents of the file /etc/HOSTNAME.

For those who want to make that change (it's advised to make a backup of /sbin/netconfig first):

As root, open the file /sbin/netconfig using your favorite editor and search for etc/HOSTNAME; you should find something like the code below (without the bold line).
Next add the bold line and save the work
Code:
...
...
echo $HOSTNM.$DOMAIN > etc/HOSTNAME
/bin/hostname $HOSTNM

dialog -- title "SETUP IP ADDRESS ...
...
...
I might look a little further into this at a later stage (meaning when I'm more confident with scripting and have some time).

WimS
 
Old 04-18-2008, 05:55 PM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,221
Blog Entries: 3

Rep: Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437
Hi,

Quote:
Originally Posted by Wim Sturkenboom View Post
<snip>

For me the solution is to run the hostname command from within the netconfig script to set the hostname; this way the hostname command without parameters will at least reflect the contents of the file /etc/HOSTNAME.

For those who want to make that change (it's advised to make a backup of /sbin/netconfig first):

As root, open the file /sbin/netconfig using your favorite editor and search for etc/HOSTNAME; you should find something like the code below (without the bold line).
Next add the bold line and save the work
Code:
...
...
echo $HOSTNM.$DOMAIN > etc/HOSTNAME
/bin/hostname $HOSTNM

dialog -- title "SETUP IP ADDRESS ...
...
...
I might look a little further into this at a later stage (meaning when I'm more confident with scripting and have some time).

WimS
It's your system to do as you wish/want. But why would you change a static file like '/etc/HOSTNAME'? When you setup your installation initially you are queried for a 'HOSTNAME'. You answer that query and the '/etc/HOSTNAME' file is generated with the name.
 
Old 04-20-2008, 09:14 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Original Poster
Rep: Reputation: 282Reputation: 282Reputation: 282
As I did not run the netconfig at installation but afterwards. And the hostname file is indeed set, but not reflected when you run the hostname command without parameters.
 
Old 04-20-2008, 12:28 PM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,221
Blog Entries: 3

Rep: Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437Reputation: 1437
Hi,
Quote:
Originally Posted by Wim Sturkenboom View Post
As I did not run the netconfig at installation but afterwards. And the hostname file is indeed set, but not reflected when you run the hostname command without parameters.
You should 'man hostname';

Code:
excerpt from 'man hostname'
:~# man hostname
Formatting page, please wait...
       hostname [-v] [-F filename] [--file filename] [hostname]

       domainname [-v] [-F filename] [--file filename] [name]

       nodename [-v] [-F filename] [--file filename] [name]

       hostname [-v] [-h] [--help] [-V] [--version]

       dnsdomainname [-v]
       nisdomainname [-v]
       ypdomainname [-v]

DESCRIPTION
       Hostname is the program that is used to either set or display the  cur-
       rent  host, domain or node name of the system.  These names are used by
       many of the networking programs to identify  the  machine.  The  domain
       name is also used by NIS/YP.

   GET NAME
       When  called  without  any  arguments, the program displays the current
       names:
 hostname will print the name of the system as returned by the  gethost-
       name(2) function.

       domainname, nisdomainname, ypdomainname will print the name of the sys-
       tem as returned by the getdomainname(2) function. This is also known as
       the YP/NIS domain name of the system.

       nodename  will  print the DECnet node name of the system as returned by
       the getnodename(2) function.

       dnsdomainname will print the domain part of the FQDN  (Fully  Qualified
       Domain Name). The complete FQDN of the system is returned with hostname
       --fqdn.
....
As I stated the 'HOSTNAME' is set when you do the 'SlackwareŽ' install. If you don't respond with a hostname then the default 'darkstar' is used for the '/etc/HOSTNAME'. If you want to change the 'HOSTNAME' then use the command with different options.

As I stated it is your system to do as you wish. But!
 
Old 04-21-2008, 12:23 AM   #9
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Original Poster
Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
As I stated the 'HOSTNAME' is set when you do the 'SlackwareŽ' install. If you don't respond with a hostname then the default 'darkstar' is used for the '/etc/HOSTNAME'. If you want to change the 'HOSTNAME' then use the command with different options.
OK, please help me out here as I don't know exactly where you want to go.

Running netconfig does not set the 'HOSTNAME', it only writes it to '/etc/HOSTNAME'. In my opinion that's something different. One will not notice this easily as there is a reboot involved after the install which will take care of it but if one runs netconfig at a later stage you will notice.
I did read the man page and nowhere is an option to set the hostname permanently using the hostname command (which you seem to imply but maybe I misunderstood you).



My problem is that a supplied script (netconfig) sets the hostname in /etc/HOSTNAME but when one runs the hostname command without parameters afterwards, it does not reflect the contents of that file.
To get it right, one has to run the hostname command with the hostname specified during the netconfig (or reboot the system) in which case /etc/rc.d/rc.M will take care of it.

My proposed solution is to modify netconfig so the hostname command will reflect the changes made to the file /etc/HOSTNAME during the netconfig.

WimS
 
Old 04-21-2008, 02:21 AM   #10
ice_nine
Member
 
Registered: Sep 2007
Posts: 41

Rep: Reputation: 15
Quote:
Originally Posted by onebuck View Post

...

As I stated the 'HOSTNAME' is set when you do the 'SlackwareŽ' install. If you don't respond with a hostname then the default 'darkstar' is used for the '/etc/HOSTNAME'. If you want to change the 'HOSTNAME' then use the command with different options.

As I stated it is your system to do as you wish. But!
Each boot, your hostname is set based on the contents of /etc/HOSTNAME. The hostname command doesn't change this file, but the netconfig does. You need to change the file if you want the change to be permanent. This isn't a bad thing.


Wim Sturkenboom:

My understanding of netconfig is that it's purpose is to setup up the configuration files, and that's what it does. It's not a bug that those changes aren't reflected immediately, that's just how it works. Rerunning /etc/rc.d/rc.inet1 should reflect those changes.
 
  


Reply

Tags
netconfig, restart, slackware


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to use samba implementing some files can visible and some files can not visible willie118 Linux - Server 7 09-18-2007 12:27 AM
'netconfig' won't l0rddarkf0rce Slackware 3 07-28-2005 05:30 PM
Netconfig jmdlcar Slackware 5 05-30-2004 08:59 AM
Where is Netconfig? Mega Man X Slackware 3 12-03-2003 07:28 PM
netconfig knoxville Linux - Newbie 6 11-30-2003 01:56 PM


All times are GMT -5. The time now is 07:34 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration