XenServer 5 with OpenBSD

Here is my experience trying to run OpenBSD with XenServer 5 Enterprise.

  • XenServer console doesn’t function properly as it keeps overlaying text displayed previously or anything you have typed into the console. Makes it very difficult to read and see what you are doing. As well it appears numerpad with numlock on does not work either. The best work around is to SSH into OpenBSD.
  • Receiving the following error messages at boot up, “clock: unknown CMOS layout” and “rl0: watchdog timeout”. Yes the NIC is being detected as a Realteak 8139. If I check /var/run/dmesg.boot out of the two error messages I only see the “clock: unknown CMOS layout”. So I would assume the watchdog timeout message occurs after initial boot sequence.

The biggest question is OpenBSD on XenServer 5 Enterprise consider production ready even if the errors cannot be resolved?

I’ve tried locating some definite solutions but I have yet to find anything and it appears that the network card issue maybe due to XenServer 5 itself. Any suggestions on how to solve these error messages and fix the XenServer OpenBSD console?

Source: Nabble – OpenBSD User Misc – OpenBSD and XenSource
Source: Citrix Forums – Change network device model for guest

Source: What does “watchdog timeout” signify?
Source: watchdog(4) manpage

Perl – Out of Memory!

Background Knowledge


This case was done on a machine running OpenBSD i386 v3.7 operating system with Perl v5.8.6 built for i386-openbsd using BASH as the command prompt interrupter.

I’ll be honest I have very little knowledge of Perl so if you have anything to comment on or suggest please do so.

Problem


I tried to install a couple Perl modules and received an error message of “Out of Memory!”.

Solution


Just to clarify I have very little knowledge when it comes to Perl, so this solution may or may not work for you.

On Unix machines each user has a ulimit or “user limit” which is basically from what I understand sets the limit for each resource to ensure the system is not over loaded or abused. In this case at least for me, my issue was not having a big enough data seg size. Type at the command prompt without quotes “ulimit -a” to see a list of the set limits. I increased my data seg size from 76800 to 200000. I did this by typing at the command prompt without quotes, “ulimit -d 200000″.

You may need to play with this value for your case or other ulimits. Don’t worry about the changes as none of them are permanent in this case, at least to my knowledge. When you use the ulimit it only changes it for the user you are using and for that given session. If you require more permanent changes look into using ulimit in the login script or better yet change your system configuration settings.

Comments/Thanks


Many thanks to Scott Corley who posted an excellent blog entry entitled “perl Out of memory! (with solution)” on his blog called “Red Mercury Labs”. Without this I was getting know where fast.

If anyone can provide some further knowledge on ulimit it would be much appreciated.

Source: Red Mercury Labs – perl Out of memory! (with solution)

Finding The Total Lines Within Files

I have learned by using the “find”, “wc” and “awk” commands one can find the total number of lines within files of a given directory and sub-directories. Thanks to NicM on IRC server Freenode channel #OpenBSD for his solution below.

Solution
find /path/blah -type f -name ‘*.php’|while read i; do wc -l <$i; done|awk ‘BEGIN { x=0 }; { x+=$1 }; END { print x }’

Note: Shell must be bourne-compatible.

How To – Setup Sendmail as a Smart_Host

I will go through a basic setup of Sendmail as a smart host. The goal is to relay all mail outgoing from an internal OpenBSD server to a gateway that will then send out the email on the server’s behalf. No inbound email traffic is permitted to the internal OpenBSD server only the outside world sees the gateway as the mail server. I’m by no means a Sendmail expert, the steps I explain here is what I’ve learned on my own and with the assistance of dhartmei and NicM in IRC EFNet #OpenBSD channel and cannonball in IRC Freenode #sendmail channel.

