2011-12-30

Scratch of the day - Back dated date

Did some sysctl tuning and need to monitor the log file every "yesterday". This is what I've managed to split out from "strftime" manual (via "date") :
# date
Fri Dec 30 09:59:27 MYT 2011

# date -v -1d +%b\ %Oe
Dec 29


With this, make cron send me an email with filtered entries of /var/log/messages :
1 1 * * * grep "`date -v -1d +\%b\ \%Oe`" /var/log/messages | mail -s "Yesterday ..." root@example.com

See ya !!!

2011-12-06

FreeBSD Foundation - 2011 Year End Fundraising Campaign

Another year is passing and the season of giving is coming !!!

This year, the FreeBSD Foundation is targeting to raise 400k. These funds will be put into the good use of FreeBSD related activities :

  • sponsor BSD conferences & events
  • sponsor developers to attend these conferences
  • protect the intellectual property of the FreeBSD project
  • marketing of FreeBSD project
  • hardware procurement for FreeBSD infrastructure
  • R & D to enhance the FreeBSD OS

(via here)

If you find that using FreeBSD is fun & useful, please donate to the foundation. Donating to the FreeBSD Foundation is the most effective way to promote & sponsor this wonderful OS. Plus, having your name on the donation list does draw some "feel good" feeling. :)

By the way, all it takes for your name to appear in the donation list is just mere USD 5. Click on this link to DONATE.

Adios !!!

2011-11-19

FreeBSD - HP DL 120 G7 hardware


Recently, I had a chance to test the compatibility of installing FreeBSD on an HP server. This are the specs of the server :

HP DL 120 G7 E3-1240
- 16gb DDR 3 ram
- dual nic port (HP NC112i 1-Port Ethernet Server Adapter (x2))
- Array Card (HP Smart Array P212/256MB Controller (RAID 0/1/1+0/5/5+0))


The NICs, Smart Array & hard disk all work fine.

Except this server came connected with the SATA hdd to the Smart Array. I've always skeptical about RAID cards, especially if the RAID card is faulty, we'll need to get the same RAID card in order for the data to be recognize. That sucks big time.

End up, I bypass the SATA hdd from Smart Array to the on-board connector. Now, ZFS is just ready to rock. :)

Ciao !!!

2011-10-30

FreeBSD - Mounting NFS share gives error "timed out"

Connecting to a NFS server from a FreeBSD installation hit an error. The command executed was :
mount -t nfs nfs.example.com:/vol/some/nfs/share /mnt/mount/point

The error :
[tcp] nfs.example.com:/vol/some/nfs/share: RPCMNT: clnt_create: RPC: Remote system error - Operation timed out


The firewall has open port 111 (portmapper) & 2049 (mountd), so that should clear some of the permission. But still no luck.

Checking network connections doesn't seems to show anything interesting, particularly in ESTABLISHED & LISTEN state connections.
E.g.
netstat -an

But checking the NFS server info from the NFS client do reveal some interesting info :
# rpcinfo nfs.example.com
   program version netid     address                service    owner
    100024    1    tcp       0.0.0.0.15.207         status     unknown
    100024    1    udp       0.0.0.0.15.207         status     unknown
    100011    1    udp       0.0.0.0.15.209         rquotad    unknown
    100021    4    tcp       0.0.0.0.15.205         nlockmgr   unknown
    100021    3    tcp       0.0.0.0.15.205         nlockmgr   unknown
    100021    1    tcp       0.0.0.0.15.205         nlockmgr   unknown
    100021    4    udp       0.0.0.0.15.205         nlockmgr   unknown
    100021    3    udp       0.0.0.0.15.205         nlockmgr   unknown
    100021    1    udp       0.0.0.0.15.205         nlockmgr   unknown
    100005    3    tcp       0.0.0.0.15.206         mountd     unknown
    100005    2    tcp       0.0.0.0.15.206         mountd     unknown
    100005    1    tcp       0.0.0.0.15.206         mountd     unknown
    100005    3    udp       0.0.0.0.15.206         mountd     unknown
    100005    2    udp       0.0.0.0.15.206         mountd     unknown
    100005    1    udp       0.0.0.0.15.206         mountd     unknown
    100003    3    tcp       0.0.0.0.8.1            nfs        unknown
    100003    2    tcp       0.0.0.0.8.1            nfs        unknown
    100003    3    udp       0.0.0.0.8.1            nfs        unknown
    100003    2    udp       0.0.0.0.8.1            nfs        unknown
    100000    2    tcp       0.0.0.0.0.111          rpcbind    unknown
    100000    2    udp       0.0.0.0.0.111          rpcbind    unknown

