So the other day I decided to move my web server, which of course requires me to shut it down, something that even the thought of made me cringe.
Since installing gentoo on my server, even though there are numerous positives to it, I have found that restarting gentoo is always a game of Russian Roulette. Funny though with gentoo its seems like instead of your chances being one out of six for a “severe headache” it is more like five out of six. What I mean by that is that whenever I have had to restart the damn thing, I find that something has broken. This of course I can only blame on myself since it is because I an no where near as careful as I should be when I update the damn thing (curse you emerge world). I have to say though, using gentoo will get you to learn very quickly how to diagnose and fix problems with a linux install,well at least by actually fixing it and not just reinstalling from scratch.
This restart was of course, no different, and when the OS loaded I saw an error message about the machine’s hostname:
* You should stop using /etc/hostname and use /etc/conf.d/hostname
* Setting hostname to # /etc/conf.d/hostname
# Set to the hostname of this machine
hostname: name too long
* Failed to set the hostname
Now because of this issue, not only did the system’s hostname get screwed up, but also apache would not start because there was no hostname as far as the system was concerned. Of course considering this is supposed to be a web server…not having apache working is kinda bad. First thing I did was check all the usual culprits to make sure nothing changed with the hostname:
Of course, nothing looked out of the ordinary and I was wondering how the heck it was possible that the host name was “too long,” especially since I did not change it. So like usual when I encounter pretty much any problem I don’t know how to fix, I relied on my old buddy google for the answer. As my luck would have it, I did not find anything that could help me, no matter what combination I tried of the error messages I was getting. I even tried searching how to tell gentoo to “stop using /etc/hostname and use /etc/conf.d/hostname” but once again no luck!
Before I completely lost hope, I decided to try something on a whim and rename /etc/hostname to /etc/hostname.bak (before trying to delete it) just to see what would happen…and of course that fixed it! So all that time spent trying to search for the answer, and it was as simple as FREAKING DELETING A DAMN FILE!!
Well at least it works again and I can be proud of the fact that I did not have to resort to doing a fresh install…or well…throwing the damn thing out a window…for now at least.