2010-01-08

FreeBSD - Ports is fetching from slow servers

Ports randomly gets it's source server list from /usr/ports/Mk/bsd.sites.mk, as defined by the port maintainer. But the top 1st choice of the list may not be the one physically near to us and thus the download speed is much desirable. Most of the time compiling ports doesn't necessary takes a long time (like my 3 years AMD athlon 1.8Ghz perform fairly good). In fact, downloading of the sources is the one that takes a long time.

In this case, we'll need to tune the ports so that it fetches the sources from the nearest (physically) server. A nearer server normally means less latency and less latency means faster connection (this may not be the whole truth but truth is in it. :p)

The port "fastest_sites" will test the latency of the server listed in /usr/ports/Mk/bsd.sites.mk and output to a file. The file is suitable to be included in /etc/make.conf which tell ports where to fetch the sources from.

Here it is how to:

2010-01-07

Gimp - How to convert background of logo or picture into transparency

Gimp stands for "GNU Image Manipulation Program", which is an open source image editing problem. It's capability often compare to professional software but fortunately, Gimp acceptance as Pro image editing software is getting better. Even so, Gimp is still popular among beginner up to hobbyist user.

Gimp's available on multiple platform and since it is open source, you can bet it's available on BSDs.

This post will brief through how to transform a logo or picture to transparent background, suitable for dark or colored web page background.

2010-01-06

FreeBSD - Compilation errors on port KDE4 in FreeBSD 8.0

While adding GUI Desktop environment into my development box, an error encountered when compiling KDE4, the stable and nice looking Desktop environment. Compiling KDE4 can take quite some time as it depends on few hundred other ports. Alternatively, you can install KDE4 from the packages by using the command :
pkg_add -r kde4

But installing programs using ports is always my preference. Although ports takes additional time to compile but the flexibility to configure what options to enable or disable is preferred. By using ports, it also allows us to search (make quicksearch name=port-name) the local repository (/usr/ports) on what other related programs we can have.

Back to the topic. Halfway ports compiling KDE4, it halted with an error compiling the port "kdebase-runtime-4.3.4". Instead of searching the errors in a one big whole of logs, manually compile /usr/ports/x11/kdebase4-runtime to zoom in the error. Below is what the ports complained about while installing /usr/ports/x11/kdebase4-runtime (which is part of the dependencies of KDE4) :
[  2%] Built target kcm_mailtransport_automoc
[  2%] Built target mailtransport_automoc
[  2%] Built target microblog_automoc
[  2%] Built target kpimtextedit_automoc
[  2%] Built target syndication_automoc
Scanning dependencies of target gpgmepp
[  2%] Building CXX object gpgme++/CMakeFiles/gpgmepp.dir/gpgmepp_automoc.o
Linking CXX shared library ../lib/libgpgme++.so
[  7%] Built target gpgmepp
Scanning dependencies of target gpgmepp-pthread
[  7%] Building CXX object gpgme++/CMakeFiles/gpgmepp-pthread.dir/gpgmepp-pthread_automoc.o
Linking CXX shared library ../lib/libgpgme++-pthread.so
[ 11%] Built target gpgmepp-pthread
[ 11%] Building CXX object akonadi/CMakeFiles/akonadi-kde.dir/itemserializer.o
In file included from /usr/local/include/boost/parameter/aux_/arg_list.hpp:14,
from /usr/local/include/boost/parameter/aux_/tagged_argument.hpp:10,
from /usr/local/include/boost/parameter/aux_/tag.hpp:8,
from /usr/local/include/boost/parameter/keyword.hpp:10,
from /usr/local/include/boost/parameter/name.hpp:8,
from /usr/local/include/boost/graph/named_function_params.hpp:15,
from /usr/local/include/boost/graph/depth_first_search.hpp:21,
from /usr/local/include/boost/graph/topological_sort.hpp:16,
from /usr/ports/deskutils/kdepimlibs4/work/kdepimlibs-4.3.4/akonadi/itemserializer.cpp:40:
/usr/local/include/boost/parameter/aux_/maybe.hpp:13:53: error: boost/python/detail/referent_storage.hpp: No such file or directory
In file included from /usr/local/include/boost/parameter/aux_/arg_list.hpp:14,
from /usr/local/include/boost/parameter/aux_/tagged_argument.hpp:10,
from /usr/local/include/boost/parameter/aux_/tag.hpp:8,
from /usr/local/include/boost/parameter/keyword.hpp:10,
from /usr/local/include/boost/parameter/name.hpp:8,
from /usr/local/include/boost/graph/named_function_params.hpp:15,
from /usr/local/include/boost/graph/depth_first_search.hpp:21,
from /usr/local/include/boost/graph/topological_sort.hpp:16,
from /usr/ports/deskutils/kdepimlibs4/work/kdepimlibs-4.3.4/akonadi/itemserializer.cpp:40:
/usr/local/include/boost/parameter/aux_/maybe.hpp:90: error: 'boost::python' has not been declared
/usr/local/include/boost/parameter/aux_/maybe.hpp:90: error: expected unqualified-id before '<' token
/usr/local/include/boost/parameter/aux_/maybe.hpp: In member function 'typename boost::add_reference::type>::type boost::parameter::aux::maybe::construct2(const U&) const':
/usr/local/include/boost/parameter/aux_/maybe.hpp:59: error: 'm_storage' was not declared in this scope
/usr/local/include/boost/parameter/aux_/maybe.hpp: In member function 'void boost::parameter::aux::maybe::destroy()':
/usr/local/include/boost/parameter/aux_/maybe.hpp:72: error: 'm_storage' was not declared in this scope
*** Error code 1
1 error
*** Error code 2
1 error
*** Error code 2
1 error
*** Error code 1