Seems like these services "mountd", "nlockmgr", "rquotad" & "status" are needed. Those services translate to port no. 4045, 4046, 4047 & 4049.

After opening these ports in firewall, the NFS share mount finally works.

Voilla !!!

2011-10-22

Cross cable color code



A note for myself. This is the cable code to crimp cross cable, to be use for PC to PC connectivity (without switch in between)

First end
1.w-gr
2. gr
3.w-or
4. bl
5.w-bl
6. or
7.w-br
8. br

The other end
1.w-or
2. or
3.w-gr
4. bl
5.w-bl
6. gr
7.w-br
8. br

or = orang
gr = green
bl = blue
br = brown
w = white

When using cable testing device, the LED should blink crossing :
  • 1 -> 3
  • 2 -> 6
  • 3 -> 1
  • 6 -> 2

Ciao !!!

2011-10-10

Perl - Modern Perl

Modern::Perl perl module automatically loads :
use warnings;
use strict;
use 5.010;
These are essential stuff to load and "use Modern::Perl;" (17 characters) loads it all. This saves typing and now, more reason to use "strict", "warnings" with "modern" perl features. :)

Adios !!!



Ref :

2011-10-02

FreeBSD - Updated device names in new GENERIC kernels











This just caught my attention. There's some changes in device naming convention for the latest GENERIC kernel, that comes with default installations of FreeBSD.

An abstract (via) :
The GENERIC kernels for all architectures now default to the new
CAM-based ATA stack. It means that all legacy ATA drivers were
removed and replaced by respective CAM drivers. If you are using
ATA device names in /etc/fstab or other places, make sure to update
them respectively (adX -> adaY, acdX -> cdY, afdX -> daY, astX -> saY,
where 'Y's are the sequential numbers starting from zero for each type
in order of detection, unless configured otherwise with tunables,
see cam(4)).

For more feeds on these, check out http://updating.versia.com/.

Ciao !!!

2011-09-29

FreeBSD - Nostalgic versions of FreeBSD

Was searching for archived versions of FreeBSD 4.11 and found this link through one of the README.TXT in the usual mirror ftp servers of FreeBSD.

Archive or old version of FreeBSD can be download from here :

ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/

Namaste !!!

2011-09-26

FreeBSD - Fun in typo for listing directory

Stumble across this port while doing some research. Go ahead and install it :

cd /usr/ports/games/sl
make install clean

Now, suppose we're gonna type "ls" for listing directory contains, but fat fingers make us type "sl" instead. After installing the port, try typing "sl" to list in the commandline and interesting stuff happens !


Misspelling directory listing ("ls") is never gonna be the same again ... :p

Shalom !!!

2011-09-23

FreeBSD - Another example why dotcom servers choose FreeBSD











1 million concurrent TCP session, what kind of app need this???

Is WhatsApp :D

"...
Over the past few months we have been making a lot of improvements to our servers to increase the performance, uptime and scalability. Today we have tuned some knobs, shifted some traffic around and achieved 1 million established tcp sessions on a single machine (and with memory and cpu to spare!)

$ netstat -an | grep -c EST
1016313

We are extremly proud of this achievement and wanted to share with other tech minded people out there. For those curious how we did it, the technology on the backend is simple: FreeBSD + Erlang
..."

Taken from here.

Ciao !!!

2011-09-18

FreeBSD - PHPMyAdmin Error on initial setup

After the first time installation of FAMP (FreeBSD, Apache, MySQL & PHP) with PHPMyAdmin, an error message pops out when visiting PHPMyAdmin's page. The error message goes like this :







Fatal error: Class 'ArrayObject' not found in /usr/local/www/phpMyAdmin/libraries/List.class.php on line 16

