diary at Telent Netowrks

How to avoid using Outlook for Mac (mostly)#

Mon, 06 Jan 2014 07:51:17 +0000

New Year's Resolution number 2 (number 1 is domestic) is, taking inspiration from Neil Gaiman, to spend less time on Twitter and more time on long-form - or at least, paragraphs-long-forms - of writing. So to ease myself in gently, here's a plug for DavMail

It might be overstating the case slightly to claim that one of the worst things about working at $JOB is that everyone has to use Outlook, but it's certainly not one of the better things. So, having a spot of time between Christmas and the New Year to improve my working environment, I started looking for other ways to address the Exchange server.

Step 1 was to install DavMail

DavMail is a POP/IMAP/SMTP/Caldav/Carddav/LDAP exchange gateway allowing users to use any mail/calendar client (e.g. Thunderbird with Lightning or Apple iCal) with an Exchange server, even from the internet or behind a firewall through Outlook Web Access.

This bit went smoothly.

(Step 1.1 was to Paypal the DavMail author a small amount of cash: this is already making my work environment so much nicer)

Step 2: install and configure offlineimap. It would be neat if using offlineimap didn't require one to learn Python (folder filtering syntax, I am looking at you) but I told it my 'remote' server was reachable at localhost:1143 and cargo culted some stuff to drop all the boring folders full of crap, and off it went (very slowly) downloading my mail. This is approximately how my .offlineimaprc looks:

accounts = Exchange

[Account Exchange] localrepository = Local remoterepository = Remote status_backend = sqlite

  1. minutes between refreshes quick = 30
  2. partial refreshes between full ones

[Repository Local] type = Maildir localfolders = ~/SB-Mail

[Repository Remote] folderfilter = lambda folder: folder not in ['Trash','Drafts', 'Junk'] and not re.search("INBOX/20\d\d$", folder) and not re.search("^Trash/", folder) type = IMAP remotehost = localhost remoteport = 1143 remoteuser = mydomain\myusername remotepass = mypassword

mydomain, myusername and mypassword are placeholders: make the obvious substitutions.

Step 3: Gnus. Point it at the local folder that offlineimap is talking to, and tell it to use davmail via smtpmail for sending outgoing messages:

(setq gnus-select-method '(nnmaildir "sb"
                           (get-new-mail nil)
                           (target-prefix "")
                           (directory "~/SB-Mail/")))

(setq user-mail-address "my.email.addressmy.place.of.work.co.uk") (setq smtpmail-smtp-server "localhost") (setq smtpmail-smtp-service 1025) (setq smtpmail-auth-credentials "~/.authinfo")

.authinfo looks like this
machine localhost login mydomain\myusername password mypassword port 1025
Again, replace
my*@ with actual values

Step 4: Oh but, dear Lord, this thing could not find an uglier way to render HTML email, what's up with that? Turns out this is because the Emacs app in Homebrew wasn't built with libxml support. Turns out this is because the bundled libxml in MacOS Lion (other Bloodthirtsy Yet Cuddly Big Cats are available) is missing the file that pkg-config needs so that any app that might want to build against it can find it. So:

Step 3.9: Building your own Mac Emacs is surprisingly easy - just follow the instructions in nextstep/INSTALL - but unless you take steps to make libxml show up, the resulting app will suffer the same problem as Homebrew's binary. So:

Step 3.8 Install the homebrew libxml package, and (2) add the .pc file it provides to PKG_CONFIG_PATH, because - as it doesn't want to clash with the broken builtin libxml - it installs into some obscure out-of-the-way place that nobody will ever find it. "I eventually had to go down to the Cellar". "Yes, Mr Dent, that's the display department".

$ pkg-config --cflags libxml-2.0
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
$ PKG_CONFIG_PATH=/opt/boxen/homebrew/opt/libxml2/lib/pkgconfig/  pkg-config --cflags libxml-2.0

Your Pathnames May Vary. You get the idea. When is Macos Shaved Yak planned for release?

But after all that, it Just Works. Mostly. Sometimes it complains that files go missing, but I think that's because I'm still checking mail occasionally (so causing them to be marked as read) in Outlook and this makes them jump from new/ to cur/. And I haven't yet figured out how to deal with calendaring or contacts, but the former is a minor annoyance and the latter is probably just a matter of finding a way to make Gnus talk LDAP to the LDAP proxy in DavMail

Anyway, Happy New Year. Mine will be.

Using the HP IP Console Viewer app on Linux#

Wed, 08 Jan 2014 22:40:29 +0000