Stop in /usr/ports/deskutils/kdepimlibs4.

From the errors, it seems kdepimlibs4 is missing of a dependencies related to "boost::python".

2010-01-05

FreeBSD - How to check swap space or partition info

Use the command :
swapinfo

Specified the parameter "-h" to convert the bytes to "h"uman readable form :
swapinfo -h

Sayonara !!!

2010-01-04

FreeBSD - ports install Exim email server with patch error

Learned another thing today. The ports tree is just a repository of available software, it can be deleted & regenerated. Why would some one wants to delete the ports tree? It needed to be delete and regenerated because some patch was downloaded incorrectly and the problem stubbornly persists.

Sample of the error :
===>  Applying FreeBSD patches for exim-4.71

Ignoring previously applied (or reversed) patch.
2 out of 2 hunks ignored--saving rejects to src/daemon.c.rej
=> Patch patch-src-daemon.c failed to apply cleanly.
=> Patch(es) patch-OS::Makefile-FreeBSD patch-scripts::exim_install applied cleanly.
*** Error code 1

Stop in /usr/ports/mail/exim.
*** Error code 1

Stop in /usr/ports/mail/exim.

The error complained about a patch file which the patch file did exists.

What have been tried :
  • portsnap fetch update;make
    NO, it didn't work
  • make clean;make rmconfig;make
    NO, it didn't work
  • make config, deselect all options, make
    NO, it didn't work
  • rm -rf /usr/ports/distfiles/exim then make
    NO, it didn't work

After meddling around for a few minutes, still no clue. Is time to check out :
IRC server : irc.freenode.net
IRC channel : #freebsd

2010-01-02

FreeBSD - Backup and restore FreeBSD using Fixit CD

Since FreeSBIE have not been updated since year 2007, its kernel recognizing new hardware starts to worry me as it is based on FreeBSD 6.2 and it is going to reach EoL (end of life) by end of this year, 2010. Is time to experiment on new way restoring backup.

The FreeBSD installation process does mentioned about "Fixit" CD booting. After meddling around with it, it's actually referring to another bootable CD which its label name consits of "livefs" (Live File System). It's also known as "disk 2" prior to FreeBSD 7.
e.g.
Installation disc -- > 8.0-RELEASE-i386-disc1.iso
Live File systems disc --> 8.0-RELEASE-i386-livefs.iso

Do take note that the dump/restore instruction from the previous post "Freebsd – Backup & restore for disaster recovery" is still valid. This post is served as a "update" as it won't be using FreeSBIE, rather, it will using the livefs to start the restoration of the partition(s).

Without further ado, here's the instruction :

FreeBSD - Ports complain about Checksum Mismatch error