This is because the "ArrayObject" class is not enable in the required libraries and it can be solve by setup the proper parameters in php.ini. The recommended php.ini that comes with ports is sufficient to solve this problem. For my case, copying the recommended php.ini solve it. Here it goes :

2011-07-27

Perl - Apple finally bump Perl to 5.12.3

$ /usr/bin/perl -v

This is perl 5, version 12, subversion 3 (v5.12.3) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2010, 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.

Although this is not the latest of greatest but this is definitely better of version 5.10.0 :p

Adios !!!

2011-07-26

OSX - Macports upgrade outdated ports hits error

OS X Lion 10.7 just released and I've join in the club to upgrade my mac. As usual, macports needs to be refresh before knowing what it upgrade :
port -v selfupdate

Next, upgrade the ports as usual :

2011-05-20

Puppet - How to list facts in facter in Puppet


Was messing around puppet and trying to get a list of "facts". Google & searching on puppet labs didn't return any luck. Most of the search result points to bug reports.

With no luck at all, I gotta skim through the docs to find the list of facts for my new toy (puppet). Stumble this link that actually points where the light is.

In short, to list the facts of puppet, do this in command line :
facter  | less

Hopefully this post will shed some light onto people searching on how to list facts in puppet.

Ciao !!!

2011-04-29

FreeBSD - CPU code in dmesg meanings

Platform :
FreeBSD








Objective :
What are those CPU features flags means in "dmesg", e.g.
Features=0xfebfbff&ltFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,
PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS&gt
Features2=0x82982203&ltSSE3,PCLMULQDQ,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,
AESNI,&ltb31&gt&gt
AMD Features=0x28100000&ltNX,RDTSCP,LM&gt
AMD Features2=0x1&ltLAHF&gt

2011-04-22

Mysql - Error about packet too big while importing sql database












Q : While importing database in mysql, an error message pops out "ERROR 1153 (08S01) at line 232: Got a packet bigger than 'max_allowed_packet' bytes"
E.g.
$ mysql5 -u db_user -p db_table < db_table.sql 
Enter password: 
ERROR 1153 (08S01) at line 232: Got a packet bigger than 'max_allowed_packet' bytes
A : The file importing contains a statement that's probably too big, increase the value "max_allowed_packet" in my.cnf:

2011-04-18

Subversion - Branching and merging to release, stable or something else

Previously, we talk about the basic stuff of Subversion. This is still basic stuff :p


Is about managing source codes by branching. Branching is a way to have 2 or more sets of source code with each has it's own development, but eventually, merging them into the main trunk.

Example, in most development, we normally have "development" & "release" version. As word means, the "development" version is meant for development & testing. But the "release" version, would be the ultimate version that roll out for production use. For this example, "release" will be the trunk & "development" will be the branch.

A view of it :

web_blog(repository)
   |
   +release
   |  |
   |  +front_end
   |  |
   |  +engine
   | 
   | 
   +development
      |
      +front_end
      |
      +engine



To create this hierarchy :

2011-04-15

FreeBSD - How to check what services or port opening in tcp/udp

Platform :
FreeBSD

How to :
List/show what services or port is listening/opening.

Installation :
The command comes with base system.

2011-04-12

Nagios - Time within nagios is incorrect

Platform :
FreeBSD

Server :
Nagios

Problem :
Nagios's time stamp are incorrect, e.g. the comments section, the log file's time stamp. But the server's date, time & time zone are correct.

Cause :
Nagios configuration needs to specify the time zone offset, as well as the Apache's CGI module. These both settings make sure that nagios's time is in sync with the server's time.

Solution :

2011-04-11

AboutBSD.net - 20110411 Is back online, most of it

Managed to moved the site to another server and brought it back. If you're still seeing the "... Check back later ..." message, it is because the DNS record have not yet been refresh. Check back in another few hours.

The RSS feeds are up though. :)

2011-04-08

bash - working with ps

Platform :
FreeBSD

Objective :
To grab the process details of a pid, without resorting to parse the output of process status command , "ps" :
E.g.
ps aux | grep -i pid

2011-04-07

AboutBSD.net - 20110406 not accessible

AboutBSD.net, a BSD news planet maintain by me is currently unavailable due to some hardware issue. Please check back later.

2011-04-04

Bash - How to debug shell script

