Wow, I just learned something simple

Discussion in 'Linux/BSD/Free Systems' started by Deadjasper, Jan 18, 2019.

  1. Deadjasper

    Deadjasper [H]ard|Gawd

    Messages:
    1,719
    Joined:
    Oct 28, 2001
    Somehow my main Linux Mint-Cinnamon box got an inappropriate name. I have no idea how it happened but I decided to change it. The first site I visited for the knowhow was named "How to change the Linux hostname". I read the whole page and still didn't have a clue. It was all gibberish to me.

    Next site I visited was totally different. It told step by step how to do it and explained before hand that the hostname is stored in a file called "hostname". To change it you simply edit said file. Nothing could be simpler.

    So I went back and reread the first site. I still don't have a clue what they were going on about. Since the answer was so simple, why all the rigmarole and irrelevant gibberish?

    That's the way it is in the Linux universe, there are answers and there is gibberish. Why gibberish exists is known only by the gods.

    Amen. :confused:
     
  2. Frobozz

    Frobozz [H]ard|Gawd

    Messages:
    1,816
    Joined:
    Feb 15, 2002
    Would you want to share the sites you were looking at?
     
  3. Lunar

    Lunar Limp Gawd

    Messages:
    396
    Joined:
    Jul 26, 2007
    So, correct me if I'm wrong, but on systemd based distros I don't believe editing the hostname file directly is the preferred method anymore. The appropriate way now is to do the following:

    sudo hostnamectl set-hostname NEW_HOSTNAME
     
  4. Brian_B

    Brian_B 2[H]4U

    Messages:
    3,356
    Joined:
    Mar 23, 2012
    In my experience with Linux over the years, I've found:

    * Every distro does it different, just because their way is always better. Change for the sake of change sometimes - you will have no trouble finding a pair of people who would argue to the death over the difference between "-c" and "-C".

    * There is no single right way to do anything. Kind of nice, meaning there is usually more than one way to skin the cat.

    * There are a hell of a lot of wrong ways to accomplish something. Meaning that any which way that you do find out to do it, even if it works flawlessly, there's always someone who's going to jump out and call you an idiot and wonder why you didn't do it this other way. But don't worry - it never works flawlessly.

    * RTFM. The correct answer is ~always~ RTFM, even if you can't find the FM
     
    Last edited: Jan 18, 2019
    Sulphademus likes this.
  5. Mazzspeed

    Mazzspeed 2[H]4U

    Messages:
    2,069
    Joined:
    Dec 27, 2017
    Changing the hostname should literally be identical among distro's...?
     
  6. Brian_B

    Brian_B 2[H]4U

    Messages:
    3,356
    Joined:
    Mar 23, 2012
    I wouldn't literally assume anything about any distro.

    Literally.
     
    acascianelli likes this.
  7. Mazzspeed

    Mazzspeed 2[H]4U

    Messages:
    2,069
    Joined:
    Dec 27, 2017
    With the exception of package managers, everything including file structure and configuration files should be identical.
     
  8. ChadD

    ChadD [H]ardness Supreme

    Messages:
    4,297
    Joined:
    Feb 8, 2016
    Using hostnamectl should work with any distro running systemd. Seeing as that covers all the majors that is all you really need to know.

    As for /etc/hosts its a part of the FHS... so its a pretty standard location. Although host name is also kept in /etc/sysconfig/ by some distros which also conforms to the FHS. Anyway most distros are pretty much alike... some older versions of RHEL and SLES you may have to edit /etc/hosts and /etc/systemconfig/network. For any of the standard regular user distro just use systemctl.
     
  9. Lunar

    Lunar Limp Gawd

    Messages:
    396
    Joined:
    Jul 26, 2007
    Ummmm, no. Not how that works considering the number of init systems out there, desktop environments, etc. Hate to break it to you, but if you want everything to be the same, then you need to look away from Linux and head over to Windows or Mac OS. Not trying to be a jerk here, but the reality of the situation is that due to its open nature, anyone can make a replacement for an existing system, and if a distro decides to pick it up, then that changes things. In an ideal world, configuration of Linux systems would be standardized, but that comes with its own downsides. The strength of the current approach though is that it lends to a greater flexibility in Linux.

    Take systemd as an example. Love it or hate it, it has taken over for the most part, and has made service management much easier and make more sense in my opinion. I personally felt that the old methods in the SysV init days were needlessly complicated with config files all over the place, and requiring developers to handle the init of their services themselves. systemd has given devs a standardized target for how to start a service that is portable across distros. Personally I love systemd because it added some standardization where standards were needed, and it's basically accomplished a lot of what you're arguing for. But, every distro will still be a bit different, and things will be configured differently. Such is the nature of things.
     
  10. Mazzspeed

    Mazzspeed 2[H]4U

    Messages:
    2,069
    Joined:
    Dec 27, 2017
    I'm assuming systemd and I'm assuming pulse audio - Essentially modern packaged distro's.

    I've yet to come across a packaged distro that doesn't use standardized commands and file structure. The Windows file structure has changed between XP and Windows 7.
     
    Last edited: Jan 21, 2019
  11. Lunar

    Lunar Limp Gawd

    Messages:
    396
    Joined:
    Jul 26, 2007
    Ubuntu uses Netplan for network configuration. Not exactly a standard used by other distros. Just as an example. The point is that every distro has its own idiosyncrasies, and you just have to get used to learning them.
     
    Brian_B likes this.
  12. Mazzspeed

    Mazzspeed 2[H]4U

    Messages:
    2,069
    Joined:
    Dec 27, 2017
    Valid point. I'm still on 16.04 and haven't encountered Netplan yet, seems like a logical progression though. Comparatively speaking however, Microsoft has made changed to their WDM model over the years that results in drivers written for certain versions of Windows not being ideal for differing versions of Windows. No OS is really immune from this issue, just like macOS's need for Metal compatibility under Mojave. Something that wasn't necessary under older versions of macOS. In fact Apple are shocking when it comes to changes under the hood of their desktop operating systems.
     
  13. BlueLineSwinger

    BlueLineSwinger Gawd

    Messages:
    684
    Joined:
    Dec 1, 2011

    Even before Netplan (still not sold in its usefulness) the network config for Redhat/Fedora vs. Debian/Ubuntu was fairly different. e.g.: https://www.swiftstack.com/docs/install/configure_networking.html

    Once you get past Filesystem Hierarchy Standard (FHS) (assuming the current version) there's going to be some variation across distro families, such as Debian/Ubuntu's /etc/default directory, how things are arranged by various apps/utilities in /var, naming of log files, presence of /lib[32,64] and /usr/lib[32,64], etc.