Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hostname drops off between remote sessions

4 views
Skip to first unread message

Tony Baldwin

unread,
Jan 22, 2017, 12:50:03 PM1/22/17
to
I rent a VPS from Contabo, in Germany (as if the location were
relevant), which is still running wheezy.
Lately, when I access it (generally via ssh) the hostname appears to be
changed to (none). I have yet to determine if this is only when I've
had to remotely restart is from the contabo control panel, or just
any/every time I log-in again, but it seems kind of random.
I just reset it with hostname $mychosenhostname, and that remains the
hostname for the duration of my session, but I'll come back another time
(Like I said, I have yet to rule out or determine whether it's only
after reboots or not, although I'm beginning to suspect it is.), and it
will be (none) again, although my /etc/hosts file appears unchanged.
(paste)
127.0.0.1 localhost.localdomain localhost
127.0.1.1 ip-185-226-238-178.contabo.net ip-185-226-238-178
178.238.226.185 myownsite.me myownsite
178.238.226.185 mail.myownsite.me myownsite.me
178.238.226.185 tonybaldwin.me myownsite.me
178.238.226.185 mail.myownsite.me myownsite

# 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
# 178.238.226.185 vmi12265.contabo.net vmi12265
178.238.226.185 www.myownsite.me myownsite
(/paste)

It never, for several years, used to do this, it is recent, and to me,
perplexing behaviour.
When I log in, I want to see
to...@myownsite.me:~$ not tony@(none):~$

Now, I'm reading
here:https://www.vultr.com/docs/how-to-change-your-hostname-on-debian
That I have to run /etc/init.d/hostname.sh, which I do not ever recall
having to do in the past to permanently set my hostname, and when I try
to run that, I get an error about my hostname not being valid
:/etc/init.d# ./hostname.sh start
hostname: the specified hostname is invalid
What's going on here?

Why am I having so much headache with something as simple as setting
permanently the hostname?
This all started in about the last 60-90 days. Prior to that I do not
recall ever seeing this oddity.

Thanks,
Tony
--
http://tonybaldwin.me
all tony, all the time

Greg Wooledge

unread,
Jan 23, 2017, 8:40:05 AM1/23/17
to
On Sun, Jan 22, 2017 at 12:48:19PM -0500, Tony Baldwin wrote:
> I rent a VPS from Contabo, in Germany (as if the location were
> relevant), which is still running wheezy.
> Lately, when I access it (generally via ssh) the hostname appears to be
> changed to (none).

Edit (or create) the file /etc/hostname with the hostname that you want.
Then reboot, or use the command "hostname yourhostname" (as root) to set
the hostname. (But really, you probably want to reboot, to make sure any
daemons that read the hostname at startup get a valid hostname.)

Tony Baldwin

unread,
Jan 23, 2017, 12:40:06 PM1/23/17
to
Thanks, Greg,

Perhaps it is these Daemons that are not doing their job(?), because
I'll set the hostname (as root with "hostname $myhostname", or editing
/etc/hostname, I've done both), and on reboot, it returns to (none).
That's what I'm writing about. I've since determined that it does NOT
change from one ssh session to another, unless I've had to reboot in
between, so what's happening is the hostname is NOT being set on reboot,
even when /etc/hostname is still intact with the proper hostname in it.

Greg Wooledge

unread,
Jan 23, 2017, 12:50:04 PM1/23/17
to
On Mon, Jan 23, 2017 at 12:33:55PM -0500, Tony Baldwin wrote:
> Perhaps it is these Daemons that are not doing their job(?), because
> I'll set the hostname (as root with "hostname $myhostname", or editing
> /etc/hostname, I've done both), and on reboot, it returns to (none).

Anything you set with the hostname command is transient. The /etc/hostname
file is permanent.

If the contents of /etc/hostname are not being used as the hostname
at boot, then there is something wrong with your start-up scripts.
This is where we get to the advice about verifying the integrity of
/etc/init.d/hostname.sh as you had stumbled upon earlier.

On my own wheezy VPS:

greg@remote:~$ ls -ld /etc/init.d/hostname.sh
-rwxr-xr-x 1 root root 1423 Mar 27 2012 /etc/init.d/hostname.sh

greg@remote:~$ ls -ld /etc/rc*/*hostname*
lrwxrwxrwx 1 root root 21 Nov 28 2012 /etc/rcS.d/S06hostname.sh -> ../init.d/hostname.sh

Of course, wheezy may not be using sysvinit (there was an option to
use a "technology preview" of systemd, and I think there's another
option as well whose name I can't remember). If you're not using
sysvinit on wheezy, then things might become extremely interesting
for you, as you try to track down the problem.
0 new messages