Although Bash will spit out the errors onto the screen whenever it hits one, but some times, we want to know what exactly was being done every single command it executed.

This is how to do it :
Before running the bash script, do a :
set -x
then run the script and it'll be tell every action that it performs.

This is especially useful when debugging logic.

After finding out what's wrong, this is how to turn it off :
set +x

Alternatively, to debug only when running this script, put the below line in the start of the script :
set -x
Arrivederci !!!

2011-04-01

FreeBSD - Behold, The Great Committer

Please don't scroll pass this post. This urgent & definitely needs your attention :
FreeBSD has always been something of a meritocracy, where the respect given to committers is directly proportional to the amount and quality of code they commit. This is tracked in the commit statistics. For many years, Poul-Henning Kamp (phk@) was the undisputed leader, but in 2010 his total was exceeded by relative newcomer John Baldwin (jhb@). Baldwin’s commits show no sign of slowing, and if he continues at this pace, he will soon overtake the combined totals of Foundation President Robert Watson and embedded emeritus Warner Losh.

Oh ya, make sure you have a mattress or you're stepping on a soft ground before you get hurt. Read on more here !!!

Ciao !!!

Perl - How to DOS your processor

Here's a way to maximize the CPU processor,

2011-03-28

Sendmail - How to test sending email, verbosely using Sendmail




Mail Server :

Sendmail

Purpose :

To verbosely test sending of email using sendmail

Here how :

Prepare a file with name "mail.txt". This will be the email header & contents that we wanna include when test sending this email. The contents of the file should look like below :

2011-03-25

PC-BSD - Error when restarting pf firewall or within Ports Jail

Trigger :

When pf service is restarted







Error messages :

# /etc/rc.d/pf restart
Disabling pf
pf disabled
.
Enabling pf
no IP address found for lo1:network
/etc/pf.conf:4: could not parse host specification
no IP address found for lo1:network
/etc/pf.conf:5: could not parse host specification
pfctl: Syntax error in config file: pf rules not loaded
pf enabled
.

Side Effect :

When running "Ports Jail" terminal with portsnap or installation, it will failed because there's not internet connection present.

Why :

The interface "lo1:network" is missing due to abnormal shutdown of "portjail" service.

2011-03-18

RFC 2606 - Domain names for testing

In this blog, often the output or the example used needed to be masked before posting. To protect the original server/identity. But when it comes to domain names, we can't simple quote some random name, it might be an active domain (in the future, if not now).


Also, for documentation or presentation, we tend to use mock up domain, server or host name. How to make sure that server, domain or host name is not in used?

In RFC 2606, there are domain names that serve this purpose :

2011-03-11

RFC 2142 - Mailbox Names for Common Services, Roles and Functions

RFC stands for Request For Comments. Not all RFC documents end up as standards. But it is indeed a good read to find out how standards works. For example, RFC 2142 list emails that should be reserve for its purpose :

2011-03-04

2011-02-28

Perl - How to uninstall / delete Perl module

Installing Perl modules can use the cpanm utility, but how about removing Perl modules? App::pmuninstall module is the answer!

Installation :

$ cpanm App::pmuninstall
--> Working on App::pmuninstall
Fetching http://search.cpan.org/CPAN/authors/id/X/XA/XAICRON/App-
pmuninstall-0.16.tar.gz ... OK
Configuring App-pmuninstall-0.16 ... OK
Building and testing App-pmuninstall-0.16 ... OK
Successfully installed App-pmuninstall-0.16

Usage :

2011-02-25

vim - How to stop vim creating "tilde" backup files

Vim, aka the Programmer's Editor, by default creates backup files (ends with a tilde character) whenever editing file. E.g. myfile~, another_file~, yet_another_file~ and etc.

After some time, this generates too many backup laying around the file system. Too messy. This is how to stop vim create these backup files :

2011-02-21

Perl - How to find out what Core Modules installed

Perl comes with a set of core modules. Perl core modules comes with default installation.
E.g. :
- Env
- File::Spec
- File::Basename
- Time::localtime

These are just some of the gems to a system administrator. So, how to find out what core modules are included with your perl installation?




Here's how :

2011-02-18

FreeBSD - How to change screen to use BASH

