Problem compiling on Slackware64 multilib


Some times when I am installing packages from SlackBuilds, the compilation stops with the following error:

error adding symbols: File in wrong format

In order to fix it, I alter the SlackBuild script specifying the library directory in CFLAGS variable:

CFLAGS="$SLKCFLAGS -L/usr/lib64"

Running again the script, it terminates with success.

Source based routing


Most of network routing is based on the destination. But sometimes you may need to forward packets to different gateways depending on the source.

In Linux you can do this using the iproute2 package. It uses netlink socket interface in order to handle addressment, routing, queuing and scheduling of Linux network subsystem. Follow an example:

Define a lable for a table to be used:

echo "10 foo" >> /etc/iproute2/rt_tables

Insert a route into foo table:

ip route add default via dev eth1 table foo

Insert a rule with low priority in order to a host consult the new table foo:

ip rule add prio 10 from lookup foo

You can check the rules with:

ip rule show list

Use the man for more information.

Nagios plugin – check_proc_blocked

Nagios Logo

I have written another plugin using python to get the number of process in uniterruptive state (D). This state means that the process is waiting for a I/O operation, and a high number, it can mean problem. The code you can get here.

For more information of Nagios plugin development, read the guidelines.

Nagios plugin –

Nagios Logo

In order to learn python and monitor my mail service, I have written a Nagios plugin that gets the number of imap clients connected to a dovecot imap server. The code you can get here.

You can see that uses doveadm so as to get connections information. So, you need to configure NRPE to run as nagios user. A good guide can be found here.

For more information of Nagios plugin development, read the guidelines.

Internal/Isolated networks on oVirt

OVirt logo

Although virt-manager provides easily isolated network, oVirt haven’t so evident configuration. In fact, we need some commands on terminal.

You can use dummy module to get internal networks. First of all, make sure your host load dummy module at startup.
Create /etc/sysconfig/modules/dummy.modules:

modprobe dummy >/dev/null 2&1

Manually, you can run modprobe to load on a running machine. It will appear a dummy0 network interface. Done this, create /etc/sysconfig/network-scripts/ifcfg-dummy0 with this content:


Now comes the oVirt configuration. In webadmin portal, go to the ‘Network’ tab and click new:

New network

New network

The definition could be simple. Just give a name and match ‘VM network':

New network

New network

With the virtual switch created, we need to link our dummy interface on it. Go to the network configuration of host:

Configure network on host

Configure network on host

Configure network on host

Configure network on host

Drag internal network and drop in dummy0 interface

Configure network on host

Configure network on host

Check ‘Save network configuration’ and click ok.

Configure network on host

Configure network on host

Now, for each virtual machine you want to use internal network, you can create a virtual NIC and attach to internal virtual switch.

Configure network on host

Configure network on host

Shell tricks


There are many keys or commands that could turn easier our lives. That’s some:

Read text file inside tar.xz file:

cat samba-4.0.9.tar.xz | tar -JxO samba-4.0.9/source4/scripting/bin/samba_backup | less

Command correction:

# nkdir -v /tmp/foo
bash: nkdir: command not found
# ^nkdir^mkdir
mkdir foo

See the difference of file in remote machines:

diff <(ssh server1 'cat file') <(ssh server2 'cat file')

Or installed packages:

diff <(ssh server1 'rpm -qa | sort') <(ssh server2 'rpm -qa | sort')

You have an alias with the same name of a command, but you want to run the command, not alias:

$ alias vi=vim
$ \vi

You can see that ones and many others here.

Partition shrink


Several times we need resize our storage area. Normally we expand volumes, but not shrink. Although not common, it’s possible too. Surfing on the web, I found that great article.

My tests worked gracefully! I extended this article above resizing the virtual disk image file, with qemu-img.

qemu-img convert -f qcow2 -O raw resize.img resize_raw.img
qemu-img resize resize_raw.img 5360321024
qemu-img convert -f raw -O qcow2 resize_raw.img resize.img

5360321024 is the exactly size in bytes of the sum of all partitions.

Rebuilding Slackware packages from installed files


Frequently I update my Slackware with current repository, but sometimes it causes me problems with my ATI video card. As native Linux support to my video card isn’t good, I need use proprietary driver. The development of ATI driver is slower than Linux, so not always it compiles with most recent kernel. When I update my system, I’m not sure that ATI driver will compile to slackware-current kernel version, so I need try update. If it doesn’t work, I need downgrade to previous version, but if I don’t have the package, I can’t downgrade, because the last release of Slackware will have old kernel, and current repository replaces the last one.

Thus, I thought a way to generate the package from installed files. Searching on the web, I found the right procedure here.

Based on that pearl, I coded a script in order to automate the process. The rebuildpkg can be found on my github. Anyone who want help me, are welcome.

Example of use:

# rebuildpkg aaa_elflibs

dovecot imap postscript


Recentemente tive a necessidade de controlar as contas de e-mail que estavam ativas no servidor de e-mails. Para isto, resolvi registrar a data e hora do último login. Meu sistema usa dovecot versão 2.x, então alterei o arquivo 10-master.conf da seguinte forma:

service imap {
  executable = imap imap-lastlogin

E também:

service imap-lastlogin {
  executable = script-login -d /usr/local/bin/
  unix_listener imap-lastlogin {
    user = $default_internal_user
    mode = 0666

Então criei o script a ser executado logo no momento do login, para salvar na base de dados a data e hora do login:


echo "UPDATE mailbox SET lastlogin = now() WHERE username = '$USER'" | mysql -u dovecot --password="secret" postfix
exec $@

Caso queira que seu script faça outra coisa, basta alterá-lo.

mail queue length via net-snmp

Mail queue

It is possible check the mail queue length using net-snmp with extended table. Follow my suggestion.

Create script:


queuelength=`/usr/sbin/postqueue -p | awk '$0 ~ /Requests.$/ {print $5}'`

echo -n "Mail queue length: "
if [ "$queuelength" == "" ]; then
        echo 0;
        echo ${queuelength};
exit $queuelength

In snmpd.conf, add line:

exec postqueue /usr/local/bin/

Be sure that have execution permission.

You can check out using:

snmpwalk -v 1 -c public localhost extTable

You can see more here.