File integrity checking has been built in for ports, checksum of file. Comparing checksum of a file is automatically done when ports is going to extract the compress file. It's a important process to make sure that the file downloaded are not altered in anyway, be it missing bits during download or some one maliciously change the contents of the original compress file. Imaging, what would happen if some one insert a trojan house or some spyware into the installation file and happen to be download and installed by users on the internet. The consequences is un-imaginably scary.

But this may not always be the case as ports takes its source from well known web sites and the ports are written by the author of the program which happen to be a commiter port maintainer which (please correct me if this is not the case) gone through a thorough process of checks & verification.

Warning of checksum error may most of the time caused by bumpy download connection that break the downloaded file. e.g. missing bits, halfway terminated file download process.

During installation of the ports, it will complain an error :

2009-12-31

FreeBSD - Fundraising for FreeBSD Foundation

This will be the last post from me of this year and i think i owe my favorite OS too much and hopefully this will slightly, tiny, little, bitty post make my conscience feels better.

Please donate to FreeBSD Foundation.



About the FreeBSD Foundation


What is the FreeBSD Foundation?

The FreeBSD Foundation is a 501(c)(3) non-profit organization dedicated to supporting the FreeBSD Project. The Foundation gratefully accepts donations from individuals and businesses, using them to fund projects which further the development of the FreeBSD operating system. In addition, the Foundation can represent the FreeBSD Project in executing contracts, license agreements, and other legal arrangements which require a recognized legal entity. The FreeBSD Foundation is entirely supported by donations.

What can I expect from the FreeBSD Foundation?

The FreeBSD Foundation will support both the development and the popularization of FreeBSD, the world's best open source operating system. Here are some of the projects that the Foundation can and will support in the future:
  • Development of software for FreeBSD to benefit the user and developer community, including contract development of critical system infrastructure, porting of closed source applications such as Java(TM).
  • Obtaining computers and other equipment for developers to use toward improving FreeBSD, such as the network performance cluster, FreeBSD.org cluster, and personal development systems for developers.
  • Providing additional Internet infrastructure to aid in the development and distribution of FreeBSD.
  • Support developer communication and coordination, including financial support for developer summits and developer travel.
  • Encouraging the formation of FreeBSD user groups.
  • Cultivating press coverage and advertising the utility and availability of FreeBSD.


As you read, FreeBSD Foundation helps the FreeBSD community and that means it helps make FreeBSD a better OS. Unlike other OS that have funds to create hypes and noise, FreeBSD has always been "quiet and working" OS.

Major servers runs on FreeBSD. Major hardware runs on FreeBSD. FreeBSD deserve a better support in terms of funding.

In this seasons of giving, give some to FreeBSD. Donate to FreeBSD Foundation.

Peace.

FreeBSD - Known Vulnerabilities audit check on FreeBSD Ports

The FreeBSD Ports repository have a rich base of software. As of today, it has 21000 ++ ports. As we all know, all software have bugs. Some bugs leads to vulnerabilities. Vulnerabilities opens door to unwanted access, at least not to those have ill intentions.

Every now and then, FreeBSD sysadm tends to install or upgrade new ports. As such, we should be more aware of what bugs or vulnerabilities that comes with it. Even we may not be able to fix it, but at least we should be aware of it so that we can find alternatives to secure it.

For ports, there is a utility to check on what vulnerabilities have been reported on it. Here is how to install and update it frequently :

2009-12-14

OpenID - How to find out OpenID URL

