Category Archives: Uncategorized

Cron can’t start PAM on FreeBSD

I was having these error messages in /var/log/cron:

Feb 29 15:52:01 localhost /usr/sbin/cron[96178]: in openpam_load_module(): no pam_nologin.so found
Feb 29 15:52:01 localhost /usr/sbin/cron[96178]: (CRON) error (can't start PAM

Searched the net, couldn’t find anything relevant.

Eventually, though, figured out to /etc/rc.d/cron restart, and voila! Maybe something went hazy after upgrade.

Advertisements

Arch Linux and netcfg: make only loopback up by default

Here’s how I do it:

$ cat /etc/network.d/loopback
CONNECTION='ethernet'
DESCRIPTION='Loopback to localhost'
INTERFACE='lo'
IP='static'
ADDR='127.0.0.1'
ROUTES=('127.0.0.0/24 via 127.0.0.1')
#GATEWAY='127.0.0.1'
#DNS=('192.168.1.1')

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6='static'
#ADDR6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#ROUTES6=('abcd::1234')
#GATEWAY6='1234:0:123::abcd'

This file, of course, must be included from /etc/rc.conf, like this:

NETWORKS=(loopback)

Clear exim queue

The queue can be viewed with mailq, which is the same as exim -bp.
You can view individual messages using exim -Mvc <message-id>. Once you’re done, run

exim -bp | grep -Eo "[[:alnum:]]{6}-[[:alnum:]]{6}-[[:alnum:]]{2}" | xargs exim -Mrm

logrotate complains about insecure parent directory permissions

I’ve received this message recently:

error: skipping "/var/log/exim/mainlog" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

…and a few other of similar nature. Turns out /var/log/exim/ were indeed group-writable. Easy to fix.

E-book manager and converter

I was looking for something to convert a few e-books from wacky new-age formats to something more universal, like text, HTML, or at least PDF. It’s Calibre, and here’s a list of supported formats.

It’s got quite a dependency tree — python, imagemagick, poppler-qt (which pulls in qt), libusb (which pulls glibc), etc.. So it’s a drag if you just need to convert this one e-book.

But if you’re looking for something to manage your whole library and sync up with mobile devices — this is the fire fox you were hunting.

About Calibre, bypassing their fancy front flash.

Dump audio from video, revisited

From some post on some mailing list:

mencoder -v -ovc copy -oac mp3lame -o out.avi INPUT-FILE -ss HH:MM:SS
mplayer -v -vo null -vc dummy -ao pcm -dumpaudio -dumpfile out.mp3 out.avi

ATmega168 documentation uses word addressing, avrdude uses byte addressing

I was programming USBaspBootloader into a metaboard with an Atmel AVR ATmega168 microcontroller. I always got this error:

usb 6-2: device descriptor read/64, error -71
...
usb 6-2: device not accepting address 21, error -71

1. USBaspBootloader’s Makefile specifies atmega168 and BOOTLOADER_ADDRESS=3800 by default. This is in hex addressing a byte, i.e. 0x3800. avrdude uses byte-addressing.

ATmega168 documentation refers to 0x1C00 as the bootloader address. This is in hex addressing a word. 0x3800 / 2 = 0x1C00.

So, when programming a bootloader using avrdude, USBaspLoader’s Makefile should have 3800 (the default), not 1C00.

2. bootloaderconfig.h has features enabled that make the bootloader too big (> 2K). I had to turm them off:

80 #define HAVE_EEPROM_PAGED_ACCESS 0
...
87 #define HAVE_EEPROM_BYTE_ACCESS 0
...
93 #define BOOTLOADER_CAN_EXIT 0

All of this was, of course, done under Linux.

Transparent-background icons for Tor, Uzbl, Irssi

I made these from files available on the net.

tor onion icon

uzbl web broser logo

irssi irc client logo

Exim: force retrying delivery of mail in local spool

My mail got stuck in the spool a few days ago due to misconfiguration of ~/.forward. After fixing the file, the commands to force retry of delivery are:

cd /var/spool/exim/msglog
exim -M *

or

exim -qf

Provided, of course, your shell is smart enough to do * expansion properly.

uzbl follow.js: link following with settable keys

EDIT: this script is no longer up-to-date and won’t work with the current version of uzbl.

This is a diff to current follow_Numbers.js. The new script, which I called follow.js, is more versatile, since the characters used for labels and key navigation can be set using the hintKeys variable.

2d1
<  * Its pretty stable, only using numbers to navigate.
12a12,14
> //This string should be 10 characters long. Play around!
> var hintKeys = 'asdfghjkl;';
> 
24c26
< //Make onlick-links "clickable"
---
> //Make onclick-links "clickable"
195a198,216
> //Map 0123456789 to hintKeys
> function mapNumToHintKeys(label) {
>     label = label + '';
>     for (var j = 0; j < label.length; j++) {
>     var pos = parseInt(label[j]);
>     label = label.replace(label[j], hintKeys[pos]);
>     }
>     return label;
> }
> //Map hintKeys to 0123456789
> function mapHintKeysToNum(label) {
>     label = label + '';
>     for (var j = 0; j < label.length; j++) {
>     var pos = hintKeys.search(label[j]);
>     if (pos < 0 || pos > 9) return;  // bad input, key not in hintKeys
>     label = label.replace(label[j], pos+'');
>     }
>     return parseInt(label);
> }
199c220
<     var linknr = parseInt(follow, 10);
---
>     var linknr = mapHintKeysToNum(follow);
216a238
>         label = mapNumToHintKeys(label);