LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-11-2019, 09:20 PM   #1
TarFile
Member
 
Registered: Mar 2003
Posts: 315

Rep: Reputation: 27
Angry Can not get the default hostname to change on current


No matter what I do the hostname shows up as darkstar. It is set correctly in /etc/HOSTNAME. I can change it with hostname newname then hostname returns newname. It will not survive a reboot. I know this has happened in the past.

This is on current as of today.

This is driving me crazy where is darkstar coming from?
 
Old 03-11-2019, 09:28 PM   #2
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 738
Blog Entries: 3

Rep: Reputation: 227Reputation: 227Reputation: 227
Do you get any success by re-running the installer prompt:

Code:
# netconfig
 
Old 03-11-2019, 09:55 PM   #3
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 5,759

Rep: Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293
Hi,

perhaps network manager is at fault like in https://www.linuxquestions.org/quest...-a-4175567087/

Evo.
 
Old 03-11-2019, 10:03 PM   #4
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 945

Rep: Reputation: 493Reputation: 493Reputation: 493Reputation: 493Reputation: 493
@TarFile
have a look in /etc/hosts
 
Old 03-11-2019, 10:43 PM   #5
TarFile
Member
 
Registered: Mar 2003
Posts: 315

Original Poster
Rep: Reputation: 27
That's the thing not running network manager. I tried everything else. Believe me I googled every way I could think of before posting. etc/NetworkManager/NetworkManager.conf has nothing about darkstar in it. It's somewhere else. I have been using Slackware since it came on 5 1/4 floppies so this is not something I am totally in the dark about.
 
Old 03-11-2019, 11:04 PM   #6
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 945

Rep: Reputation: 493Reputation: 493Reputation: 493Reputation: 493Reputation: 493
I'm only running Slackware -current on ARM and I don't have any issues with the hostname on that release.
The easiest way to setup the hostname is to use netconfig as @coralfang suggested.
If you go for the manual config, make sure you define your hostname, with the correct syntax if you have a static IP, in both /etc/hosts & /etc/HOSTNAME. Here you have an example:
https://www.linuxquestions.org/quest...6/#post5846761
Note that there's a code sequence in /etc/rc.d/rc.M, that sets the hostname based on what it finds in /etc/HOSTNAME
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
 
Old 03-11-2019, 11:22 PM   #7
TarFile
Member
 
Registered: Mar 2003
Posts: 315

Original Poster
Rep: Reputation: 27
I am aware of all that. It just does not work for some reason. I'll keep looking but there has to be a reason this is happening.
 
Old 03-12-2019, 08:58 AM   #8
Uncle Lumpy
Member
 
Registered: Feb 2010
Posts: 35

Rep: Reputation: 13
The only way around this that I've found is to set my hostname of choice when I compile a new kernel. For whatever reason with current, I too found that it always defaulted to darkstar no matter what I did. It might have something to do with what's in the /etc/rc.d/rc.M or /etc/rc.d/rc.S (I forget which) files regarding the hostname. Rather than messing with those, and since I always roll my own kernel, I just set the hostname in the kernel .config file and then it "sticks" upon reboot.

Best,
Lumpy
 
Old 03-12-2019, 09:31 AM   #9
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Slackware 14.2 current / Linux Mint / Debian / Void Linux
Posts: 8,147

Rep: Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680
I've always changed both the /etc/HOSTNAME and /etc/hosts files to reflect the same new host name. reboot , done.
 
Old 03-12-2019, 12:37 PM   #10
TarFile
Member
 
Registered: Mar 2003
Posts: 315

Original Poster
Rep: Reputation: 27
Yes those are set correctly, still does not work for some reason.

I am able to override it it /etc/rc.local but that seems like a kludge to me.
 
Old 03-12-2019, 03:18 PM   #11
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 738
Blog Entries: 3

Rep: Reputation: 227Reputation: 227Reputation: 227
Quote:
Originally Posted by TarFile View Post
Yes those are set correctly, still does not work for some reason.

I am able to override it it /etc/rc.local but that seems like a kludge to me.
Did you try setting the hostname with `/sbin/netconfig` ? That should set the hostname in all required places..
 
Old 03-12-2019, 03:31 PM   #12
TarFile
Member
 
Registered: Mar 2003
Posts: 315

Original Poster
Rep: Reputation: 27
Yes I set it with `/sbin/netconfig` all of the files are correct but still darkstar after reboot, unless I put overrides in /etc/rc.local.
 
Old 03-12-2019, 04:04 PM   #13
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 945

Rep: Reputation: 493Reputation: 493Reputation: 493Reputation: 493Reputation: 493
Quote:
Originally Posted by TarFile View Post
Yes I set it with `/sbin/netconfig` all of the files are correct but still darkstar after reboot, unless I put overrides in /etc/rc.local.
The kernel in Slackware is built without a default hostname, that's CONFIG_DEFAULT_HOSTNAME="(none)", so the kernel shouldn't cause any problems.
By respecting the correct syntax for defining the hostname in both /etc/HOSTNAME & /etc/hosts I never got into issues like the one you're reporting now. Trying to rule out a bug in /bin/hostname or /sbin/netconfig, it'll be helpful if you could provide your actual /etc/HOSTNAME & /etc/hosts files and also provide some details about your setup, if you're using a static IP or DHCP & if you're using a local (your own) DNS server/resolver.
You could also try defining your hostname directly in the /proc/sys/kernel/
https://www.kernel.org/doc/Documenta...ctl/kernel.txt
"domainname & hostname:" Section:
Code:
# echo "darkstar" > /proc/sys/kernel/hostname
# echo "mydomain" > /proc/sys/kernel/domainname
has the same effect as
# hostname "darkstar"
# domainname "mydomain"
 
Old 03-13-2019, 02:46 PM   #14
TarFile
Member
 
Registered: Mar 2003
Posts: 315

Original Poster
Rep: Reputation: 27
# echo "darkstar" > /proc/sys/kernel/hostname
# echo "mydomain" > /proc/sys/kernel/domainname

Still won't survive a reboot.
 
Old 03-13-2019, 04:03 PM   #15
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.2
Posts: 3,226

Rep: Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588
Do you have a filesystem that mounts on /etc? (It would be difficult to do that and have stuff work in the first place, but just in case...)
 
1 members found this post helpful.
  


Reply


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
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 11:22 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration