When CUPS suddenly fails to work

I have a Brother HL-5035DN networked laser printer for which I use CUPS on my OpenBSD desktop. I’d set up the printer  over a year ago and there had been no printing problems during that time.

Three days ago CUPS suddenly refused to print anything even tbough I could still place files in the queue for printing.  Nothing relevant had changed on my system as far as I could remember. I spent the next three days trying to get printing to work again, with plenty of help from kind people on daemonforums, but no luck.

After innumerable reconfigurations of the printer I decided to be radical: I deleted CUPS entirely and reinstalled it. No result.

At long last on the third day it occurred to me to delete the printer entry in CUPS and remake it. As soon as I’d done this CUPS started printing again.

I did think of trying that solution right at the start of the problem but I got side-tracked into other things,and forgot about it.  Even when I remembered it  I assumed,at first that reinstalling CUPS would automatically delete and reinstall the printer as well. It didn’t.

I still don’t know what the original cause of the problem was. One possibility is that I use the -current version of OpenBSD (similar to the unstable branch of Debian), which produces quite frequent updates for CUPS among other things. When this happens I’m supposed to delete various CUPS files after the update, but on a couple of occasions recently I couldn’t do this because the screen showing the list of instructions went blank before there was time to do so. Maybe this screwed something up.

Anyway, the moral of the story is that when a previously working CUPS suddenly fails, you should try deleting and remakikng the printer entry before doing anything else.

Why are some of your books free?





This question is really part of a larger one, which is why do I self-publish? Let’s get one thing out of the way immediately: it isn’t because I can’t get published by mainstream commercial publishers.

In the past I’ve had seven books published in this way, both fiction and non-fiction, but I’ve abandoned that route now, as have many other writers.

Why self-publish?

In a word, disillusionment. The science writer John Horgan explains why he decided to self-publish his latest book. “After I got the idea for Mind-Body Problems in 2015, I pitched it to a few agents and editors and got chilly responses. Fuck ‘em, I thought, and wrote the damn book anyway.” My feeling precisely. Mainstream publishing ain’t what it used to be.

In recent years I’ve gone down the self-publishing route entirely, for similar reasos, with eight books produced so far. All are available electronically as e-books and most are also in hardcopy as paperbacks (on Amazon and Lulu).

Why free?

But why are some of them free? Don’t I want to make money from my writing? (‘No man but a blockhead ever wrote except for money’ – Samuel Johnson,) I certainly don’t dislike receiving the payments I get for these books from various sources.

Still, pace Dr Johnson, there are other motives for writing, such as being read. This has prompted Horgan to make his latest book free, and I’ve done the same with three of mine.

This isn’t as quixotic as it may appear. The sad fact is that you are very unlikely to make much money from any of the books you self-publish unless you are extremely lucky or willing and able to invest a lot of time and effort in marketing your work, which I’m not.

That may be discouraging, but don’t think that you’ll do a lot better if you take the commercial route. Mainstreame publishers these days make little if any attempt to publicise and market your book, and the cbances that you will make even a modest income from writing is small unless you have a specific audience in view (as in the case of a standard textbook, for example).

The changing face of publishing

Money always mattered to publishers, of course, but they often also wanted to feel they were doing something for literature.  That attitude is as dead as the mechanical typewriter (something else I grew up with).  The independent publishers who used to exist have virtually all been swallowed up by giant international conglomerates, which don’t even make a pretence of altruism.

Things were different when my first book, a novel, was published by Chatto & Windus in 1967. My editor was one of the directors, Cecil Day Lewis, who shortly afterwards was appointed Poet Laureate. After my book was accepted I went to see him in his Central London office and he asked me if I would allow him to edit my manuscript for publication, assuring me that I could trust him to do a good job! He also said he thought I had married too young (something which I think he had done himself).

Two decades later things had changed a lot but some of the original publishing houses still maintained their independence. One of these was Victor Gollancz Ltd, which published a book of mine in the 1980s.

I got to meet the Managing Director, Livia Gollancz, the daughter of Victor Gollancz, the founder of the firm. She had been a fine concert musician and became a publisher reluctantly, when her musical career ended owing to ill-health. She was a tall imposing woman who I think ran the firm rather imperiously. She took the decision to publish my book herself, but that wouldn’t happen today. Such decisions are now made on strictly commercial grounds by accountants.

If you have a book published commercially today you are most unlikely to meet any of the directors. In fact, you may not even get an editor, which explains the shoddy standard of some of the books I read nowadays.


The moral of the story is that if you want to write, go ahead and do so, but don’t count on its making you a fortune or even a modest income.



