Tag Archives: archlinux

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)

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.

Samsung ML-2015 with CUPS 1.4 on Arch Linux

As you might know (yeah, right), I am a proud owner of a Samsung ML-2015 laser printer, this paper-munching, smoke-exhausting hellish machine (which is, in fact, an ML-2010 re-branded for the russian and post-soviet states, so that Samsung can provide localised support).

Updating to CUPS 1.4 on Arch Linux kind of broke the printer. It’s still visible in the CUPS interface, but doesn’t print anything (the jobs are on hold, “waiting for the printer to become available”). The kernel is 2.6.31.4, usblp module disabled as per Arch newsfeed suggestion.

The solution was simple – getting to the “Printers” tab in the web interface and modifying the printer to use a different connection (the one without “usb://”).

Analog Devices AD1984A (snd-hda-intel) on HP 6730s, Arch Linux

Here’s a great table for all your snd-hda-intel needs: Ubuntu Wiki audio_intel_da.

SpamAssassin and Exim on Arch Linux: some config trouble

I had this happen – SA wasn’t reading user_prefs out of a proper home dir:

[12071] info: spamd: creating default_prefs: //.spamassassin/user_prefs
[12071] dbg: config: using "/.spamassassin" for user state dir
[12071] dbg: config: mkdir /.spamassassin failed: mkdir /.spamassassin: Permission denied at /usr/share/perl5/vendor_perl/Mail/SpamAssassin.pm line 1577
[12071] dbg: config: Permission denied
[12071] warn: config: cannot write to //.spamassassin/user_prefs: No such file or directory
[12071] info: spamd: failed to create readable default_prefs: //.spamassassin/user_prefs
[12071] dbg: config: read_scoreonly_config: cannot open "//.spamassassin/user_prefs": No such file or directory

I thought this was due to the way spamassassin was invoked, so I tried specifying the user and homedir explicitly. It didn’t work. I tried creating a ‘spamd’ user, a homedir, changing the invocation to that:

sudo spamd -c --max-children 3 --username spamd -H "/var/lib/spamassassin/" -s stderr -D

Didn’t help.

Then I RTFMed some. That reminded me of writing something about user ‘nobody’ in exim.conf. That’s the user for which spam filtering is invoked; so if you allow per-user configuration, it doesn’t really matter that you specify “/var/lib/spamassassin” as a homedir, that’s just for the parent spamd process. For every child, the directory will be changed; for ‘nobody’ it’s ‘/’.

So I changed that line to have ‘spamd’ instead, and voila!

[12071] info: spamd: creating default_prefs: /var/lib/spamassassin/.spamassassin/user_prefs
[12071] dbg: config: using "/var/lib/spamassassin/.spamassassin" for user state dir
[12071] warn: config: created user preferences file: /var/lib/spamassassin/.spamassassin/user_prefs
[12071] dbg: conf: finish parsing

Configuring Exim to use SpamAssassin in ArchLinux

There’s a lot of outdated stuff floating on the internets. This one was most useful to me.

Basically, if you install Exim and SA from pacman, you’ve already got everything enabled. Filtering spam is done via an Access Control List (the last one in exim.conf). Don’t bother with transports unless you’re sure you want them.

Add spamd to daemons in rc.conf. If you want reject logging, append

-s /var/log/spamd.log -D check

to the string in /etc/config.d/spamd.

Arch Linux: no sound from speakers, headphones OK

As noted here, you must tell the system that you’re using a laptop, so there are several outputs. Edit /etc/modprobe.d/50-sound.conf (or similar) like this:

alias snd-card-0 snd-hda-intel
alias sound-slot-0 snd-hda-intel

options snd-hda-intel model=hp

EDIT: for more models and options, see this Ubuntu Wiki page.

Copying an audio CD in ArchLinux

dd didn’t work. This thread was most helpful: http://nixcraft.com/getting-started-tutorials/10751-linux-copy-audio-cd-track-hard-disk.html

So I used cdrdao, like this:

dmesg | grep scsi # find CD-ROM's SCSI "bus address"
cdrdao copy --device 1,0,0

Stackless-Python in Netkit VM

I needed to do this, since I’m running a x86_64 machine, and netkit emulates a 32-bit one. Thus external programs cannot be run inside Netkit, which, surprise, is also a security feature.

1. Install netkit:

# yaourt netkit

2. Use the second method described in the Netkit FAQ to update packages in the VM image:

# mkdir /mnt/nkft
# mount -o loop,offset=32768 $NETKIT_HOME/fs/netkit-fs /mnt/nkfs
# chroot /mnt/nkfs

3. Install the build tools:

# apt-get install gcc g++ make automake autoconf libc6-dev binutils

4. Then proceed with Stackless (there seems to be no Debian package yet). First, install dependencies:

# apt-get install bzip2 openssl

Then:

# wget http://www.stackless.com/binaries/stackless-262-export.tar.bz2
# tar xf stackless-262-export.tar.bz2
# cd stackless-2.6.2

;; I tried building specifying “–with-threads –enable-shared” to
;; configure and it didn’t work, with “PIC register ebx clobbered in asm”.
;; Adding “–stackless-fewerregisters” might help if
;; you really need that. Thanks to Lloyd Weehuizen.
# ./configure --prefix=/usr
# make
# make install

5. After all goes well, as it always does, press CTRL+D. Then:

# umount /mnt/nfks

Lighttpd in jailkit chroot environment

[lighttpd]
comment = LigHTTPd HTTP server
paths = /usr/sbin/lighttpd, /usr/sbin/lighttpd-angel, /usr/lib/lighttpd, /etc/lighttpd
emptydirs = /tmp, /srv/http, /var/log/lighttpd, /var/run/lighttpd
devices = /dev/urandom, /dev/null
users = http
groups = http
includesections = uidbasics, netbasics, logbasics

[php]
comment = PHP 5
paths = /usr/bin/php, /usr/bin/php-cgi, /usr/bin/cgi-fcgi, /usr/bin/spawn-fcgi, /etc/php
includesections = netbasics, logbasics

Permissions need to be changed in your jaildir.

jailed-lighttpd:

(include file lost, sorry)