Any of us easily owned a dozen accounts on different services on the internet. Be it Google, Yahoo, WordPress.com and others, these are just a few well known service providers. How about others? e.g. Slashdot (http://slashdot.org/), Stack Overflow(http://stackoverflow.com/), Server Fault(http://serverfault.com/) and the list goes on.

Luckily these sites are equip with OpenID. OpenID make our life easy by having 1 single sign on account (registered with the service providers) authenticate against multiple web sites.

e.g. an account with Google (or gmail) can be sign on into Slashdot, Stack Overflow, Server Fault and others.

Often, these website equip with OpenID sign on service have this "OpenID URL", but how do we get this "OpenID URL"? Or, what is this "OpenID URL"?

Here it is, the "OpenID URL" :

2009-10-15

Perl - Connect using SSH with Perl & CPAN module

It has been weeks since the last time blogging about Perl. My day to day job has been tying most of my free time and blah blah blah excuses ... :p

My job deals with FreeBSD server, 90% of my time. Daily routines includes checking server health status. FreeBSD has these periodic scripts that will report server health status to sysadm daily, but the emails are always being "ignore" as the info in it are too vast. So, i decided to cough out a simple Perl script that will use SSH to connect to the servers and pull some health status report. This post will talk about using cpan module's, NET::SSH::Perl, to execute commands then print out the results.

Purpose of this script :
  • connect to server using ssh
  • authenticate only using public key
  • run a command and print out the result

Perl modules used :
  1. Perl::Critic = perl's best practice
  2. Net::SSH::Perl = the basic of using ssh in perl
  3. Net::SSH::Perl::Key::RSA = authenticate using public key
  4. Class::ErrorHandler = needed by Net::SSH::Perl::Key::RSA module

To reduce the hiccups, install the modules listed above by using CPAN client.

Here is the script :

2009-10-08

Ubuntu - How to change default menu for Net Book Remix

Net Book Remix is another spin off of Ubuntu. It's strength is to make Ubuntu to run on Netbook, miniature laptop which target for internet applications users. Typically, the screen size are small (from 9" - 12"), thus it is light (0.8kg - 1.5kg) and runs on Atom processor. The kernel and programs on NBR (Net Book Remix) are tune to run leaner, to accommodate the limited processor speed. The limited processor is in fact a good thing, less heat generated and generally, NBR are quite "cool".

The most notable difference about NBR and the usual Ubuntu linux distribution is, it's menu. The "Ubuntu NetBook Desktop" is the menu that covers the whole desktop with menu items. But people like me, still prefer the "Classic Desktop", with the menu panel on top and windows panel at bottom. Most desirably is the desktop are visible with the frequent access files and programs in it.

So, how do we change the "Ubuntu NetBook Desktop" to the usual "Classic Desktop"? Here is how to do it :

2009-10-01

FreeBSD - For the love of all

For the love of the world, please do this.

Step 1 :
cd /usr/src
Step 2 :
make love

Enjoy the output :)

World Peace !!!

2009-09-30

FreeBSD - Download ports simultaneously with multiple connections

By default, ports uses 1 connection to download and thus unbearably slow when a server rate limit the connection. Alternatively, we can tell ports to use external utility in order to open multiple connections and download simultaneously.

2009-09-25

vim - Commenting multiple lines, block comment

Perl does not have block comment feature. The Acme::Comment module was the easiest way to make Perl do block commenting, with additional features, it allows customization of open & close punctuation mark.

Until yesterday, my first Perl code got some problem and had to seek help from the IRC channel perl-help @ irc.perl.org (these guys are really helpful, thanks dudes!). Just when they were helping me to solve the problem, Caelum tip me on how to block comment in Perl using vim. I thought it was a good idea as it doesn't need to load additional module to handle the block comment thing, which save some CPU processing.

Here it is :

2009-09-17

Network IP address calculator - for subnet and range of host

One of the task installing a new FreeBSD box was dealing with IP addresses. Usually, google a web based calculator would do the trick. But today's task is a bit different.

IPv6. A whole row of hexadecimal spinning in front of my eyes, just to figure out what is the range of IP that is usable. Web based IP calculator (based on java script) are not accessible using console based internet browser (links & lynx).

Spontaneously, searching the apt repository return some very interesting stuff.

Console based IP calculator. sipcalc.

Not only it is intelligent enough to figure out the input but also it is intelligent enough to generate useful output. Surprisingly, the output is scripting friendly (using grep and sed will parse the output).

These are the steps to install it under FreeBSD & Debian based distribution (e.g. Ubuntu) :

2009-09-14

Perl - How to install Perl module using CPAN shell