New feature in OpenBSD

OpenBSD has introduced a new utility in the most recent version (6.6 – now in -current). This is sysupgrade, which makes upgrading the system even more painless than it was previously.

sysupgrade downloads the necessary files to /home/_sysupgrade, verifies them with signify(1), and copies bsd.rd to /bsd.upgrade.

sysupgrade by default then reboots the system. The bootloader will automatically choose /bsd.upgrade, triggering a one-shot upgrade using the files in /home/_sysupgrade.

This is brilliant. I do upgrades to -current about once a week. Previously I had to reboot with a new bsd.rd and connect to a mirror to do the upgrade. Downloading the files took some time (more than 20 min) during which the computer was not available for work.  Now I just run sysupgrade and everything happens automatical. I can continue to use the computer while the files are being downloaded, after which the system reboots with the new upgrade. This is a major advance in ease of use – congratulations to OpenBSD!

Incidentally it also works for upgrading -release versions; it knows whether you are using -release or -current.


How to save $HOME when reinstalling OpenBSD

Everything has gone wrong and you have to reinstall from scratch. It shouldn’t happen but it may if you do something silly – I once accidentally deleted /etc! But you have all sorts of stuff in $HOME that you don’t want to lose. Can you preserve it?

Well, of course, you should have a backup. I save one nightly on Tarsnap. But it may take a long time to restore from backup and it would be better if you didn’t have to.

Fortunately you can save your $HOME quite easily. Here’s how.

  1. When the Install process asks you to use disklabel, choose either OpenBSD or Whole Disk.

2. See which partition contains /home. Suppose it is ‘k’.Delete this with ‘d k’ and remake it with ‘a k’. Choose ‘No mount point’ (this seems to be the defalt at present).

3. Complete the Install process. When the system restarts,  edit /etc/fstab to mount the ‘k’ partition as /home.

It should work – it has worked for me. But if at all possible make a backup first, just in case it doesn’t.



Qsf – a small fast accurate spam filter

There are plenty of spam filters available for OpenBSD and other BSD systems such as bogofilter or spambayes, but these tend to be overkill for a single user system like mine. Another possibility is bmf, which is described as aiming to be faster, smaller and more versatile than similar Bayesian filters. However, it doesn’t seem to have been updated since 2002 and I didn’t like it too much when I tried it out..

I prefer Quick Spam Filter (QSF), which I have used for a good many years – in fact, since before I changed from Linux to OpenBSD in 2014. Its last update was in 2015. I find that after training it is reliable, with only occasional false positives or negatives. It hasn’t been ported to OpenBSD but it compiles easily. It is available from its author.

The qsf documentation describes how to integrate it with procmail. I have a separate post with details of doing this with fdm.

How to replace procmail with fdm




Procmail is still widely used although it is no longer maintained. Its former maintainer on OpenBSD, Philip Gunther, has said that it should be removed from the ports list because of security vulnerability, although it is still there. A suggested alternative is fdm, which both fetches the mail from a POP3 server and filters it, thus replacing both fetchmail and procmail.

I’d been using procmail with fetchmail for a long time but I thought perhaps I should switch to fdm. The main difficulty was that the documentation I found was less complete than what is available for procmail and it took me a fair amount of time to configure it to use my spam filter, which is qsf.

Here is my fdm.conf for anyone who is thinking of making the same switch.  Qsf writes “SPAM” in the subject line of suspect emails so that’s what I filter on.

My fdm.conf

# fdm.conf – see the fdm manual for explanations of the code.

# Set the maximum size of mail:
set maximum-size 128M

# connection settings for my ISP’s mail server:
account “<my POP3 account>”
pop3 server “<my POP3 server>”
user “<my email address>”
pass “<my password>”

# filtering rules (adapted from my .procmailrc:
match “^(To|Cc):.*lyx-users@lists.lyx.org” action mbox “%h/Mail/lyx-users”
match “^(To|cc|Cc|Sender): .*misc@openbsd.org” action mbox “%h/Mail/openbsd”
match “^Subject:.*Sucuri Alert” action mbox “%h/Mail/sucuri” action pipe “cat > /dev/null”

# forward some mail to a different account (see “My forward file” below):
match “^From:.*Facebook” action pipe “%h/.forward”

# Spam filter rules:
action “spamfilter” rewrite “/home/ac/bin/qsf -s”
match all action “spamfilter” continue
match “^Subject:.*SPAM” action mbox “%h/Mail/spam”

# Set spoolfile for incoming mail:
action “inbox” mbox “/var/mail/ac”
match all action “inbox”

My .forward file

smtp <user@example.com>