You are not logged in.

#1 2019-02-09 09:29:11

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Can't set hostname

Hello everyone,

I have set my hostname right after setting up arch but it seems like it recently broke.
My hostname usually is "_____" (5x underlinie).

And so the content of my "/etc/hostname" is:

_____

So I tried using hostnamectl:

hostnamectl set-hostname _____
Could not set property: Message recipient disconnected from message bus without replying

Any ideas? sad


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#2 2019-02-09 09:53:44

makh
Member
Registered: 2011-10-10
Posts: 305

Re: Can't set hostname

Hi

You can try:

echo "machine-name" > /etc/hostname

Reboot.

It should work.

Thankyou


OS:  Arch  &/  Debian
System: LENOVO ThinkPad E14
Desktop: Xfce

Offline

#3 2019-02-09 09:58:26

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: Can't set hostname

Well, this is weird?

sudo echo "_____" > /etc/hostname
bash: /etc/hostname: Permission denied

And then again, /etc/hostname already contains the hostname I want.


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#4 2019-02-09 10:09:19

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Can't set hostname

You're trying to set an invalid hostname, the _ isn't an allowed character.

man hostname wrote:

Each element of the hostname must be from 1 to 63 characters long and the entire hostname, including the dots, can be at most 253 characters long.  Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, and the hyphen (-).  A hostname may not start with a hyphen.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2019-02-09 10:19:21

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,702
Website

Re: Can't set hostname

Utini wrote:

Well, this is weird?

sudo echo "_____" > /etc/hostname
bash: /etc/hostname: Permission denied

Nope, that's entirely expected. Shell redirection happens as the user running the command. You would need to be running as root, or you would need to pipe to 'sudo tee' instead of redirecting if you want to write to that file. See, e.g. https://stackoverflow.com/questions/822 … sion-to-wr

But in the case of your hostname, see Slithery's post.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2019-02-09 10:23:36

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: Can't set hostname

Thanks for your responses.
Sad to see that my favourite hostname for many years is not available anymore sad


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#7 2019-02-09 10:25:27

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Can't set hostname

It's never been a valid hostname, just blind luck that it didn't break anything before now.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

Board footer

Powered by FluxBB