One of Perl's strength is it's repository of modules, thousands of modules. No need to re-invent the wheel, just think of what you wanna do and search for it (http://cpan.perl.org).

The CPAN modules are available through the CPAN shell. In this post, we will talk briefly about how to install the CPAN shell and show an example of installing a module.

2009-09-10

The Perl Ironman Challenge

Ironman Challenge. An effort to promote Perl within its community.

Accidentally stumble upon the challenge while searching for Perl's mailing lists and blogs.

I have always wanted to pick up a programming language. To buck up my system administration skill by scripting daily routines and system monitoring. And most importantly, write some web application with this much fascinated programming language that is well known for its TMTOWTDI (There's more than one way to do it !!!) flexibility.

This is my first post on the Ironman Challenge.

Why did I pick up the Challenge? A way to force myself to document what i have learn and also reminder myself to practice more. 1 post every week but no more then 10 days in between. I'll have to cough up with something i've learn, and i must learn. :p

At the same time, hopefully someone can spot what i have been missing or did wrong during my learning process. All constructive comments and suggestion is much appreciated.

Currently, i am working on converting the bash scripts i have, to perl. Reason to do so is getting a chance to familiarize myself with perl, with a goal. With this purpose, at least i don't bang around like a headless fly. Also, i think my bash scripts are some fast & dirty approach to accomplish things, which i think "use strict;" & "use warnings;" can fix/correct most of it. After a few days or so meddling around, manage to try out some condition & loop statements, date/time functions, database connections modules & some array operations. Huh, this is one topic for blogging.

At this stage, I am still trying to get around the documentation, perldoc. Most of the time, i'll be browsing "perldoc perltoc" to find out which functions and/or modules i can use. Still trying to figure out how to search for modules or functions.

CPAN. Comprehensive Perl Archive Network. There's definitely something for me to use, so that i don't have to "re-invent" the wheel. This is another nature of me, laziness. Re-using other people's code not only fulfill my laziness, but also make me write shorter code to accomplish my task.

The next post i will be talking about how to install & use modules.

That's all for now...

Adios !!!

2009-09-06

BIND - name server error "the working directory is not writable"

Recently, there has been a few incident on vulnerabilities of DNS server being exploited. Fortunately, Bind have release patches soon enough for the rest of us to start covering up the loop holes.

After an upgrade or installations of ISC Bind DNS server 9.6 on a FreeBSD box, we will need to stop and start "named" service. As usual, running the below command will restart it :
/etc/rc.d/named stop
/etc/rc.d/named start

During the restart of the service, a few lines of text pops up saying that the permission of some directories in "/var/named" was altered. By default, the named files will need to be owner and group of "bind" in order for it to run properly. But the script in "/etc/rc.d/named" seems to change some directories ownership to "root" and group ownership to "wheel". This actually causes some errors reported in the log file :
Sep  3 02:44:26 nameserver named[9999]: the working directory is not writable

Naturally, we would issued the command :
chown -R bind:bind /var/name/etc

to fix the permission problem. But after another restart of "named" service using the command :
/etc/rc.d/named restart

the permission revert back to "root" and "wheel". This causes problem when the DNS server transfer zone files from the Master DNS server. The "named" service would not be able to write the latest zone info into the file in the directories "/var/named", then it would create some temporary files.

After some investigation, it seems like the ownership define in "/etc/mtree/BIND.chroot.dist" was set in this way. We will need to redefine the ownership of the directories so that it stop changing the directories ownership back to "root" whenever the "named" service is started so that "named" service owner, "bind" user, which runs the DNS server will be able to write the zones files in "/var/named".

2009-09-04

Technorati blog claim fail error

This post is to record how to claim your blog in Technorati. The instruction received was to create a post with the codes provided then the claim process should complete. But it does not. The error below was showed when checking the status :
There was a problem finding your claim code.
If you have already verified above, please contact Technorati support with the following information :

* Please include the following error code: 400
* URL you are claiming : http://scratching.psybermonkey.net
* The name of your blog : Scratching My Needs
* Your contact info : myself@psybermonkey.net
* A short description of your blog and the type of content you like to write about. : This blog is all about Open Source, specifically about Freebsd, Linux and Perl.
* Does your blog have a RSS feed? Please see if you can supply us with an example URL of your feed. : Yes, the url is http://feeds2.feedburner.com/ScratchingMyNeeds

The instruction given from technorati when the codes was provided, did not work. There is a alternative way to claim the blog. That is, create a link on the post with the below html example :

<a href="http://technorati.com/claim/<the blog claim codes>" rel="me">Technorati Profile</a>

Which the "the blog claim codes" is the codes from Technorati, without the angle brackets (<>).

e.g.

<a href="http://technorati.com/claim/abc123xyx" rel="me">Technorati Profile</a>

Technorati should correct its instruction on how to claim the blog. Also, the support should actually buck up. If there wasn't any human(s) behind the support link, don't even put it up there. This confusion wasted 1 week of my time trying all kinds of post with the codes and figuring why the process does not work. Technorati, are you hearing???