Main

August 11, 2009

jot gotcha

Seeing that I run into this jot gotcha every couple of months while writing shell scripts, I thought I would add a reminder for myself here (and so that google can pick this up for me next time).

On FreeBSD, by default you don't get access to the seq command to generate sequences, so you naturally will use jot for your shell scripting needs for generating number sequences.

So for example, we want to start with 0 and increment to 4 (one cannot use variables in the bash sequence generator, so {0..$max} won't work here. So for example we have 5 logfiles that we want to grok on a server and another has 6 so instead of hardcoding the varible on each server like {0..4} where we have 4, {0..6} where we have 6, we use jot and some nasty piping commands to get that number.

root# jot 4     
1
2
3
4

Okay so misread the manual very quickly and try:

root# jot 0 4
4
5
6
7
8
9
10
*snip*
93211
93212
93213
93214

Pass the number of iterations (5), start (0) and where it ends (4):

root# jot 5 0 4
0
1
2
3
4

April 18, 2009

FreeBSD vr network card issues

Sort of a note to self for the next time I bump into a very annoying issue with network cards that use the VIA Technologies Rhine I/II/III controller chips on network cards like the quite popular dlink (shows up under vrX in ifconfig -a) is that when you start binding multiple IP addresses on a vr card a few seconds later the card stops working.

Turns out there is a bug of sorts with the FreeBSD vr driver which needs some fixing so moral of the story for the moment is not using vr based network cards till this is fixed.

October 26, 2008

MRTG missing SNMP_util

One of the joys of installing ports on FreeBSD is the odd occasion that the dependencies list is missing a dependency. is not installed you get nice perl errors in the case of the following

# cfgmaker public@127.0.0.1
Can't locate SNMP_util.pm in @INC (@INC contains: /usr/local/bin/../lib/mrtg2 /usr/local/bin /usr/local/lib/perl5/5.8.8/BSDPAN /usr/local/lib/perl5/site_perl/5.8.8/mach /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 .) at /usr/local/bin/cfgmaker line 105.

Turned out SNMP_util is missing and required a quick install of SNMP_Session to make cfgmaker work.

cd /usr/ports/*/p5-SNMP_Session
make install clean

One can see that the dependency list for mrtg excludes SNMP_Session:

# pkg_info -rR mrtg-2.16.2,1
Information for mrtg-2.16.2,1:

Depends on:
Dependency: perl-5.8.8_1
Dependency: p5-Socket6-0.22
Dependency: p5-Pod-Parser-1.35_2
Dependency: p5-IO-Socket-INET6-2.56
Dependency: p5-Digest-SHA1-2.11
Dependency: p5-Digest-HMAC-1.01
Dependency: p5-Crypt-CBC-2.30
Dependency: p5-Crypt-DES-2.05
Dependency: p5-Net-SNMP-5.2.0
Dependency: png-1.2.32
Dependency: jpeg-6b_7
Dependency: pkg-config-0.23_1
Dependency: freetype2-2.3.7
Dependency: libiconv-1.11_1
Dependency: gd-2.0.35,1

Anyways I need to send-pr a patch for the port to get this fixed in the ports tree.

January 15, 2007

FreeBSD 6.2 Released

Noticed that FreeBSD 6.2-RELEASE is finally out.

October 29, 2006

Zend meet valgrind, valgrind meet Zend

Nothing more funny than reading a post from Stefan Esser tonight titled "Dealing with ZendOptimizer Support":

Yesterday I blogged about the fact that Suhosin-Patch is now activated by default in FreeBSD and that this will cause problems for Zend, because the ZendOptimizer accesses already freed memory which will be punished when running with a security patch that protects memory with canaries.

I also blogged about the fact that my bugreport to Zend from 3 weeks ago was simply ignored. This changed today, when a woman from Zend contacted me. (What a coincidence...)

Well under normal circumstances you are happy when a company reacts on bugreports but not when you realize that you ended up with someone from the second level support. Of course her first reaction was to blame this problem on a wrongly used ZendGuard. After that I replied to her that the problem is that Zend Optimizer is using already freed memory and that all Zend needed to reproduce this is to use a debug PHP and a ZendGuard encoded file that uses classes. And that it also might be a good idea to use valgrind on ZendOptimizer, because it will show lots of accesses to not properly allocated memory.

The response from the Zend Support lady was that according to her knowledge it is not possible to use the released ZendOptimizer with a debug PHP. She was happy to have resolved my issue with this response and if I need further technical assistance I should not hesitate to contact her.

I don't know if I should laugh or cry about this kind of support. Maybe I should just do it the Zend way: when someone tries to load a Zend product into a Suhosin-Patched PHP write a big warning message to the error log. ZendOptimizer for example does refuse to work whenever it detects a 3rd party Zend extension not in Zend's whitelist.

Maybe Zend and Andi should start hiring clued up support staff?

It's good to know that the Suhosin-Patch is enabled by default on FreeBSD. :)

September 27, 2006

For George - portupgrade is your friend

For George. On FreeBSD there is a great tool called "portupgrade" and yes, it's every sysadmin's friend.

portupgrade -fo devel/subversion "subversion-perl-1.4.0_1"

Instead of having nightmares with "rpm". Now only if "rpm" would work like portupgrade.

March 16, 2006

The Complete FreeBSD

Exciting news, Greg 'Groggy' Lehey, the author of The Complete FreeBSD has released his book under a Creative Comons license :)

January 13, 2006

4 FreeBSD Security Advisories

There are four FreeBSD Security Advisiories out:

August 24, 2005

Perlbal 1.36 port for FreeBSD

I've updated the patch for Perlbal 1.36.

August 21, 2005

Check out textdrive's new FreeBSD boxen

Textdrive have a stack of new Dell servers which look spiffy as you can see in their Flickr servers set.

Textdrive shiny Dell 2850 servers

August 19, 2005

South African FreeBSD Users Group

It's been quite some time since the old FreeBSD Users Group mailing list on Khetan's box has existed. I've created a new list which aims to provide a place for us to start-up a user group for FreeBSD users to discuss issues relevant to FreeBSD in South Africa.

FreeBSD ports for Perlbal and Danga::Socket

I've finally gotten around to uploading patches for Perlbal and Danga::Socket:

August 16, 2005

What to do when new kernel does not work

Ocassionally things go bad(tm). This has bit me for the second time in approx 3 years now, but generally one needs to load the old FreeBSD kernel to start debugging and going through a box with a fine toothcomb.

The following snipbit gives you an idea what steps to take when rebooting the server so that you can load the previous working copy of the FreeBSD kernel:

When the boot menu appears hit the spacebar to stop the countdown.
Press "6" for "to escape to loader prompt"
unload
load /boot/kernel.old/kernel
boot

Now the old working FreeBSD kerenl is booting up. It would be recommended to copy the last working version to /boot/kernel.last for example so that you can "load /boot/kernel.last/kernel", especially if you are going to be building your kernel multiple times on a server.

August 9, 2005

p5-Perlbal for FreeBSD

There's a slight delay with my p5-Perlbal port for FreeBSD, as I need to figure out the correct way of figuring out if p5-libwww is installed (that's where the HTTP::Date package comes from after a bit of digging) and ensuring that Danga::Socket is installed.

I suppose one of the nicer sides of digging around with the FreeBSD ports tree is that one tends to learn something new each time you play around with creating ports for various applications and libraries that you use, even if you just update ports.

August 8, 2005

Perlbal on FreeBSD

Finally have gotten around to placing perlbal 1.3 into production which is currently reverse proxying the doc.php.net website.

p5-Danga-Socket for FreeBSD

I've hacked together a port for Danga's Danga::Socket perl module which can be downloaded. My perlbal port will be available shortly, as I'm using perlbal infront of doc.php.net ;)

I'm going to clean-up the port prior to submission to the FreeBSD Ports guys.

July 29, 2005

Apache and OpenSSL Issues

Occassionally apache with mod_ssl just breaks after doing an operating system upgrade or even just upgrading openssl. Doing a backtrace against the httpd.core file (gdb httpd httpd.core) I got a backtrace which revealed to me the following:

(gdb) bt
#0 0x00000018 in ?? ()
#1 0x28445162 in RSA_new_method () from /lib/libcrypto.so.3
#2 0x28444eea in RSA_new () from /lib/libcrypto.so.3
#3 0x2845e7e8 in RSAPrivateKey_asn1_meth () from /lib/libcrypto.so.3
#4 0x2846a8a6 in ASN1_item_ex_new () from /lib/libcrypto.so.3
#5 0x2846a6c3 in ASN1_item_ex_new () from /lib/libcrypto.so.3
#6 0x2846621c in ASN1_item_ex_d2i () from /lib/libcrypto.so.3
#7 0x28465c85 in ASN1_item_d2i () from /lib/libcrypto.so.3
#8 0x2845e89f in d2i_RSAPublicKey () from /lib/libcrypto.so.3
#9 0x28459b2c in d2i_PublicKey () from /lib/libcrypto.so.3
#10 0x284585b5 in X509_PUBKEY_get () from /lib/libcrypto.so.3
#11 0x28457615 in X509_get_pubkey () from /lib/libcrypto.so.3
#12 0x28375749 in ssl_util_algotypeof () from /usr/local/libexec/apache/libssl.so
#13 0x2836d226 in ssl_pphrase_Handle () from /usr/local/libexec/apache/libssl.so
#14 0x28366f3f in ssl_init_Module () from /usr/local/libexec/apache/libssl.so
#15 0x08057092 in ap_init_modules ()
#16 0x0805fd83 in main ()

Basically what the backtrace gives us back informs us that there is a problem with OpenSSL. Normally the way to resolve this is to recompile apache+mod_ssl as well as php's openssl extension using portupgrade and force it to do the upgrade, and magically next time you run "apachectl startssl" it works.

June 24, 2005

another FreeBSD interview

There is an interview on the OSNews site with three core FreeBSD developers John Baldwin, Robert Watson and Scott Long. They discuss the up and coming FreeBSD version 6 and it's new features, the competition, Darwin, and quite a bit more.

May 20, 2005

FreeBSD Server Administration Blog

FreeBSD Server Administration Blog is an interesting view from a newbie FreeBSD user.

Slightly reminds me of Dan's FreeBSD Diary.

February 10, 2005

Save the beastie

It's disgusting that the FreeBSD Core Team have decided that they want to change the FreeBSD logo, which is currently a picture of a daemon. Sign the petition to save the beastie.

this daemon character seems cute from somebody's point of view, but somebody may think which does not suit for the professional products to indicate that are using the FreeBSD inside

I don't think it's cute.

Like I learnt years ago if it ain't broke don't fix it!

There is more information about the daemon logo and copyright ownership.

The little red fellow that graces many of these pages is the BSD Daemon. In the context of UNIX® systems, daemons are process that run in the background attending to various tasks without human intervention. In the general sense, daemon is an older form of the word demon. In the Unix System Administration Handbook, Evi Nemeth has this to say about daemons:

"Many people equate the word ``daemon'' with the word ``demon,'' implying some kind of Satanic connection between UNIX and the underworld. This is an egregious misunderstanding. ``Daemon'' is actually a much older form of ``demon''; daemons have no particular bias towards good or evil, but rather serve to help define a person's character or personality. The ancient Greeks' concept of a ``personal daemon'' was similar to the modern concept of a ``guardian angel'' --- ``eudaemonia'' is the state of being helped or protected by a kindly spirit. As a rule, UNIX systems seem to be infested with both daemons and demons." (p403)

From The Evolution of NetBSD:

Those familiar with the BSD projects will recognize the little daemon or beastie. Marshall McKusick designed this creature in 1998, a play on the operating system term "daemon". (Background processes are called daemons, and sometimes are referred to as if they were living creatures. For example: "Network daemons... will kill themselves rather than live in a corrupt environment.... There may be times when you need to kill a daemon.... Be sure to get the parent daemon." (Hunter 309, emphasis original))

December 21, 2004

The FreeBSD Foundation needs your donations

VERY IMPORTANT: FreeBSD Foundation needs $30,400 in donations by 31st December 2004 to maintain non-profit status. See announcement for details. To make a donation: http://www.freebsdfoundation.org/donating.shtml.

If you or your company utilises the FreeBSD Operating System, please consider donating towards the FreeBSD Project so that the FreeBSD Foundation can continue being a US Registered Charity. Please read the mail referenced above for more details.

November 7, 2004

FreeBSD 5.3 Released

Finally! Another release of FreeBSD 5 was released during the wee hours of this morning :)

It is my great pleasure and privilege to announce the availability of FreeBSD 5.3-RELEASE. This release marks a milestone in the FreeBSD 5.x series and the beginning of the 5-STABLE branch of releases. Some of the many changes since 5.2.1 include:

  • A binary compatibility interface has been introduced for the i386 platform that allows running Microsoft Windows NDIS network drivers natively in the kernel.
  • The network and socket subsystems are now multi-threaded and reentrant. This allows for much better use of SMP parallelism when processing and forwarding local and remote network traffic.
  • The development environment has been updated to GCC 2.4.2, Binutils 2.15, and GDB 6.1
  • The choices for graphical environments have been updated to include X.org 6.7, Gnome 2.6.2 and KDE 3.3.0.
There has also been a significant focus on testing and bug-fixing with this release, as well as the freezing of most kernel and userland APIs. Users and vendors are encouraged to consider transitioning to it as FreeBSD 5.x is no longer considered a 'New Technology' release series. Information on migrating from FreeBSD 4.x to 5.x can be found at

FreeBSD 5.3 Migration Guide

For a complete list of new features and known problems, please see the release notes and errata list, available at:

    http://www.FreeBSD.org/releases/5.3R/relnotes.html
    http://www.FreeBSD.org/releases/5.3R/errata.html
For more information about FreeBSD release engineering activities, please see:

http://www.FreeBSD.org/releng

September 7, 2004

FreeBSD 5.3 Performance Changes

I've been hearing quite a bit recently regarding FreeBSD performance enhancements for the upcoming FreeBSD 5.3-RELEASE.

PS: Linux guys where pretty much floored that FreeBSD 5.3 can route 1Mpps and they can't do much more than 100kpps. ;-) Yes, way to go!

August 9, 2004

Upgraded Mozilla Firefox

Mozilla Firefox
I've upgraded my Mozilla Firefox 0.8 release to 0.9.1 via the FreeBSD ports collection and everything went smoothly using a command as simple as:

portupgrade --use-packages-only firefox

July 21, 2004

FreeBSD's new lang/php4 port is horrific

The shock and horror of Alex's changes to the php4 port essentially now makes it mandatory if you used to build php4 (cli and apache module) with the various extensions built in, you now have to manually compile it yourself, seeing that php4 requires php4-extensions to have extensions you used to compile in added, and then your php.ini is polluted with unnecessary lines:

su-2.05b# grep extension php.ini
extension=bcmath.so
extension=bz2.so
extension=calendar.so
extension=crack.so
extension=ctype.so
extension=curl.so
...

It is really silliness if you ask me to change a ports default behaviour that has been in place for years, just because you feel like it.

May 27, 2004

ports/misc/pdmenu maintainership

It's official I'm maintaining my first port in the FreeBSD ports tree.

Note to self send-pr is your friend.

February 4, 2004

FreeBSD CD's

I'm going to be burning some FreeBSD CD's again if anyone is interested and in the Cape Town Area.

Afrigator