Random useful linux notes

Lighttpd max FDS

If you run a very busy lighttpd you may get the following:

(network_linux_sendfile.c.143) open failed: Too many open files
(connections.c.606) connection closed: write failed on fd 588
(network_linux_sendfile.c.143) open failed: Too many open files
(connections.c.606) connection closed: write failed on fd 782
(network_linux_sendfile.c.143) open failed: Too many open files
(connections.c.606) connection closed: write failed on fd 782
(network_linux_sendfile.c.143) open failed: Too many open files
(connections.c.606) connection closed: write failed on fd 782

You should increase the file descriptors that lighttpd can used (put into the lighttpd.conf):

server.max-fds = 8192

You may also want to increase the max-workers (also goes into the lighttpd.conf):
http://redmine.lighttpd.net/wiki/lighttpd/Docs%3AMultiProcessor

server.max-worker = 8

This is going to make 8 threads, so depending on your exact setup you may wish to increase or decrease the value.

Centos 5.3 yum iniparse breaking

Following upgrading to CentOS 5.3 the following error was encountered with yum:

# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named iniparse

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.4.3 (#1, Jan 21 2009, 01:11:33)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

It turns out the python-iniparse rmp was for some reason not installed correctly. I ended up having to --force it but that fixed it.

rtorrent compile errors

While compiling libtorrent-0.12.2 and rtorrent-0.8.2 on CentOS 5 32 i386 the following error was obtained while compiling rtorrent.

checking for STUFF... configure: error: Package requirements (sigc++-2.0 libcurl >= 7.12.0 libtorrent >= 0.12.2) were not met:

No package 'libtorrent' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables STUFF_CFLAGS
and STUFF_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

The fix was just sym-linking the libtorrent.pc file into the correct pkgconfig directory. Afterwards it compiled fine.

ln -s /usr/local/lib/pkgconfig/libtorrent.pc /usr/lib/pkgconfig/

Configserver mailscanner constant reload

After a MailScanner updates the following error was present:

Feb 25 14:50:14 server MailScanner: Process did not exit cleanly, returned 1 with signal 0

Previous to the update was a fresh install of MS in which it would start then immediately try to start again.

# /usr/mailscanner/bin/MailScanner --debug
In Debugging mode, not forking...
Trying to setlogsock(unix)
rules: failed to run CG_FUJI_JPG test, skipping:
(Can't locate object method "image_name_regex" via package "Mail::SpamAssassin::PerMsgStatus" at (eval 1607) line 1169.
)
rules: failed to run CG_DOUBLEDOT_GIF test, skipping:
(Can't locate object method "image_name_regex" via package "Mail::SpamAssassin::PerMsgStatus" at (eval 1607) line 1394.
)
rules: failed to run CG_SONY_JPG test, skipping:
(Can't locate object method "image_name_regex" via package "Mail::SpamAssassin::PerMsgStatus" at (eval 1607) line 2309.
)
rules: failed to run CG_CANON_JPG test, skipping:

Awstats geoip error

While running /scripts/runweblogs USERNAME the following error was generated:

About to fork for USERNAME [ALL DOMAINS: DOMAIN.com]
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/Geo/IPfree.pm line 81.
Create/Update database for config "/home/USERNAME/tmp/awstats/awstats.DOMAIN.com.conf" by AWStats version 6.9 (build 1.925)

A downgrade of GeoIP to 0.2 solved this error:

cd /home/.cpan/sources
wget http://search.cpan.org/CPAN/authors/id/G/GM/GMPASSOS/Geo-IPfree-0.2.tar.... (external link)
tar -zxvf Geo-IPfree-0.2.tar.gz
perl Makefile.PL
make
make install

Bandwidthdb modules error

While running /scripts/runweblogs USERNAME the following was given:

(internal warning while parsing ) Wed Feb 25 09:42:57 2009 [5035] warn: Use of uninitialized value in modulus (%) at /usr/local/cpanel/Cpanel/BandwidthDB.pm line 185.
at /usr/local/cpanel/Cpanel/BandwidthDB.pm line 185
Cpanel::BandwidthDB::update('Cpanel::BandwidthDB=HASH(0x86be22c)', 'smtp', 'undef', 698) called at /usr/local/cpanel/Cpanel/Logd.pm line 1746
Cpanel::Logd::parseeximlog('USERNAME', 1073741824, 'HASH(0x86be0ac)', 'Cpanel::BandwidthDB=HASH(0x86be22c)') called at /usr/local/cpanel/Cpanel/Logd.pm line 645
Cpanel::Logd::updatebw('USERNAME', '/home/USERNAME', 32005, 'domain.com', 'unlimited', 'ARRAY(0x86b751c)') called at /usr/local/cpanel/libexec/cpanellogd line 179

/scripts/checkperlmodules

was able to correct the perl module error and let it run fine next time.

CSF install and perl errors

While installing csf sometimes it cannot find the UserAgent.pm

# ./install.generic.sh

Kernel binrpm-pkg error on compiling

While source compiling a kernel with make binrpm-pkg to generate an RPM the following error was encountered.

rpm --define "_builddir /usr/local/src/linux-2.6.27.10" --target x86_64 -bb /usr/local/src/linux-2.6.27.10/binkernel.spec
--target: unknown option

make[1]: *** [binrpm-pkg] Error 1
make: *** [binrpm-pkg] Error 2

The solution is simply install the rpm-build package within CentOS 5.x 64bit and most other linux OS.

Sphinx install problems

While doing a make on sphinx we got:

sphinx.cpp:16792: error: ‘m_pMysqlFields’ was not declared in this scope
sphinx.cpp:16793: error: ‘m_pMysqlResult’ was not declared in this scope
sphinx.cpp:16793: error: ‘mysql_fetch_fields’ was not declared in this scope
sphinx.cpp:16795: error: ‘m_pMysqlFields’ was not declared in this scope
make[2]: *** [sphinx.o] Error 1
make[2]: Leaving directory `/usr/local/src/sphinx-0.9.8.1/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/local/src/sphinx-0.9.8.1/src'
make: *** [all-recursive] Error 1

simply install mysql-devel rpm and should compile fine.

cPanel email inconsistent quota

If a cPanel email user quota does not match what is being reported by the system or a mail client run the following to determine how much space has been used for real:

du -hs /home/username/mail/userdomain.com/user/

then compare it with what cPanel reports for the disk usage, if they are different delete:

/home/username/mail/domain.com/user/maildirsize

finally re-login to cPanel and it should be resolved.

SpamAssasin failing with "Transport filter process failed (127): unable to execute command"

SpamAssassin was failing to deliver emails with the following message:

SMTP connection from USERNAME lost while reading message data (header)
1H4zGX-0000KH-FH == user@domain.com R=virtual_sa_user T=virtual_sa_userdelivery defer (-24): Transport filter process failed (127): unable to execute command

To fix force a reinstall of the perl module:

perl -MCPAN -e shell
clean Mail::SpamAssassin
install Mail::SpamAssassin

Problems with RBL lists

While I do not think that anybody is going to say that ALL RBL lists for email are a bad thing there are some problems with using them that if you are not careful can cause end users problems. In general they will help a lot but depending on how your mailserver is configured they have the potential to cause just as many heart aches.

The other day we had a few clients complaining that when they sent emails it would take 5-10 seconds most times before they were able to send from their local computer. While not a lot of time it is enough that people were complaining about it. What ended up being the problem was that an RBL list the server was using was having trouble so every time somebody sent an email the RBLs were queried and the 10 seconds was the amount of time it took for the RBL to timeout.

This particular server was Plesk so the /etc/rc.d/init.d/smtp_psa and smtps_psa is where the actual RBLs are stored. The server_args line (shown below) contains all of the lists currently being used to scan email:

php up2date problems with cPanel

While I am not sure why recently I have seen a few cPanel servers with the php rpms installed on them. If you have this problem the following can be done to add php back to the skip list:



up2date --config
20


paste in this:


spamassassin*;httpd*;perl;mysql*;php*;mod_ssl*;courier*;kernel*;exim*;proftpd*;pure-ftpd*;squirrelmail*;

to exit and save

Now go ahead and rpm -qa |grep php and remove the php rpms that are installed. Additionally if you are on a 64bit Redhat Enterprise (RHEL) or CentOS version 3 or 4 you may also need to run:



ln -s /usr/lib64/libmysqlclient.so /usr/lib/libmysqlclient.so


to fix a problem this:

configure: error: Cannot find libmysqlclient library under /usr

n/a

n/a

Powered by Drupal - Theme created by Danger4k