Another success criterion in my current story to get the Machine That Does Everything out of the living room is being able to do things like kernel upgrades without having to go to where it is and plug in a keyboard and screen, and to that end I bidded for and - somewhat unexpectedly - won an HP 1x1x8 IP KVM switch on Ebay.

  1. It appears to be actually made by someone called Avocent, though Avocent seem to change their products in non-trivial ways for different badge engineers
  2. Along with the switch itself, you need an "Interface Adaptor" for each connected server. This is a thingy that has an RJ45 at one end and a set of keyboard/video/mouse connectors at the other, and should cost around £7 or £8
  3. Although you can plug in a keyboard and mouse - and it works just like a local KVM if you do - you will need to connect to the serial port to configure the network settings, there seems to be no way of doing it from a connected keyboard.
  4. Although some variants of these things run web servers on ports 80 and 443 which let you download java applets to connect to the servers plugged into them, mine doesn't. I know not why.
    Starting Nmap 6.00 ( http://nmap.org ) at 2014-01-08 22:48 GMT
    Nmap scan report for kvm.lan (
    Host is up (0.011s latency).
    Not shown: 997 closed ports
    2068/tcp open  advocentkvm
    3211/tcp open  avsecuremgmt
    8192/tcp open  sophos
    MAC Address: 00:02:99:03:62:5C (Apex)
    None of those responds to HTTP or HTTPS requests
  5. So you need to download the software yourself. HP love to rearrange their web site, judging from the number of dead links in the google seearch results, but as of the time I write this you can get it from here and if that link is out of date when you read this you may find the file you need by googling for SP50317.tar
  6. Having downloaded it, you must untar it and run the setup.bin shell script. Do this with LOCALE=C or it doesn't work
  7. On a 64 bit platform it may complain about missing libraries that you thought you had. This is because it's 32 bit. Users of the Universal Operating System (a.k.a Debian) can grab the necessary with
    $ sudo apt-get install  libxext6:i386 libxtst6:i386 
  8. Once you're through the setup process, you can start the actual viewer which is called IPViewer. The warning strings: '/lib/libc.so.6': No such file it emits is non-fatal and as far as I can tell entirely ignorable.
  9. Its keystroke handling is a bit screwy: I found that it has some kind of 'double echo' problem on the console, so each key I press emits a character once when I press it and again when I release.
    loaclhost login: ddaann
    There is an autohiding menu at the middle of the top of the screen - mouse around near the titlebar to see if you can find it. From this menu I selected Tools →Session Options, and then the 'General' tab. This pops up a dialog box in wich there is a checkbox 'Keyboard Pass-through'. Selecting this option fixed the ddoouubbllee kkeeyyss problem for me. It's not all peachy yet, though, because neither Right Arrow nor DEL seem to do anything in Pass-through mode, and the latter of those is key (sorry) to entering the system BIOS Setup interface.
  10. The IPViewer.lax file has some interesting-looking settings, including the path to the JVM it wants (I tried with my system OpenJDK 1.7.025 and it kind of worked but the keyboard didn't work at all_) and the jvm max memory size. More as I find it.

Debian, runit, chruby, bundler#

Sun, 19 Jan 2014 11:18:31 +0000

Pretty much ever since I wrote it the software that powers this blog - a Ruby Sinatra app called "My Way" - has been running on a Bytemark VM inside a tmux session, and every time I've rebooted the server I've not only had to restart it by hand but first to remember how to restart it by hand.

I'm in the process of migrating the said VM to one of Bytemark's new BigV VMs (New More RAM) and taking the opportunity to clean it up a bit first. After reading Steve Kemp's article on runit I decided to give that a go. This is notes-to-myself on what I've found so far

 :; cat /etc/sv/my-way/run 
 exec 2>&1
 cd /home/my-way/my-way
 . /usr/local/share/chruby/chruby.sh
 chruby ruby-2.0.0 
 export LANG=en_GB.UTF-8
 exec chpst -u my-way -v bundle exec ruby -I lib bin/my-way.rb

 :; sudo update-service --add /etc/sv/my-way
 Service my-way added.

This is the script that starts the blog server, and the installation procedure thereof

Worthy of note:

  1. per convention, the run scripts (and attendant files) live in directories /etc/sv/someservicename, and these directories are are then symlinked into /etc/service by update-service
  2. chruby doesn't run in sh, so we run this script under bash
  3. it redirects stderr to stdout so the svlog process (see below) can see it
  4. it runs as root up until the chpst invocation, so the ruby that you specify needs to be in /opt/rubies and not in /home/yourusualuser/.rubies. If you ran ruby-install under sudo it will have put it in the right place.
  5. runing bundle install with the --deployment flag when installing the ruby project will have sidestepped a whole class of "can't find your gems" issues. So do that.

Next up is

 :; cat /etc/sv/my-way/log/run 
 exec svlogd /var/log/my-way

This is the script that makes sure logs go somewhere. Specifically, they go to the file /var/log/my-way/current, which svlog is able (though as far as I know not yet configured) to rotate according to some defined criteria, and without needing to restart the server. The log files are owned by root, but maybe that's changeable using chpst again.

:; sudo sv  status my-way
down: my-way: 94s, normally up; run: log: (pid 13620) 48806s
:; sudo sv  start my-way
ok: run: my-way: (pid 28343) 0s
:; sudo sv  status my-way
run: my-way: (pid 28343) 8s; run: log: (pid 13620) 48818s
:; pkill ruby
:; sudo sv  status my-way
run: my-way: (pid 28379) 31s; run: log: (pid 13620) 48949s
:; sudo sv  stop my-way
ok: down: my-way: 0s, normally up

And here's how I start and stop it and stuff. Note that it magically restarted after I ran pkill ruby.

If you can read this, it works.