LDAP: troubleshooting “I have no name!”

After performing some security related OS updates, i was receiving from LDAP all sort of strange errors. Like, when you logged on the ldap server as a regular ldap user (not system user) the regular user@host:~$ prompt changed to:
I have no name!@host:~$
Read the rest of this entry »

Tags: ,

Ext3 - Reserved blocks percentage

According to tune2fs manual, reserved blocks are designed to keep your system from failing when you run out of space. Its reserves space for privileged processes such as daemons (like syslogd, for ex.) and other root level processes; also the reserved space can prevent the filesystem from fragmenting as it fills up. By default this is 5% regardless of the size of the partition.

On large partitions (250GB drives and up are quite common these days), the default 5% reserved space can be quite a lot (12.5Gb in my example). For ext3 partitions you can tune this parameter by using tune2fs with the parameter -m. For ex. to decrease this to 3% you would run (for ex. on /dev/sda1):
tune2fs -m3 /dev/sda1
You should be very careful when ‘playing’ with this parameter and be sure you know what you are doing before changing this value. ;-)

Tags:

Mount remote folders via SSH

This document describes how to install and use sshfs, a FUSE based filesystem that uses SSH to mount remote folders. Since it is based on FUSE (userspace filesystem framework for Linux) your kernel will need to have the fuse module available. FUSE is included in kernel newer than 2.6.14, so I will assume that you will have it already included in your kernel.

Read the rest of this entry »

Tags: , , ,

MySQL skip duplicate replication errors

Normally MySQL replication will stop whenever there is an error running a query on the slave. This happens in order for us to be able to identify the problem and fix it, and keep the data consistent with the mater that has sent the query. You can skip such errors, even if this is not recommended, as long as you know really well what are those queries and why they are failing, etc.

For example you can skip just one query that is hanging the slave using:
mysql>SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;

There might be cases where you will want to skip more queries. For example you might want to skip all duplicate errors you might be getting (output from show slave status;):
"1062 | Error 'Duplicate entry 'xyz' for key 1' on query. Default database: 'db'. Query: 'INSERT INTO ..."

Read the rest of this entry »

Tags: ,

Linux Tips: find all files of a particular size

The Unix find command is a very powerful tool, and this short post is intended to show how easy you can achieve something that might look complicate: to find all the files of a particular size. Let’s assume you are searching for all the files of exactly 6579 bytes size inside the home directory. You will just have to run something like:

find /home/ -type f -size 6579c -exec ls {} \;

As units you can use:

  • b - for 512-byte blocks (this is the default if no suffix is used)
  • c - for bytes
  • w - for two-byte words
  • k - for Kilobytes (units of 1024 bytes)
  • M - for Megabytes (units of 1048576 bytes)
  • G - for Gigabytes (units of 1073741824 bytes)

Read the rest of this entry »

Tags:

Installing Pear Beta Packages

Here is a quick tip that will show several methods how you can install pear beta packages. Normally if you will try to install a pear package that has not released yet a stable version, you will receive an error like:

pear install Translation2
Failed to download pear/Translation2 within preferred state "stable", latest release is version 2.0.0RC3, stability "beta", use "channel://pear.php.net/Translation2-2.0.0RC3" to install
Cannot initialize 'channel://pear.php.net/Translation2', invalid or missing package file
Package "channel://pear.php.net/Translation2" is not valid
install failed

Read the rest of this entry »

Tags:

gcc: error trying to exec ‘cc1plus’: execvp: No such file or directory

While I was installing some software on a client machine I got the following error:

gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1

Even though this doesn’t matter so much (as it can happen in other cases also) the software that I was trying to install was the perl module Encode::Detect.

Read the rest of this entry »

Tags: ,

Linux Tips: How to quickly bind a range of IPs on RedHat based systems

In this short post I will show you how you can quickly add a range of IPs on any RedHat based system (Rhel, Centos, Fedora, etc). When you have to add many IPs to a system this can be quite handy and save a lot of time.
Read the rest of this entry »

Tags: , , , ,

Apache Tips & Tricks

Here you can find various tips & tricks for configuring and administrating Apache that I found to be useful. Once I will add a new tip, I’ll link it here so you can use this page as a main placeholder for all the tips I will post in the future. Each tip will consist in a very short description, what is it used for, where can you apply it (globally, per directory or per virtual hosts, if it can be activated without administrative privileges in .htaccess) and of course a how to implement it. I will try to keep each tip as short as possible and on a single topic so you can go directly to what you are looking for. Read the rest of this entry »

Tags: , , , ,

Determining NPTL version

Most recent linux distributions (CentOS 4, Fedora 3+, RHE 4, etc) are NPTL (Native POSIX Thread Library) based. If you want to check if your system is NPTL based, or only if you want to find out what version it is present in your kernel, you can use the following command:

getconf GNU_LIBPTHREAD_VERSION

Sample results:
On a Debian Etch system:

getconf GNU_LIBPTHREAD_VERSION
NPTL 2.3.6

On a RHEL4 system:

getconf GNU_LIBPTHREAD_VERSION
NPTL 2.3.4

For a detailed description on NPTL you can check wikipedia.

Tags: , ,