Archive for FreeBSD Server

Cpanel Show Current Disk Usage not working

In a Cpanel server running FreeBSD 5.4, Show Current Disk Usage link on WHM is not working. It shows error

Software error:

Can’t locate GD.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.6.2/mach /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.6.2/BSDPAN /usr/local/lib/perl5/5.6.2/mach /usr/local/lib/perl5/5.6.2 . /usr/local/cpanel /usr/local/cpanel/whostmgr/docroot/cgi) at ./cgi/diskusage.cgi line 9.
BEGIN failed–compilation aborted at ./cgi/diskusage.cgi line 9.

For help, please send mail to this site’s webmaster, giving this error message and the time and date of the error.

So i checked if GD.pm is installed

server20# locate GD.pm
/usr/local/lib/perl5/site_perl/5.8.6/GD/SecurityImage/GD.pm
/usr/local/lib/perl5/site_perl/5.8.6/mach/GD.pm
server20#

I found it is installed in a different location. The script look at

/usr/local/lib/perl5/5.6.2/

but it is available at

/usr/local/lib/perl5/site_perl/5.8.6/

It seems two version of perl installed on the server, i check installed versions of perl with

server20# pkg_info|grep perl
bsdpan-Archive-Zip-1.16 Unknown perl module
bsdpan-CPAN-1.80 CPAN - query, download and build perl modules from CPAN sit
bsdpan-Expect-1.15 Unknown perl module
bsdpan-IO-Stty-.02 Unknown perl module
bsdpan-Parse-RecDescent-1.94 Unknown perl module
bsdpan-Term-ReadLine-Perl-1.0203 Unknown perl module
bsdpan-TermReadKey-2.30 Term::ReadKey - A perl module for simple terminal control
bsdpan-XML-Parser-2.34 XML::Parser - A perl module for parsing XML documents
bsdpan-libwww-perl-5.803 LWP - The World-Wide Web library for Perl
perl-5.6.2_2 Practical Extraction and Report Language
perl-5.8.6_2 Practical Extraction and Report Language
server20#

So i uninstalled old version of Perl

server20# pkg_delete perl-5.6.2_2
pkg_delete: ‘/usr/local/bin/perl’ fails original MD5 checksum - not deleted.
pkg_delete: couldn’t entirely delete package (perhaps the packing list is
incorrectly specified?)
Removing stale symlinks from /usr/bin…
Removing /usr/bin/perl
Removing /usr/bin/perl5
Skipping /usr/bin/suidperl
Done.
Cleaning up /etc/make.conf… Done.
Cleaning up /etc/manpath.config… Done.
server20#

Now i checked Perl installations

server20# /usr/local/bin/perl -v

This is perl, v5.8.6 built for i386-freebsd-64int
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl’ or `perldoc perl’. If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

server20# /usr/bin/perl -v
/usr/bin/perl: Command not found.

/usr/bin/perl is not available, so i created a symlink to it.

server20# ln /usr/local/bin/perl /usr/bin/perl
server20# /usr/bin/perl -v

This is perl, v5.8.6 built for i386-freebsd-64int
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl’ or `perldoc perl’. If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

server20#

Now everything is working fine.

Comments off

portupgrade - upgrading installed ports

Today i have upgraded software packages installed on my FreeBSD 5.4 server. This is done with utility called portupgrade. To upgrade installed ports, you have to first install portupgrade from ports.

Check if you have portupgrade package already installed

# pkg_info | grep portupgrade
portupgrade-20041226_2 FreeBSD ports/packages administration and management tool s
#

If you don’t get any result, you don’t have portupgrade installed. You need to install it. To install portsupgrade, do the following.

# cd /usr/ports/sysutils/portupgrade
# make install clean
# rehash

Now you have portsupgrade installed on your FreeBSD server,

Next we will upgrade ports database

/usr/local/sbin/portsdb -Uu

Next we will find out which ports need updated, to do this, use the command

# /usr/local/sbin/portversion -l ”

