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

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
ineuw
Level 5
Level 5
Posts: 825
Joined: Sun Nov 13, 2016 12:27 am
Location: Montreal, Canada

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

Post by ineuw »

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 LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Desktop: Linux Mint Cinnamon 21.3 English Edge - Desktop: Linux Mint Cinnamon 21.3 French
Laptop: Linux Mint Cinnamon 21.3 English - as of 24-04-15
deepakdeshp
Level 20
Level 20
Posts: 12341
Joined: Sun Aug 09, 2015 10:00 am

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

Post by deepakdeshp »

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.
Regards,
Deepak

Mint 21.1 Cinnamon 64 bit with AMD A6 / 8GB
Mint 21.1 Cinnamon AMD Ryzen3500U/8gb
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

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

Post by MrEen »

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 8
Level 8
Posts: 2384
Joined: Fri Jan 06, 2017 7:51 am

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

Post by GS3 »

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.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
Locked

Return to “Beginner Questions”