Setup

  • Make a copy of openbsd-localhost.mc, “cp usr/share/sendmail/cf/openbsd-localhost.mc /usr/share/sendmail/cf/openbsd-localhost-smarthost.mc”.
  • Edit openbsd-localhost-smarthost.mc and add this statement without double quotes “include(`/usr/share/sendmail/m4/cf.m4′)dnl”.
  • Edit openbsd-localhost-smarthost.mc and add this statement without double quotes “define(`SMART_HOST’,`input_host_here’)dnl”. Note: if an IP address is used enclose the IP address with square brackets.
  • Compile configuration file without double quotes, “sudo m4 /usr/share/sendmail/cf/openbsd-localhost-smarthost.mc > /etc/mail/localhost.cf”. If you receieve “permission denied”, try this instead “sudo ksh -c ‘m4 /usr/share/sendmail/cf/openbsd-localhost-smarthost.mc > /etc/mail/localhost.cf’”.
  • Shutdown Sendmail (kill). Without double quotes do “sudo kill ‘head -n1 /var/run/sendmail.pid’”.
  • Start Sendmail as started previously, “sendmail -L sm-mta -C/etc/mail/localhost.cf -bd -q30m”. You can see how sendmail was started by executing without double quotes “grep sendmail /etc/rc.conf*”. In my case it returned /etc/rc.conf:sendmail_flags=”-L sm-mta -C/etc/mail/localhost.cf -bd -q30m”.

openbsd-localhost-smarthost.mc example

divert(-1)
#
# Copyright (c) 1998 Sendmail, Inc.  All rights reserved.
# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
# Copyright (c) 1988, 1993
#       The Regents of the University of California.  All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#

#
#  This configuration only runs sendmail on the localhost interface.
#  This allows mail on the local host to work without accepting
#  connections from the net at large.
#

divert(0)dnl
include(`/usr/share/sendmail/m4/cf.m4')dnl
VERSIONID(`@(#)openbsd-localhost-smarthost.mc $Revision: 1.4 $')
OSTYPE(openbsd)dnl
FEATURE(nouucp, `reject')dnl
FEATURE(`accept_unresolvable_domains')dnl
FEATURE(`no_default_msa')dnl
define(`SMART_HOST',`[10.10.8.1]')dnl
DAEMON_OPTIONS(`Family=inet, address=127.0.0.1, Name=MTA')dnl
DAEMON_OPTIONS(`Family=inet6, address=::1, Name=MTA6, M=O')dnl
DAEMON_OPTIONS(`Family=inet, address=127.0.0.1, Port=587, Name=MSA, M=E')dnl
DAEMON_OPTIONS(`Family=inet6, address=::1, Port=587, Name=MSA6, M=O, M=E')dnl
CLIENT_OPTIONS(`Family=inet6, Address=::')dnl
CLIENT_OPTIONS(`Family=inet, Address=0.0.0.0')dnl
dnl
dnl Some broken nameservers will return SERVFAIL (a temporary failure)
dnl on T_AAAA (IPv6) lookups.
define(`confBIND_OPTS', `WorkAroundBrokenAAAA')dnl
MAILER(local)dnl
MAILER(smtp)dnl

Also refer to How To – Setup Sendmail for Masquerading and as a Smart_Host

PEAR::HTML_BBCodeParser Upgrade 1.1 to 1.2.2

Problem #1 – “[notice] child pid 13449 exit signal Segmentation fault (11)”

On a OpenBSD v3.7 i386 system running Apache v1.3.29 (not chrooted) with PHP v5.1.4 I upgraded HTML_BBCodeParser from version 1.1 to version 1.2.2 by running at command line “pear upgrade-all”. After the upgrades were complete the web site would not load a web page anymore. I looked at my HTTPD server logs and noticed I was receiving the following error message in error_log file, “[notice] child pid 13449 exit signal Segmentation fault (11)” whenever there was a HTTP request on port 80 or 443 to the web site. I couldn’t understand what the problem could be but then decided to uninstall HTML_BBCodeParser v1.2.2 and re-install HTML_BBCodeParser v1.1 to see if the web site would still function. Indeed the web site did load and function fine. So I decided to uninstall and install each version up to v1.2.2 to see where the breaking point was. As soon as the latest version of HTML_BBCodeParser v1.2.2 is installed the web site stops functioning. I was able to determine that there was something that has changed in v1.2.2 or something I did wrong in the Filters I created and existing filters I altered.

Solution #1

I uninstalled HTML_BBCodeParser then manually removed the directory /usr/local/lib/php/HTML/HTML_BBCodeParser. Then I installed HTML_BBCodeParser v1.2.2 and copied the BBCodeParser.ini example from /usr/local/lib/php/doc/HTML_BBCodeParser/BBCodeParser/example/ to /usr/local/lib/php/HTML/BBCodeParse/. After that the web site functioned as normal again.

Problem #2 – “Warning: strpos() [function.strpos]: Empty delimiter.”

However I discovered that when using PHP 5 one has to alter the BBCodeParser.ini file otherwise you will receive the following warning message when trying to load a web page using HTML_BBCodeParser, “Warning: strpos() [function.strpos]: Empty delimiter. in /usr/local/lib/php/HTML/BBCodeParser.php on line 354″.

Solution #2

Edit your BBCodeParser.ini and alter the line for the opening tag character and closing tag character to be enclosed by double quotes around the square brackets, [ and ]. Apparently this has been an issue for awhile now, http://pear.php.net/bugs/bug.php?id=2580.

Example After Alteration – BBCodeParser.ini

[HTML_BBCodeParser]

; possible values: single|double
; use single or double quotes for attributes
quotestyle = single

; possible values: all|nothing|strings
; quote all attribute values, none, or only the strings
quotewhat = all

; the opening tag character
open = "["

; the closing tag character
close = "]"

; possible values: true|false
; use xml style closing tags for single html tags ( or )
xmlclose = true

; possible values: a comma seperated list of filters
; comma seperated list of filters to use
filters = Basic,Extended,Links,Images,Lists,Email