If I want to connect on the command line from an osmc-box renamed to naspberry during installation, to an osmcbox called osmc. The naspberry box will standard only resolve to it self.
because this is in the /etc/hosts file:
During installation when the installer is asking you, if you want to change the hostname.
the hostname only is changed in /etc/hostname. and not in /etc/hosts
So if you want to: ping, ssh, nfs, from the command line of the naspberry box to a box called osmc it does not work it loops back to 127.0.1.1 (ipv4) or ::1 (ipv6)
Did you read the nss-myhostname page I linked to, to see how it works ?
It automatically resolves the hostname set in /etc/hostname. For example if I change my hostname to āveroā then from the same machine ping vero it will resolve to 127.0.0.1 automatically - no changes to /etc/hosts needed.
Yes, that is because there is still a default entry for āosmcā in /etc/hosts, so āosmcā will still resolve to the localhost as well. I would recommend that if you have multiple devices you donāt call any of them āosmcā to avoid this.
The whole reason for using nss-myhostname is so that we donāt have to programatically go parsing and modifying the users /etc/hosts file, as doing a truly robust parser that will seek out and change only the correct hostname entries is non-trivial. Unfortunately a side effect is that the original redundant osmc entry remains.
It may be possible for us to completely leave out the osmc /etc/hosts entry now that we use nss-myhostname to avoid this problem in future.
Do not get me wrong ⦠So you clearly do not intend it to be a multi user system.
And only want it to be what youāve created a jukeboxā¦
It is not a problem for me that the installer does not do it. I can do it myself.
It just brings expectations the moment the installer suggests that one can change the hostname, one would think that it would also resolve correctly from the command line one would even expect that the installer will change the nsswitch.conf. in which you refer to
hosts: files myhostname mdns4_minimal [NOTFOUND=return] dns mdns4 ā¦
Does the average user even care that you use nss-myhostname?
They would probably not even care about this issue either.
For some what ever reason I have not seen it work yet ⦠What kind of a nameserver are you running on your network? Probably one that is setup perfectly ā¦
I am looking at this from a user friendly non-bug point of view , how hard is it to append adding the new host name to the /etc/hosts/ properly from the installer? probably less work then not including it all togetherā¦
As someone who has just been reading this thread in passing, Iām slightly confused ā¦
Just change the hostname from osmc to something else and it will all work, E.g.:
The problem you are having is because the current installation leaves behind a single ā/etc/hostsā file entry called āosmcā. Iām sure, if itās considered a problem, that will be fixed, but as @DBMandrakealso pointed out:
And heās right - it is; your question:
Shows that you donāt realise whatās actually involved in doing that correctly (you canāt just append like that ā¦).
So what is the problem with just not calling your osmc box āosmcā? Youāve changed the name of one, just change the name of the other as well and it will all work correctly.
Then why suggest the name OSMC during installation all together ā¦
From a user friendly point of view , Its should say Pick any name but not OSMC ,
Read back this entire thread ⦠I am not attacking you ⦠From the get go I was basically told to stfu
"Have you tried rebooting before reporting problems ? What āproblemsā do you see exactly, if you still see any after a reboot ? " as if the issue does not ecxist.
As if my suggestion did not matter and how dare I even write it up ā¦
OSMC is a perfectly sensible default name.
If youāve only got one OSMC system, itās a perfectly good name.
If you want to have more than one OSMC system, youād change the name anyway - you canāt have āosmcā and āosmcā and expect anything to be able to differentiate between them.
So for the one specific case where you want more than one machine, still insist on calling one āosmcā, and want to be able to resolve that name from the command line, you might want to make one simple edit to one text file.
Since thatās the only circumstances under which this would be any sort of issue, probably not worth changing installation messages, is it ā¦
OSMC is a super name and I think you guys do great work!! I want to be able to use the name osmcā¦
But its you that suggested I can not or one could not ⦠Please read back
If someone decides to use another hostname ⦠next to this default āosmcā hostname⦠on his network.
You suggest this name by default so its safe to say that atleast the first box in a network of multiple is called OSMCin 80% of cases.
But say then if you call another box āsomething-elseā ⦠Reboot ā¦
And thenā¦
want to get some stuff from host āosmcā you can not because on the commandline of
host āsomething-elseā you get resolved to localhost.(instead of āsomething-elseā).
and there is no nsswitch.conf. which is going to stop it from doing so ā¦
So please say you understand now ⦠I want to use OSMC as a host name
Then how can you stand by this answer:
Yes, that is because there is still a default entry for āosmcā in
/etc/hosts, so āosmcā will still resolve to the localhost as well. I
would recommend that if you have multiple devices you donāt call any of
them āosmcā to avoid this.
What on earth does multi-user have to do with the hostname ?
Youāre getting a bit muddled up. If you check /etc/nsswitch.conf youāll see that it already has āmyhostnameā there. We donāt expect anyone to need to edit that file manually.
The āinstallerā is actually the walkthrough process, which runs once after installation. One of the things it offers to do is change the hostname. You can change the hostname via Kodi at any time - the normal location of the setting is āDevice nameā in Settings->Services->General.
Normally this setting only changes Kodiās idea of the device name, (for Airplay for example) however we have gone out of our way to patch Kodi so that changing the name here also changes the system hostname at /etc/hostname for you automatically. So no manual editing of /etc/hostname is required either.
It doesnāt matter what nameserver Iām using - the myhostname entry is the second entry in nsswitch.conf - it is higher priority than everything except /etc/hosts. This is partly done for security reasons.
Iāve explained already what your problem is - the new name that you select will resolve correctly from that device however because there is still a manual entry for āosmcā in /etc/hosts this will prevent any OSMC install from being able to correctly resolve another osmc install that is still called osmc.
To fix this we would need to remove the osmc entry from /etc/hosts completely. Now that we have nss-myhostname (it was only added a couple of months ago) we can probably do this - but we wonāt be retroactively editing the users /etc/hosts file (thatās why we added nss-myhostname in the first place) so that change would only be for new installs.
In the meantime my suggestion is if you have multiple installs, donāt name any of them osmc, or edit /etc/hosts yourself.
The main purpose of these hosts entries is that some software that runs on the system needs to be able to resolve its own hostname, regardless of what that might be. (sudo is a good example) that is where nss-myhostname provides a nice clean, automated solution.
OSMC is a super name and I think you guys do great work!! I want to be able to use the name osmcā¦
But its you that suggested I can not or one could not ⦠Please read back
If someone decides to use another hostname ⦠next to this default āosmcā hostname⦠on his network.
You suggest this name by default so its safe to say that atleast the first box in a network of multiple is called OSMCin 80% of cases.
But say then if you call another box āsomething-elseā ⦠Reboot ā¦
And thenā¦
want to get some stuff from host āosmcā you can not because on the commandline of
host āsomething-elseā you get resolved to localhost.(instead of āsomething-elseā).
and there is no nsswitch.conf. which is going to stop it from doing so ā¦
So please say you understand now ⦠I want to use OSMC as a host name
Then how can you stand by this answer:
Yes, that is because there is still a default entry for āosmcā in
/etc/hosts, so āosmcā will still resolve to the localhost as well. I
would recommend that if you have multiple devices you donāt call any of
them āosmcā to avoid this.
Iāve explained twice now what is causing your problem, why it is currently the way it is, how you can easily solve your problem (by editing one file) and have said twice now that we will look into changing the /etc/hosts file on a fresh install to prevent this happening in the future. This is an issue that we are well aware of but like any bug it has to come somewhere on our priority listā¦
Iāve not seen anybody (you or the OSMC developers - of which Iām not one, BTW, just another user trying to help ā¦) being āattackedā; neither did I read any response as telling you to ST*U.
I think perhaps there might be some misinterpretation of tone due to the language difference - although your English is very good, the ā,ā quotation marks are usually an indication
You said you had problems, but didnāt explain what they were.
Now it is clear what the problem is, youāve been told:
Two work-arounds for the issue (edit 1 line in 1 text file, or donāt call both boxes āosmcā)
That the developers are aware of it and will consider a fix at some point.
Exactly why it is currently being done that way, and how any fix would resolve it.
Your suggestion has been ruled out as impractical (it is considerably more complex than you seem to understand), and unnecessary if the developers fix it as they seem to intend to.
So your issue is understood; you have 2 alternative work-arounds for it; a proper fix will be considered for a future release. Seems you should have everything you could want �
In the past we have recommended that to change the hostname completely, you edit both /etc/hostname and update the loopback references in /etc/hosts as well.
However to greatly simplify the process we set up a callback in Kodi so that changes to the Device Name always update the hostname, and that changes to /etc/hostname also update Kodiās Device Name. This allows users to change their system hostname without any command line interaction. Additionally, it reduces confusion (some users may have believed in the past that modifying this Kodi setting was changing their hostname) and offers a greater level of persistence (deleting Kodiās user data will not erase the previously configured device name).
Modifying /etc/hosts when this is done would have been inappropriate, as there are a few issues that can occur. The most obvious challenge is that we need to know the previous hostname. However if a user edits /etc/hostname manually, then we would be unable to assess how /etc/hosts should be structured without knowin the previous hostname, and without knowing whether the previous hostname had also been reflected in /etc/hosts.
Using libnss-myhostname lets us resolve those gethostname() calls which can occur when you edit /etc/hostname, but not /etc/hosts and then run any command with a privileged context (i.e. sudo)