Purpose :
Make screen, the virtual terminal program, changes the user's default shell from tcsh to BASH when starting.

Command :

2011-02-11

Bash - How to output all (stdout & stderr) into log file in Bash

Purpose :
When scripting Bash scripts, often we'll need to output all stdout & stderr of a particular command into a log file, for logging purposes or diagnostic purposes.






Command :

2011-02-07

FreeBSD - How to check device or CPU performance

Platform :
FreeBSD

Purpose :
Monitoring disk read/write activity.

Command :
iostat


Installation :
The "iostat" command comes with the base installation.

Useful switches :
-w == update frequency, in seconds
-d == only show devices, hdd related
-C == show CPU activity only

Example :

2011-02-04

ssh - How to pipe output from local to remote server

In Bash, with pipe (the "|" symbol) and ssh makes a good combination of server administration tool, securely. Some examples :

2011-01-31

FreeBSD - How to reduce TIME_WAIT connections

Routinely, I did a "netstat -an" on a FreeBSD box, a DNS server. The screen then shower with hundreds of "TIME_WAIT" connections. Seems like some malware infected clients are querying the server and causes the terminated TCP socket waiting to be shutdown, but not fast enough, to be efficient. Fortunately, the numbers of TIME_WAIT sockets accumulated are insignificant.

In order to reduce the number of socket waiting, tune the system value :

2011-01-28

FreeBSD - How to make changes to sendmail, FreeBSD styled

Sendmail is the default MTA in FreeBSD. FreeBSD has its own way in managing sendmail's configuration files. Instead of making changes to sendmail.mc, changes should be made to $(hostname).mc. Similarly for submit.mc, changes should be $(hostname).submit.mc.

Here's how :

2011-01-24

FreeBSD - How to test newsyslog for systax error

Platform :
FreeBSD

Purpose :
Syntax checking after creating a new logrotate in "newsyslog"

Command :
newsyslog


Installation :
The "newsyslog" log rotation program comes with the base installation.

Useful switches :
-n == DO NOT actually do the logrotate. Instead, show what will be perform
-vv == verbose on what newsyslog is doing

Example :

2011-01-21

BIND - Error "loading from master file managed-keys.bind failed: file not found"

Platform :
FreeBSD

Error message :
Every time restarting the BIND DNS server, the log file will have this entry :
general: error: managed-keys-zone ./IN: loading from master file managed-keys.bind failed: file not found
BIND DNS continue to work though.

Solution :
Create a empty file in /var/named/etc/namedb, name "managed-keys.bind":
touch /var/named/etc/namedb/managed-keys.bind

Why :
The file "managed-keys.bind" is used for managing keys in DNSSEC. By default, BIND is looking for it. Even though you might not be using this feature, creating the file in empty will make the error message go away.


Sayonara !!!

2011-01-17

2011-01-14

OSX - How to maximize window using keyboard shortcut

By default, OSX does not comes with a shortcut, though there's a function for it. To make use of it, we'll need to assign a keyboard shortcut key to maximize or un-maximize window.








