M0n0jabber archive


From Docunext Technology Wiki

Jump to: navigation, search

Contents

m0n0jabber!

I'm trying to build an ejabberd appliance based on m0n0wall.

Goal - To build a very basic ejabberd distribution for embedded appliances like the soekris, pc engines, thin clients, and similar platforms. By "very basic" I mean only using the built-in mnesia storage mechanism for user registration and presence data.


Followed AskoziaPBX and Ultradesic guides to building miniBSD and now building ejabberd:

cd /usr/ports/net-im/ejabberd/
make

Possibly considering DJabberd instead of EJabberd. Since this was fairly easy to setup on FreeBSD and only requires perl to run, this is a better option for m0n0jabber. The first release of m0n0jabber will only have support for static usernames and passwords, making it very easy to parse from the XML configuration file! :-)

http://www.docunext.com/blog/2007/08/djabberd-on-freebsd.html

ejabberd on FreeBSD:

Questions about ejabberd on a m0n0wall base:

  • Can the results of an ejabberd "make" simply be copied to the target? (i.e. no "install -s"), they are interpreted by erlang, right?
  • How to get rc files to start ejabberd automatically?
  • How to get config.xml to store some configuration settings to erlang?


Here's the start of a build script (concepts based off m0n0dev.php by askozia):

#!/usr/local/bin/php -f
<?php

        _exec("cd /usr/ports/lang/erlang; ".
        "make configure -DWITHOUT_JAVA -DWITHOUT_X11; ".
                "");
        //"install -s work/dnsmasq-*/src/dnsmasq $image_name/usr/local/sbin");

        _exec("cd /usr/ports/net-im/ejabberd; ".
        "make".
                "");
        //"install -s work/dnsmasq-*/src/dnsmasq $image_name/usr/local/sbin");




function _exec($cmd) {
        $ret = 0;
        passthru($cmd, $ret);
        if($ret != 0) {
                _log("COMMAND FAILED: $cmd");
                exit();
        }
}


?>

Erlang

Building Erlang

cd /usr/ports/lang/erlang/
make -DWITHOUT_JAVA -DWITHOUT_X11

Does this work? Yes, it did for me.

Use erlang-lite? See: http://ejabberd.jabber.ru/node/830 YES! Looks like erlang-lite is simply the same with those options above already in the makefile, as well as ODBC.

ejabberd still wants to use regular erlang, not erlang lite.

ejabberd without all the cruft

Building ejabberd without odbc or java

make -DWITHOUT_JAVA -DWITHOUT_X11

Looks like that works. So in the end here's what's needed:

cd /usr/ports/lang/erlang/
make -DWITHOUT_JAVA -DWITHOUT_X11 -DWITHOUT_ODBC
cd /usr/ports/net-im/ejabberd/
make -DWITHOUT_JAVA -DWITHOUT_X11

I can get this to work (erlc):

install -s /usr/ports/lang/erlang/work/otp_src_R11B-5/bin/erlc /root/m0n0dev/trunk/work/images/blah/usr/local/sbin

but not this (erl):

install -s /usr/ports/lang/erlang/work/otp_src_R11B-5/bin/erl /root/m0n0dev/trunk/work/images/blah/usr/local/sbin

and that's because erl is simply a shell script, which I can just copy over!


See:


Building m0n0jabber

At this stage I know its not going to work, but I want to be able to go through the motions anyway.

Image:m0n0jabber-missing-lib.png

I'm pretty psyched it actually booted! I'm missing a library: libedit.so.5, so I've copied that and am now running out of space on the image. Hmmmm.

13312+0 records in
13312+0 records out
13631488 bytes transferred in 0.182647 secs (74632974 bytes/sec)
fstab: /etc/fstab:0: No such file or directory
/dev/md0c: 13.0MB (26624 sectors) block size 8192, fragment size 1024
        using 4 cylinder groups of 3.26MB, 417 blks, 896 inodes.