Once we find out the ports that need upgraded, we can upgrade the ports with command

# /usr/local/sbin/portupgrade -arR

Now all ports will get upgraded.

# Run
# /usr/local/sbin/pkgdb -F
# if you are prompted to.

If some thing goes wrong, you can go back with

# Run
# /usr/local/sbin/pkgdb -fu
# if everything goes wrong.

Pray before doing this, so nothing goes wrong :-)

Comments (1)

Upgrading FreeBSD Ports with portsnap

I used to upgrade FreeBSD ports tree with CVSup. I run it through cron everyday.

Today found a much better way to upgrade FreeBSD ports tree - portsnap

portsnap is more efficient and secure way to upgrade ports tree. Here is how to install portsnap

First find location of portsnap in your ports tree.

# cd /usr/ports
freebsd# make search name=portsnap
Port: portsnap-0.9.4
Path: /usr/ports/sysutils/portsnap
Info: Provides secure snapshots of the ports directory
Maint: cperciva@daemonology.net
B-deps:
R-deps: bsdiff-4.2
WWW: http://www.daemonology.net/portsnap/

So we find the portsnap is available in ports tree at /usr/ports/sysutils/portsnap. To install

# cd /usr/ports/sysutils/portsnap
# make install

Before you can use portsnap, you will have to create an update configuration
file specifying the server from which to fetch snapshots and the sha256 hash
of the openssl public key which is trusted to sign the snapshots.

A sample configuration file has been installed in

/usr/local/etc/portsnap.conf.sample

which will fetch snapshots built and signed by the author. If you want to
use these updates, copy that file to

/usr/local/etc/portsnap.conf

otherwise, create that file as appropriate.

NOTE TO USERS UPGRADING FROM PORTSNAP 0.3.1 OR EARLIER: The structure
of the portsnap configuration file has changed; you will have to replace
your existing portsnap.conf with a new version.

Now portsnap is installed and ready to use. Before you can use any newly installed program, you should run rehash.

# rehash

Creating configuration file for portsnap

# cd /usr/local/etc/
# cp portsnap.conf.sample portsnap.conf

portsnap command with out any parameter will display help

# portsnap
usage: portsnap [options] command [URL | path]

Options:
-d workdir — Store working files in workdir
(default: /usr/local/portsnap/)
-f conffile — Read configuration options from conffile
(default: /usr/local/etc/portsnap.conf)
-I — Update INDEX only. (update command only)
-k KEY — Trust an RSA key with SHA1 hash of KEY
-p portsdir — Location of uncompressed ports tree
(default: /usr/ports/)
URL — Fetch updates from given URL. (fetch / cron commands only)
path — Extract only parts of the tree starting with the given
string. (extract command only)
Commands:
fetch — Fetch a compressed snapshot of the ports tree,
or update an existing snapshot.
cron — Sleep rand(3600) seconds, and then fetch updates.
extract — Extract snapshot of ports tree, replacing existing
files and directories.
update — Update ports tree to match current snapshot, replacing
files and directories which have changed.

Running portsnap fetch

# portsnap fetch
Fetching public key… done.
Fetching snapshot tag… done.
Fetching snapshot metadata… done.
Fetching snapshot generated at Tue Nov 15 06:58:14 IST 2005:
Receiving e505da4cc61d5dcd62af26aa7ec4f119f5ba1a4 (38309460 bytes): 0% (ETA 48:25:07)

This take some time, it is downloading a 38309460 bytes (38 MB) file. It seems CVSUP is better on my local pc as it won’t download 38 MB when i upgrade ports tree.

May be this is because it is running for first time. Lets wait and see.

Comments off

Upgrading FreeBSD 5.3 to FreeBSD 5.4

FreeBSD can easily upgraded to latest version. Recently i have upgraded my FreeBSD 5.3 server to FreeBSD 5.4.

Upgrading FreeBSD 5.3 to FreeBSD 5.4

Comments off

« Previous entries · Next entries »