Here's how to do it :
  1. Open the "System Preferences"
  2. Under the "Hardware" section, click on "Keyboard"
  3. Next, click on "Keyboard Shortcuts" then "Application Shortcuts" (on the left hand box)
  4. Add a shortcut key by clicking on "+" symbol, on the bottom of the right hand box
  5. At the next dialog box, choose "All Applications" for "Application:"
  6. In the "Menu Title :" column, type in "Zoom"
  7. Click on the next column, "Keyboard Shortcut:", then press your preferred keyboard shortcut.
    E.g. Control + Option + Command + m (you didn't read wrongly, is 4 keys there :p)

    *** Avoid popular shortcut key, e.g. Command + v

Now, open an application and try the new keyboard shortcut key. Press the first time for maximized and the second time to return the previous size.

Nemaste !!!

2011-01-10

FreeBSD - portupgrade php5 got hiccups with security/php5-filter

During the routing upgrading of ports, caught a hiccups while upgrading php5 related packages.

One of the port failed to upgrade after issuing "portupgrade -vr php5*".







The errors :
===>  Building for php5-filter-5.3.4
/bin/sh /usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/libtool --mode=compile cc  -I. -I/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter -DPHP_ATOM_INC -I/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/include -I/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/main -I/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -O2 -fno-strict-aliasing -pipe   -c /usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c -o logical_filters.lo
 cc -I. -I/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter -DPHP_ATOM_INC -I/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/include -I/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/main -I/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -O2 -fno-strict-aliasing -pipe -c /usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c  -fPIC -DPIC -o .libs/logical_filters.o
In file included from /usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:25:
/usr/local/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:25:
/usr/local/include/php/ext/pcre/php_pcre.h:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/local/include/php/ext/pcre/php_pcre.h:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/local/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before 'pcre'
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c: In function 'php_filter_validate_regexp':
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:411: error: 'pcre' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:411: error: (Each undeclared identifier is reported only once
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:411: error: for each function it appears in.)
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:411: error: 're' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:412: error: 'pcre_extra' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c: In function 'php_filter_validate_email':
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:527: error: 'pcre' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:527: error: 're' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.4/ext/filter/logical_filters.c:528: error: 'pcre_extra' undeclared (first use in this function)
*** Error code 1
1 error
*** Error code 1

Stop in /usr/ports/security/php5-filter.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade20101224-47314-9ktu04-0 env UPGRADE_TOOL=portupgrade UPGRADE_PORT=php5-filter-5.2.11_1 UPGRADE_PORT_VER=5.2.11_1 make
** Fix the problem and try again.
--->  Build of security/php5-filter ended at: Fri, 24 Dec 2010 09:36:27 +0800 (consumed 00:00:43)
--->  Upgrade of security/php5-filter ended at: Fri, 24 Dec 2010 09:36:27 +0800 (consumed 00:00:43)
--->  ** Upgrade tasks 1: 0 done, 0 ignored, 0

Checking out /usr/ports/UPDATING and /usr/ports/MOVED doesn't seems to give a hint. Next try on Forum.FreeBSD.org shed light on this :

2011-01-07

Bash - How to check the exit status of pipe command


Piping in bash commands are common.
Checking exit status of a command in bash scripting is essential.
How about checking exit status of the commands in a pipe?





Example:

2011-01-03

FreeBSD - Port p5-Encode-Detect error

While patching one of the FreeBSD box, a perl module port, converters/p5-Encode-Detect-1.01, failed to compile. This is the abstract of the error message :







===>  Extracting for p5-Encode-Detect-1.01
=> SHA256 Checksum OK for Encode-Detect-1.01.tar.gz.
===>   p5-Encode-Detect-1.01 depends on file: /usr/local/bin/perl5.8.9 - found
===>  Patching for p5-Encode-Detect-1.01
===>   p5-Encode-Detect-1.01 depends on file: /usr/local/bin/perl5.8.9 - found
===>   p5-Encode-Detect-1.01 depends on file: /usr/local/lib/perl5/site_perl/5.8.9/ExtUtils/CBuilder.pm - found
===>   p5-Encode-Detect-1.01 depends on file: /usr/local/lib/perl5/site_perl/5.8.9/Module/Build.pm - found
===>   p5-Encode-Detect-1.01 depends on file: /usr/local/bin/perl5.8.9 - found
===>  Configuring for p5-Encode-Detect-1.01
Warning: ExtUtils::CBuilder not installed or no compiler detected
Proceeding with configuration, but compilation may fail during Build

Creating new 'MYMETA.yml' with configuration results
Creating new 'Build' script for 'Encode-Detect' version '1.01'
===>  Building for p5-Encode-Detect-1.01
Building Encode-Detect
Error: no compiler detected to compile 'src/LangBulgarianModel.cpp'.  Aborting
*** Error code 2

Stop in /usr/ports/converters/p5-Encode-Detect.

It seems like the port devel/p5-ExtUtils-CBuilder didn't quite compile it's option and installed properly. Reinstalling devel/p5-ExtUtils-CBuilder didn't help. Re-compile all of the dependency of converters/p5-Encode-Detect & devel/p5-ExtUtils-CBuilder also didn't work as well.

The error message does strongly suggest that there's problem with devel/p5-ExtUtils-CBuilder. It's time to get my hands dirty, by manually compiling the port devel/p5-ExtUtils-CBuilder :