LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 03-13-2019, 04:14 PM   #16
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018

Code:
# Set the hostname.
if [ -r /etc/HOSTNAME ]; then
  /bin/hostname $(cat /etc/HOSTNAME)
else
  # fall back on this old default:
  echo "darkstar.example.net" > /etc/HOSTNAME
  /bin/hostname $(cat /etc/HOSTNAME)
fi
Well, the obvious question that I haven't seen asked yet is what permissions do you see on /etc/HOSTNAME? If it's not readable then the script will overwrite it each boot.
 
Old 03-13-2019, 05:24 PM   #17
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Quote:
Originally Posted by TarFile View Post
# echo "darkstar" > /proc/sys/kernel/hostname
# echo "mydomain" > /proc/sys/kernel/domainname

Still won't survive a reboot.
As for this; echo'd values made into /proc don't survive a reboot.
You will have to make a file such as;

/etc/sysctl.d/hostname.conf
Code:
kernel.hostname = "myhostname"
kernel.domainname = "mylocalnet"
If your hostname changes by echoing those values, then that should work after a reboot.
 
Old 03-13-2019, 06:13 PM   #18
TarFile
Member
 
Registered: Mar 2003
Posts: 371

Original Poster
Rep: Reputation: 37
That did not work.

This is from rc.M

# Set the hostname.
if [ -r /etc/HOSTNAME ]; then
/bin/hostname $(cat /etc/HOSTNAME)
else
# fall back on this old default:
echo "darkstar.example.net" > /etc/HOSTNAME
/bin/hostname $(cat /etc/HOSTNAME)
fi

copied to rc.sethostname then ran it.

bash-5.0# ./rc.sethostname
hostname: the specified hostname is invalid

I saw that flash by at boot time right after the going multiuser message.

I have not idea as /etc/HOSTNAME is valid.
 
Old 03-13-2019, 06:18 PM   #19
TarFile
Member
 
Registered: Mar 2003
Posts: 371

Original Poster
Rep: Reputation: 37
Aw crap HOSTNAME was invalid netconfig shoved the hostname and the domain as one hostname for some reason must have been too big. There is a bug somewhere probably in netconfig?

It put it in like this

hostname.domainame.org
 
1 members found this post helpful.
Old 03-13-2019, 07:16 PM   #20
TarFile
Member
 
Registered: Mar 2003
Posts: 371

Original Poster
Rep: Reputation: 37
OK I am not exactly sure how this is supposed to work.

netconfig asks for a hostname then a domainname.

It puts hostname.domainname in /ect/HOSTNAME.

hostname on the command line returns hostname.domainname

domainname returns (none)

My problem was caused by the domainname I put in netconfig.

It has a problem if you use something like this domainname_name.org apparently the _ is not allowed in a doaminname at least it won't work here. Since I don't know the rules for domain names (if any) I just put in what I liked for the local network.

Still I think if netconfig asks for a domainname it should set it correctly, providing of course it's a name that meets whatever rules are in place.

Not sure if this is a bug or a feature.

OK for what its worth

AG Domain Name Rules Summary

Use only letters, numbers, or hyphen ("-")
Domain names cannot begin or end with a hyphen
Domain names cannot have more than 63 characters, not including .AG, .COM.AG, .NET.AG, .ORG.AG, .EDU.AG, .GOV.AG, ETC.
Maximum length of a complete (Fully Qualified, FQDN) domain name (including .separators) is 255 characters
Minimum length of a domain name is 1 character, not including extensions. However, all 1 character domain names are reserved by the Registry.
A name may begin with a digit
Two character domain names are allowed
Domain names considered offensive may be declined
For domains to be active on the Internet, they must have at least one configured and working name server.
There is no restriction on the physical location or IP address of these name servers.

The rest is not related to the names allowed.

This rules out the use of _ in a domainname the cause of my initial problem.

I still think domainname should be set ny netconfig but I suppose there may be a reason it's not.
 
Old 03-13-2019, 07:57 PM   #21
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
I disagree with Pat on this one. IMO the domain part does not belong in the nodename/hostname. I just have this.
Code:
$ cat /etc/HOSTNAME 
ws1
$ grep ws1 /etc/hosts
127.1.1.1               ws1.local ws1
fe80::REDACTED ws1-wlan0.local ws1-wlan0
I don't use netconfig. I set it up manually.


Oh, and domainname gives you the NIS/YP domain. not the dns domainname. It's not the same thing.

Last edited by GazL; 03-13-2019 at 08:06 PM.
 
Old 03-13-2019, 08:03 PM   #22
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@TarFile

Told you it's all about the correct syntax Happy to hear you got it working.

On why using "_" in the hostname is not really supported, never tried it TBH, you can get some answers from here:
https://stackoverflow.com/questions/...erscore-in-it#
 
1 members found this post helpful.
Old 03-13-2019, 08:51 PM   #23
TarFile
Member
 
Registered: Mar 2003
Posts: 371

Original Poster
Rep: Reputation: 37
OK if domainname gives you the NIS/YP domain is that not the one set up by netconfig? Don't you have to register the DNS domainname to use it online?
 
Old 03-13-2019, 09:02 PM   #24
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
hostname and domain name are two different entities.
 
Old 03-13-2019, 09:45 PM   #25
TarFile
Member
 
Registered: Mar 2003
Posts: 371

Original Poster
Rep: Reputation: 37
From GazL's reply

"Oh, and domainname gives you the NIS/YP domain. not the dns domainname. It's not the same thing."
 
Old 03-13-2019, 09:57 PM   #26
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@TarFile

Sorry, missed GazL's "Oh" post edit, considered you were replying to me. Never mind.
 
1 members found this post helpful.
Old 03-14-2019, 05:17 AM   #27
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
Quote:
Originally Posted by TarFile View Post
OK if domainname gives you the NIS/YP domain is that not the one set up by netconfig?
No. All netconfig does with the domainname part is add it to the entry in /etc/hosts for the ip address entered, but as I said above, I believe netconfig is doing it wrong anyway by including the domain part in /etc/HOSTNAME.
 
Old 03-14-2019, 12:53 PM   #28
TarFile
Member
 
Registered: Mar 2003
Posts: 371

Original Poster
Rep: Reputation: 37
Yes that does seem odd. Oh well it does show the correct hostname but does not set the domianname at all. I think I may have seem something about not setting domianname for some reason in one of the setup files somewhere in /etc.
 
Old 03-14-2019, 02:00 PM   #29
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,770

Rep: Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455
Historically it was only the hostname and not the full canonical FQDN. Search for word 'hostname' in current's Changelog to see when it was changed in Slackware.
 
Old 03-14-2019, 02:09 PM   #30
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,770

Rep: Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455Reputation: 1455
The yp domainname (or nis, as they call it nowadays), which 'domainname' shows, it set by /etc/rc.d/rc.yp. If you use yp.
 
  


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
HOSTNAME = hostname -> HOSTNAME: command not found ? thomas2004ch Linux - Software 2 08-26-2013 08:25 PM
'hostname some_name' does not change the hostname. stf92 Slackware 11 02-21-2013 07:09 PM
Not enough space to use apt-get on default partition, how do i change default? mmcm Linux - Newbie 3 01-05-2013 06:37 PM
getting errors related to hostname -- security problem? ok to change hostname? sneakyimp Linux - Server 2 11-18-2012 05:25 PM
after hostname change, syslogd still output previous hostname to messages file tiger2000 Linux - General 3 07-22-2009 09:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:23 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