[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian 12, setting hostname does not persist



On 6/27/23 06:49, David Mehler wrote:
Hello,

I've got a VPS through a2hosting it was running Debian 11 specifically
11.7. Long story short I just had to reinstall it after a hard week of
work so instead of doing it all over again on 11.7 I decided to
upgrade to 12.0. I used this:

https://www.makeuseof.com/upgrade-to-debian-12-bookworm-from-debian-11/

the upgrade itself went just fine. I set my time zone that stuck and
is persisting then went for the hostname, I am doing this via ssh, in
setting the hostname it won't persist through a reboot.

In the below output I've x-d out items like the device chasis ID and
the IP I've made it a 192.168.x.x address even tthough the actual
address is public.

The one thing I see and I don't know if this is related is when I
change the hostname with set-hostname hostnamectl -f and -i gives an
error.

#hostname
server.example.com

#hostname -f
server.example.com

#hostname -i
192.168.23.195

#hostname -s
server

#cat /etc/hostname
server.example.com

#cat /etc/hosts
127.0.0.1	localhost
# Auto-generated hostname. Please do not remove this comment.
192.168.23.195 server.example.com server

#hostnamectl set-hostname bookworm

#hostname
bookworm

#hostname -f
hostname: Name or service not known

#hostname -s
bookworm

#hostname -i
hostname: Name or service not known

#cat /etc/hosts
127.0.0.1	localhost
# Auto-generated hostname. Please do not remove this comment.
192.168.23.195 server.example.com server

#perl -i -p -e 's/server/bookworm/g;' /etc/hosts

#cat /etc/hosts
127.0.0.1	localhost
# Auto-generated hostname. Please do not remove this comment.
192.168.23.195 bookworm.example.com bookworm

#cat /etc/hostname
bookworm

#reboot

#cat /etc/hosts
127.0.0.1	localhost
# Auto-generated hostname. Please do not remove this comment.
192.168.23.195 server.example.com server

#cat /etc/hostname
server.example.com

#hostname
server.example.com

#hostname -f
server.example.com

#hostname -s
server

#hostname -i
192.168.23.195

I've googled and not seen this as a problem, I am quite perplexed.
Suggestions welcome.
Thanks.
Dave.

I ran into a similar problem setting up some bananapi-m5's running armbian as klipper interfaces to 3d printers. That hostname must exist in the /etc/hosts file before it quits resetting the hostname to the install default. It might be an armbian problem, but it does IMO rate a check. So edit the hosts file first.
.

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/>


Reply to: