NGINX 400 – the Plain HTTP Request Was Sent to HTTPS Port

This issue is a result of a misconfigured NGINX install. Typically when trying to server HTTP and HTTPS from the same server vhost config.

Commonly it is configured as:

server {
        listen 80;
        listen 443  ssl;
        server_name localhost;
...

But this will result in the 400 error. So the config needs to be changed to:

server {
  listen 80;
  listen 443 default ssl;

  # ssl on   - remember to comment this out
...
}

Then restart nginx and the 400 error should no longer appear.

Network Drops for Window Guests in KVM

I started to notice with file transfers over a few megabytes the network would totaly stall for my few Window VMs on my KVM server.

After some investagtion and trial and error I tried changing the virtual NIC for the Guests.

To do so I opened the defention file for each VM at /etc/libvirt/qmeu/HOST.xml

and modified the section:

<interface type='bridge'>
      <mac address='52:54:00:a0:41:92'/>
      <source bridge='br0'/>
      <model type='rtl8139'/>
    </interface>

to use the intel e1000 NIC by this

<interface type='bridge'>
      <mac address='52:54:00:a0:41:92'/>
      <source bridge='br0'/>
      <model type='e1000'/>   
    </interface>

This can also be changed by using cli during install or running:

-net nic,model=e1000 -net user

virtio may have also provided a better experience with the proper drivers, but switching to e1000 “just worked”.

Cannot Emerge Debian-sources

When following the funtoo wiki’s install guide, it has you emerge debian-sources as an easy solution to getting a kernel.

This emerge fails and looks something like this:

>>> Installing (1 of 1) sys-kernel/debian-sources-3.2.41
*
* To avoid automounting and auto(un)installing with /boot,
* just export the DONT_MOUNT_BOOT variable.
*
mount: /dev/sda1 is already mounted or /boot busy
*
* Cannot automatically mount your /boot partition.
* Your boot partition has to be mounted rw before the installation
* can continue. debian-sources needs to install important files there.
*
* ERROR: sys-kernel/debian-sources-3.2.41 failed (preinst phase):
*   Please mount your /boot partition manually!
*
* Call stack:
*     ebuild.sh, line   93:  Called pkg_preinst
*   environment, line 2087:  Called mount-boot_pkg_preinst
*   environment, line 1896:  Called mount-boot_mount_boot_partition
*   environment, line 1885:  Called die
* The specific snippet of code:
*               die "Please mount your /boot partition manually!";
*
* If you need support, post the output of `emerge --info '=sys-kernel/debian-sources-3.2.41'`,
* the complete build log and the output of `emerge -pqv '=sys-kernel/debian-sources-3.2.41'`.
* The complete build log is located at '/var/tmp/portage/sys-kernel/debian-sources-3.2.41/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/sys-kernel/debian-sources-3.2.41/temp/environment'.
* Working directory: '/usr/lib/portage/pym'
* S: '/var/tmp/portage/sys-kernel/debian-sources-3.2.41/work/linux-3.2.41'
!!! FAILED preinst: 1

>>> Failed to install sys-kernel/debian-sources-3.2.41, Log file:
>>>  '/var/tmp/portage/sys-kernel/debian-sources-3.2.41/temp/build.log'

* Messages for package sys-kernel/debian-sources-3.2.41:

*
* To avoid automounting and auto(un)installing with /boot,
* just export the DONT_MOUNT_BOOT variable.
*
*
* Cannot automatically mount your /boot partition.
* Your boot partition has to be mounted rw before the installation
* can continue. debian-sources needs to install important files there.
*
* ERROR: sys-kernel/debian-sources-3.2.41 failed (preinst phase):
*   Please mount your /boot partition manually!
*
* Call stack:
*     ebuild.sh, line   93:  Called pkg_preinst
*   environment, line 2087:  Called mount-boot_pkg_preinst
*   environment, line 1896:  Called mount-boot_mount_boot_partition
*   environment, line 1885:  Called die
* The specific snippet of code:
*               die "Please mount your /boot partition manually!";
*
* If you need support, post the output of `emerge --info '=sys-kernel/debian-sources-3.2.41'`,
* the complete build log and the output of `emerge -pqv '=sys-kernel/debian-sources-3.2.41'`.
* The complete build log is located at '/var/tmp/portage/sys-kernel/debian-sources-3.2.41/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/sys-kernel/debian-sources-3.2.41/temp/environment'.
* Working directory: '/usr/lib/portage/pym'
* S: '/var/tmp/portage/sys-kernel/debian-sources-3.2.41/work/linux-3.2.41'

To fix this and proceed with the install process we need to:

cat /proc/mounts > /etc/mtab

Now we can re-emerge the debian-sources and it should install and compile correctly.

Thunar Mounting Internal Drives

This happens after emerging thunar in gentoo and funtoo for myself. Everytime.

Where I go to mount a drive with thunar I get a “Not Authorized” error.

To correct this we need to create a rule for polkit (so install polkit if you haven’t already).

This will cover the new version of polkit where the rules are now javascript based. This means the .pkla files we made before will no longer work.

To fix we create a file in /etc/polkit-1/rules.d/XX.rules where XX can be 10 or some other number.

polkit.addRule(function(action, subject) {
               if (action.id.indexOf("org.freedesktop.udisks") == 0) {
                       return polkit.Result.YES;
                   }
           });

This allws anyone to use udisks. So yeah.

Nagios Is Currently Not Checking for External Commands

You probably saw following message “Sorry, but Nagios is currently not checking for external commands, so your command will not be committed” when you tried to reschedule a service check in nagios web interface. The reason behind this is that nagios by default does not check for external commands. To resolve that problem we need to reconfigure nagios.

To enable checking for external commands we have to edit main nagios configuration file nagios.cfg, which is usually located in /etc/nagios3. You have to change below line

check_external_commands=0

to

check_external_commands=1

and restart nagios

/etc/init.d/nagios3 reload

When you try again to reschedule service check from web interface the following error can come up: Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!. This is because of the bug in Debian, which is described here http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571801. The solution is quite simple:

/etc/init.d/nagios3 stop
dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
/etc/init.d/nagios3 start

Cannot Start Apache2 in Gentoo

After installing apache via portage in gentoo we get this error:

/etc/init.d/apache2 start 

 * Starting apache2 ...
apache2: apr_sockaddr_info_get() failed for gentoo-test
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 * start-stop-daemon: failed to start `/usr/sbin/apache2'

To fix we need to do a few things, First we need to add a ServerName to our config:

vi /etc/apache2/httpd.conf
ServerName gentoo-test   #or whatever your hostname is

And then we need to have our host name actually in our hosts files

vi /etc/hosts
127.0.0.1    localhost gentoo-test #or whatever your hostname is

Then restart apache

/etc/init.d/apache2 restart

Syslog-ng Cannot Start on Debian in OpenVZ

After installing syslog-ng in an OpenVZ container some may be presented with this error:

Processing triggers for syslog-ng-core ...
[ ok ] Stopping system logging: syslog-ng.
[....] Starting system logging: syslog-ngError opening file for reading; filename='/proc/kmsg', error='Operation not permitted (1)'

To correct we will need to edit

/etc/defaults/syslog-ng

And uncomment this line:

...
SYSLOGNG_OPTS="--no-caps"
...

Then restart syslog

/etc/init.d/syslog-ng restart
[ ok ] Stopping system logging: syslog-ng.
[ ok ] Starting system logging: syslog-ng