super-block backups (for fsck -b #) at:
 32, 6704, 13376, 20048

/root/m0n0jabber/tmp/mnt: write failed, filesystem is full
lib/libncurses.so.6: Write error: No space left on device

/root/m0n0jabber/tmp/mnt: write failed, filesystem is full
lib/libpcap.so.4: Write error: No space left on device
lib/libpthread.so.2: Write error: No space left on device
lib/libufs.so.3: Write error: No space left on device
lib/libutil.so.5: Write error: No space left on device
lib/libz.so.3: Write error: No space left on device
COMMAND FAILED: cd tmp/mnt; tar -cf - -C /root/m0n0jabber/work/images/blah ./ | tar -xpf -

I added the file to the list of files in /usr/m0n06branch/build/minibsd/m0n0wall.files and it worked!

Image:20070718_m0n0wall-boots.png


I'm also getting errors when the m0n0wall.files has a ":" in a file's path, for example:

sbin/fastboot:sbin/fasthalt:sbin/halt:sbin/reboot

I *think* that means "or", but I'm not sure.

Now I'm getting these errors when trying to compile the kernel:

M0N0WALL_GENERIC: unknown option "IPSEC_NAT_T"
M0N0WALL_GENERIC: unknown option "IPSTATE_SIZE"
M0N0WALL_GENERIC: unknown option "IPSTATE_MAX"

I commented those configs for now.


Image:20070719_m0n0wall-error-ro-fs.jpg

By reverting to the original m0n0dev.php and adding in my jabber stuff, I got the m0n0wall part of the system to work. The ejabberd is still a ways away though - lots to figure out there, including:

  • startup scripts
  • configuration



What follows is what NOT to do!

Grrr, installation failed due to this:

 Because of licensing restrictions, you must fetch the distribution
 manually.

 Please access
 
 http://www.FreeBSDFoundation.org/cgi-bin/download?download=diablo-caffe-freebsd6-i386-1.5.0_07-b01.tar.bz2
 
 with a web browser and "Accept" the End User License Agreement for
 "Caffe Diablo 1.5.0".  Please place the downloaded
 diablo-caffe-freebsd6-i386-1.5.0_07-b01.tar.bz2 in /usr/ports/distfiles.

 Please open http://java.sun.com/javase/downloads/index.jsp
 in a web browser and follow the "Download" link for
 "JDK US DST Timezone Update Tool - 1.2.1" to obtain the
 time zone update file, tzupdater-1_2_1-2007f.zip.

.*** Error code 1

Stop in /usr/ports/java/diablo-jdk15.
*** Error code 1

Stop in /usr/ports/lang/erlang.
*** Error code 1

Stop in /usr/ports/net-im/ejabberd.
*** Error code 1

I downloaded the diablo caffe file, but Sun requires registration to download the tzupdater. Forget that. :-( OK I registered with yousuck34, thebigone and downloaded the file. Can't we use something other that this file? So on FreeBSD there are a zillion dependencies for erlang unfortunately. On debian there is a erlang-nox package for using erlang without x. Too bad its not the same on freebsd, wait - I take it back! You can do this:

make configure -DWITHOUT_JAVA -DWITHOUT_X11

So I'll need to remove a bunch of stuff:

MiniBSD /var # pkg_add -r ejabberd

Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/Latest/ejabberd.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/All/libdrm-2.0.2.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/All/glib-1.2.10_12.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/All/gtk-1.2.10_17.tbz... Done.
pkg_add: warning: package 'gtk-1.2.10_17' requires 'gettext-0.14.5_2', but 'gettext-0.16.1_3' is installed
pkg_add: warning: package 'gtk-1.2.10_17' requires 'freetype2-2.2.1_1', but 'freetype2-2.2.1_2' is installed
pkg_add: warning: package 'gtk-1.2.10_17' requires 'fontconfig-2.3.2_6,1', but 'fontconfig-2.4.2_2,1' is installed
pkg_add: warning: package 'gtk-1.2.10_17' requires 'xorg-libraries-6.9.0', but 'xorg-libraries-7.2_1' is installed
Added group "ejabberd".
Added user "ejabberd".
pkg_add: warning: package 'ejabberd-1.1.2' requires 'tcl-8.4.13_1,1', but 'tcl-8.4.15_2,1' is installed
pkg_add: warning: package 'ejabberd-1.1.2' requires 'freetype2-2.2.1_1', but 'freetype2-2.2.1_2' is installed
pkg_add: warning: package 'ejabberd-1.1.2' requires 'fontconfig-2.3.2_6,1', but 'fontconfig-2.4.2_2,1' is installed
pkg_add: warning: package 'ejabberd-1.1.2' requires 'xorg-libraries-6.9.0', but 'xorg-libraries-7.2_1' is installed
pkg_add: warning: package 'ejabberd-1.1.2' requires 'gettext-0.14.5_2', but 'gettext-0.16.1_3' is installed
pkg_add: warning: package 'ejabberd-1.1.2' requires 'tk-8.4.13,2', but 'tk-8.4.15_2,2' is installed
pkg_add: warning: package 'ejabberd-1.1.2' requires 'libiodbc-3.52.4_1', but 'libiodbc-3.52.5' is installed
pkg_add: warning: package 'ejabberd-1.1.2' requires 'diablo-jdk-1.5.0.07.01', but 'diablo-jdk-1.5.0.07.01_5' is installed
pkg_add: warning: package 'ejabberd-1.1.2' requires 'erlang-r11b1,1', but 'erlang-r11b5,1' is installed

No wonder it took so long to build:

make clean
===>  Cleaning for perl-5.8.8
===>  Cleaning for diablo-jdk-1.5.0.07.01_5
===>  Cleaning for gmake-3.81_2
===>  Cleaning for libiodbc-3.52.5
===>  Cleaning for tk-8.4.15_2,2
===>  Cleaning for unzip-5.52_3
===>  Cleaning for xorg-libraries-7.2_1
===>  Cleaning for javavmwrapper-2.3
===>  Cleaning for gettext-0.16.1_3
===>  Cleaning for pkg-config-0.21
===>  Cleaning for tcl-8.4.15_2,1
===>  Cleaning for libX11-1.1.2,1
===>  Cleaning for libXfont-1.2.8,1
===>  Cleaning for libXfontcache-1.0.4
===>  Cleaning for libICE-1.0.3,1
===>  Cleaning for libSM-1.0.2,1
===>  Cleaning for libXres-1.0.3_1
===>  Cleaning for libXTrap-1.0.0
===>  Cleaning for libXau-1.0.3_2
===>  Cleaning for libXaw-1.0.2,1
===>  Cleaning for libXcomposite-0.3.1,1
===>  Cleaning for libXcursor-1.1.8_1
===>  Cleaning for libXdamage-1.1.1
===>  Cleaning for libXdmcp-1.0.2
===>  Cleaning for libXevie-1.0.2
===>  Cleaning for libXext-1.0.3,1
===>  Cleaning for libXfixes-4.0.3
===>  Cleaning for libXi-1.0.2,1
===>  Cleaning for libXinerama-1.0.1,1
===>  Cleaning for libXmu-1.0.3,1
===>  Cleaning for libXp-1.0.0,1
===>  Cleaning for libXpm-3.5.6_1
===>  Cleaning for libXrandr-1.2.1
===>  Cleaning for libXrender-0.9.2
===>  Cleaning for libXScrnSaver-1.1.2
===>  Cleaning for libXt-1.0.5
===>  Cleaning for libXtst-1.0.1
===>  Cleaning for libXv-1.0.3,1
===>  Cleaning for libXvMC-1.0.4
===>  Cleaning for libXxf86dga-1.0.1
===>  Cleaning for libXxf86misc-1.0.1
===>  Cleaning for libXxf86vm-1.0.1
===>  Cleaning for libxkbfile-1.0.4
===>  Cleaning for libxkbui-1.0.2
===>  Cleaning for libXft-2.1.12
===>  Cleaning for libXprintUtil-1.0.1
===>  Cleaning for libXprintAppUtil-1.0.1
===>  Cleaning for libfontenc-1.0.4
===>  Cleaning for libdmx-1.0.2
===>  Cleaning for xtrans-1.0.3
===>  Cleaning for libFS-1.0.0
===>  Cleaning for liboldX-1.0.1
===>  Cleaning for libtool-1.5.22_4
===>  Cleaning for libiconv-1.9.2_2
===>  Cleaning for bigreqsproto-1.0.2
===>  Cleaning for xextproto-7.0.2
===>  Cleaning for xcmiscproto-1.1.2
===>  Cleaning for kbproto-1.0.3
===>  Cleaning for inputproto-1.3.2
===>  Cleaning for xf86bigfontproto-1.1.2
===>  Cleaning for xproto-7.0.10
===>  Cleaning for fontcacheproto-0.1.2
===>  Cleaning for fontsproto-2.0.2
===>  Cleaning for freetype2-2.2.1_2
===>  Cleaning for resourceproto-1.0.2
===>  Cleaning for trapproto-3.4.3
===>  Cleaning for printproto-1.0.3
===>  Cleaning for compositeproto-0.3.1
===>  Cleaning for fixesproto-4.0
===>  Cleaning for renderproto-0.9.2
===>  Cleaning for damageproto-1.1.0_2
===>  Cleaning for evieext-1.0.2
===>  Cleaning for xineramaproto-1.1.2
===>  Cleaning for randrproto-1.2.1
===>  Cleaning for scrnsaverproto-1.1.0
===>  Cleaning for recordproto-1.13.2
===>  Cleaning for videoproto-2.2.2
===>  Cleaning for xf86dgaproto-2.0.2
===>  Cleaning for xf86miscproto-0.9.2
===>  Cleaning for xf86vidmodeproto-2.2.2
===>  Cleaning for fontconfig-2.4.2_2,1
===>  Cleaning for dmxproto-2.2.2
===>  Cleaning for expat-2.0.0_1
===>  Cleaning for erlang-r11b5,1
Personal tools