[SOLVED] What is the minimum length of the Linux hostname???

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
User avatar
ineuw
Level 3
Level 3
Posts: 159
Joined: Sun Nov 13, 2016 12:27 am
Location: Canada

[SOLVED] What is the minimum length of the Linux hostname???

Post by ineuw » Sat May 26, 2018 9:17 pm

The title says it all. The maximum is not a problem because there are unlimited resources on the topic but nobody provides any info on the minimum length. I am aware of the limitations of the special characters and symbols, but I am referring to a straightforward ANSI English alphanumeric values with out any diacritical marks or symbols.

I am asking because my previous hostname was "dtop32" (six characters) and on a recent attempt to install some software, I got the "Cannot resolve hostname" error. The name in both /hosts and /hostname files contained the identical name.
Last edited by ineuw on Sat Jun 02, 2018 8:32 pm, edited 1 time in total.
Linux Mint 18.3 desktop & on a Macbook 3.1 laptop, both 64 bit.

deepakdeshp
Level 10
Level 10
Posts: 3362
Joined: Sun Aug 09, 2015 10:00 am

Re: What is the minimum length of the Linux hostname???

Post by deepakdeshp » Sat May 26, 2018 11:43 pm

I have a 3 lettered hostname without a problem.
I feel 1 lettered should be fine too.
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help, and keeps the forum clean.
I am using Mint 18.3 Cinnamon 64 bit with AMD processor . Memory 8GB

MrEen
Level 5
Level 5
Posts: 668
Joined: Mon Jun 12, 2017 8:39 pm

Re: What is the minimum length of the Linux hostname???

Post by MrEen » Sun May 27, 2018 12:42 am

I'm wondering if "Cannot resolve hostname" refers to the site you're trying to install software from.

The live mint uses "mint" as the hostname so 6 chars is certainly more than enough.

User avatar
GS3
Level 4
Level 4
Posts: 264
Joined: Fri Jan 06, 2017 7:51 am

Re: What is the minimum length of the Linux hostname???

Post by GS3 » Sun May 27, 2018 2:09 am

I just spent several hours troubleshooting a similar error message I was getting with GPA. It turns out there are two files where the host name must be present. With "hostnamectl set-hostname bob" you can change the host name which is kept in the file etc/hostname. You can probably just edit that file manually.

BUT it turns out you need to edit another file, the etc/hosts file. Right under the line "127.0.0.1 localhost" put the new line "127.0.0.1 bob". In my case that fixed the problem of the error message.

If this is needed I do not understand why the tool to changes the host name does not do it automatically and I have to do it manually. I just wasted several hours on this.
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

Post Reply

Return to “Newbie Questions”