The Apache “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Foo on Ubuntu

If you are using Apache on Ubuntu, then you most likely ran into the annoying warning about determining the fully qualified domain name of your server. Something like this will show up in your logs, on start of the server or on log rotation:

apache2: Could not reliably determine the server's fully qualified domain name, using 10.10.0.40 for ServerName

Luckily there is an easy fix it. All you have to do is adding the ServerName directive to your Apache configuration and specify a good server name. Usually localhost will do fine, unless you are using the machine without virtual hosts, just as a base server.

A quick and dirty way would be adding the following line to /etc/apache2/httpd.conf or to /etc/apache2/apache2.conf and restart your Apache service.

ServerName localhost

And then restart your Apache service with the following command:

/etc/init.d/apache2 restart

Or on newer systems with:

service apache2 restart

Now, if you have a name in /etc/hostname, then you can use that instead. But you have to make sure that the name resolves to something real. If it is not in the DNS, then add it to your /etc/hosts and let it resolve to another loopback address. Here is a sample:

127.0.0.1 localhost
127.0.1.1 myhostname

But as I said, this is quick and dirty and there are much better ways of doing it. So lets take a look at the preferred method. This one differs depending on the Ubuntu version, because the default Apache version changed from 2.2 to 2.4.

Ubuntu 13.04 and older (Apache 2.2)

Apache 2.2 loads additional configuration files from /etc/apache2/conf.d. Just add a file to that directory and add the above mentioned ServerName directive and restart Apache.

Create the file:
vi /etc/apache2/conf.d/servername

Add the directive:
ServerName localhost

Restart Apache:
service apache2 restart
or
/etc/init.d/apache2 restart

Ubuntu 13.10 and newer (Apache 2.4)

Apache 2.4 has the additional configuration organized similar to the modules and sites. All configuration files need to be added to the directory /etc/apache2/conf-available and need to have the extension .conf. Each configuration file can be enabled with a2enconf and disabled with a2disconf.

Create the file:
vi /etc/apache2/conf-available/servername.conf

Add the directive:
ServerName localhost

Activate the configuration:
a2enconf servername

Restart Apache:
service apache2 restart

Windows 7 “The Computer Restarted unexpectedly or encountered an unexpected error” Foo

HP’s Windows recovery installation seems to be a little bit broken. Or at least for me it was. While restoring the Windows 7 on an HP Elitebook 8540w I ran into some issues when the drivers installed. The system just stalled and nothing was moving anymore. After a reboot I saw this nice error message:

The Computer Restarted unexpectedly or encountered an unexpected error

Well, not nice at all, but there is a way you can continue from here. Here are the steps:

  1. On that very same screen press SHIFT-F10 and a command prompt should appear.
  2. Enter “regedit” (without the quotes) into the command prompt and press enter.
  3. In the registry editor navigate to HKLM/SYSTEM/SETUP/STATUS/ChildCompletion
  4. Double click on the entry setup.exe and change the value from 1 to 3.
  5. Close the registry editor.
  6. Click OK in the error window, which will restart your machine.

After these steps you should be able to continue with your Windows setup. In my case I had some trouble getting all drivers to work, but that is a different story.

Too Many Open Files Foo With Chrome On Ubuntu 13.10

The last Chrome update and one of the last Thunderbird updates caused some strange crashes of either on of them on my Ubuntu 13.10. All is fine, it runs great and all of a sudden *boom*, browser window gone, or email client gone.

Luckily .xsession-errors exists and there I could find some entries like this:

[3827:4038:0518/230904:ERROR:shared_memory_posix.cc(226)] Creating shared memory in /dev/shm/.com.google.Chrome.12UDei failed: Too many open files

Not good. But there is help. For MyEclipse I had the same issue in the past. But it didn’t seem necessary anymore since 13.10. But I also haven’t used it in a while. Anywhoo, here is what has to be done. And before I forget it, all these changes have to be done as root.

First check the setting for file-max with the following command

cat /proc/sys/fs/file-max

In my case this value seems fine, as it is well beyond the 200,000 that they recommend.

peter@majestix:~$ cat /proc/sys/fs/file-max
1627431

If that is below 200,000 you can set by adding the following line to /etc/sysctl.conf

fs.file-max=200000

The next is the ulimit setting for open files. You can check it with the following command

ulimit -n

This one was set to 1024 in my case and that can be a little bit low. At MyEclipse they recommend setting it to 65535 and that’s what I did. Just add the following lines to /etc/security/limits.conf

* hard nofile 65535
* soft nofile 65535

Afterwards restart your machine and all should be fine. If you only have to change the sysctl.conf setting then you can activate that change with the following command

service procps start

Enable Administrator Account on Windows Vista, 7 & 8

Most of you might have noticed that ye good ol’ administrator account is not available anymore in newer Windows versions. Actually it is hidden and disabled for all versions since Windows Vista. And under normal circumstances you actually don’t want to use this account anymore. But there are some use cases where you want to have this administrative access.

So, lets take a look at it. As mentioned before, the account exists. That means it just needs to be activated. Now, this can’t be done within the UI. You have to dive into the command prompt that runs as administrator. Kinda confusing to activate the administrator with a command prompt that runs as administrator, isn’t it?

Lets get started. First you need the command prompt with elevated (administrator) rights. On Windows Vista and 7 you can simply search for “command prompt” in the start menu and select “Run as administrator after right-clicking on the menu entry. Or you can use the Ctrl-Shift-Enter shortcut inside the search box.

On Windows 8.x you right-click the start button and choose the menu option “Command Prompt (Admin)”.

Now we have a command prompt and with the following command you activate the administrator account:

net user administrator /active:yes

It is important to know that this user does not have a password set at all. So everybody can log in as administrator! If you don’t want that, and usually nobody wants that, you have to set a password. This can be done with the following command on the already open command prompt:

net user administrator

If you are done with your task or you want to deactivate the administrator in general, you simply use the following command:

net user administrator /active:no

And now happy administrating! Or in other words, creating a lot of Foo.