Archive for the ‘work’ Category

Printing new OU style

Monday, October 23rd, 2017

OU logoThis is a followup of my previous post on printing at the OU, due to new printers being installed.

The new process is somewhat easier:

  • Add new printer
  • Choose LPD and give as name the print queue IP address
  • Choose to install a driver from file, and download the Konica Minolta driver for the C368 (which covers a whole range of Konica printers)
  • Set the options according to the documentation for Macs
  • Finally / most importantly, make sure to submit print jobs under your acronym.
    • for command-line programs: set up an environment variable CUPS_USER. Set it to be your acronym, i.e. export CUPS_USER=acro.
    • for generic purposes: lpoptions -dPRINTER -o requesting-user-name=ACRONYM
  • Now you’re ready to print!

Displaylink driver hogging CPU

Wednesday, June 28th, 2017

OU logoDisplayLink logo
As mentioned before, DisplayLink works over USB3.0 connection. Hooray!

Except that the current driver is hogging unfortunate amounts of CPU. ~2% when nothing’s happening, but up to 80% when switching windows. I noticed it because of harsh lag. I mean, my computer isn’t the newest on the block, but it still should be pretty awesome. Typing in an online form should be trivial, not something that causes delays…. but it wasn’t.

Getting frustrated with the lag, I’ve uninstalled the driver for now. Life immediately sped up.

Printing OU style

Thursday, April 2nd, 2015

OU logoFollowing up on my previous instructions, this time the full story – including double sided printing.
update 2017-06-28: additions to clarify some points (there was some confusion for me after a reinstall, hopefully this fixes things).
Edit 2017-10-23: New printers, see new update.

  • Go to the “add printer” dialog
  • Choose LPD printer, add the name.
    Name is something like MFP-XXX-A0YYYY. XXX for my building is HLR – my printer is MFP-HRL-A09950.
  • Download the C360 printer driver (PPD) from the Konica Minolta website (I found multiple options, ended up using the file KOC360UX.ppd)
  • Use this printer driver. Configuration:
    • paper source unit: PC-408
    • Finisher: FS-529
    • Punch Unit: none
    • Saddle kit: none
  • Now you need to set up authentication. With thanks to:
    here:

    1. Configure the printer normally as LPD – write down the name you choose eg. CASACRISTO
      IMPORTANT: Choose the driver Generic Postcript/FoomaticEdit: don’t, use the regular ppd as explained above.
    2. Open a terminal and stop CUPS.
      sudo service cups stop
    3. Edit /etc/cups/ppd/CASACRISTO.ppd
      Adding these 3 lines just before the last line:
      Edit: that means: make sure these 3 lines are the last in the file. A newline at the end of the last one of these ends the file.

      *cupsFilter: "application/vnd.cups-raw 0 minolta"
      *cupsFilter: "application/vnd.cups-command 0 commandtops"
      *cupsFilter: "application/vnd.cups-postscript 0 minolta"
      
    4. Create /etc/cups/ppd/CASACRISTO.km (enter your own tracking number instead of 1234).
      Edit:I used the pincode for scanning here, and the name of the printer, i.e. MFP-HRL-A09950.
      ACCOUNT_NAME="casacristo"
      ACCOUNT_PASSWORD="1234"
      ACCOUNT_COETYPE="0"
      
    5. Create /usr/lib/cups/filter/minolta with this content:
      #!/bin/bash
      source /etc/cups/ppd/${PRINTER}.km
      
      echo -en "\033%-12345X"
      echo -en "@PJL JOB\015\012"
      echo -en "@PJL SET KMSECTIONNAME = \"${ACCOUNT_NAME}\"\015\012"
      echo -en "@PJL SET KMSECTIONKEY2 = \"${ACCOUNT_PASSWORD}\"\015\012"
      echo -en "@PJL SET KMCOETYPE = ${ACCOUNT_COETYPE}\015\012"
      echo -en "@PJL ENTER LANGUAGE = POSTSCRIPT\015\012"
      
      cat -
      
      echo -en "\004\033%-12345X\015\012@PJL EOJ\015\012"
      echo -en "\033%-12345X"
      
    6. Make it executable: sudo chmod +x /usr/lib/cups/filter/minolta
    7. Restart CUPS: sudo service cups start
  • To print doublesided: choose tab “advanced”, not tab “page setup”.

USB3 DisplayLink adapter and Linux: a big YESYES

Monday, March 30th, 2015

OU logoThe OU is using Kensington DisplayLink docking stations. They’re pretty nifty: one USB plug gets you internet, audio, and video. Under windows, that is :s.

After googling a bit, it turns out that DisplayLink did not release any drivers for the USB 3.0 version for Linux. Why? Because they support HDCP, a copy-protection measure for displays. And they have not (yet?) figured out how to preserve that type of copy protection and have open source drivers (nor, apparently, preserving that with closed-source drivers).

There’s at least one person looking into getting USB3 DisplayLink working via Linux. And it kind of sounds like he’s trying to hack HDCP in the process, just because he wants to use his hardware to actually do something. Ugh.

UPDATE (2017-02-07): Woohoo! Solution! There’s an Ubuntu display driver available from Displaylink. See http://support.displaylink.com/knowledgebase/articles/684649-how-to-install-displaylink-software-on-ubuntu. It requires kernel v3.16, which you can get from Ubuntu 14.04.2 onwards. (Thanks to new colleague Fabian for finding this out!).

In a nutshell:

  • Make sure you’re running linux kernel 3.16 or above
  • Download driver-installer
  • Install a signed kernel, boot into signed kernel
    sudo apt-get install linux-signed-generic-lts-$VERSION – currently, version is “xenial” but you can check which is the latest by using filename completion (i.e., press <Tab>) and picking the newest one.
  • Install DKMS: sudo apt-get install dkms
  • Execute the downloaded installer:
    sudo ./displaylink-driver-$version.run
  • Unplug your monitor cable and give the system 10-20 sec to resetup the monitor via the USB3 port.

Sidenote:
Using the actual USB3 port on my system instead of a USB2 port increases the speed sufficiently to allow internet, sound, webcam and display all over one port. In retrospect, it’s kind of obvious that even just running internet and sound over it would become challenging for video conferencing. Great detecting there, Sherlock me.

Update 2017-02-17: If you’re updating the kernel, the installed driver might no longer work (happened to me). In that case: sudo displaylink-installer uninstall to remove the driver, reboot, reinstall the driver by sudo ./displaylink-driver-$version.run and you’re good to go again!
You don’t even need to reboot after reinstalling the driver.
I’m not sure if you need to reboot at all, but I figured better 20 secs extra and sure about having purged the previous install than lingering in limbo.

Thanks to:
http://displaylink.org/forum/showthread.php?t=1748&page=16
http://airlied.livejournal.com/80516.html

Libreoffice and Apache OpenOffice side by side on Ubuntu 14.04.2 LTS

Friday, March 27th, 2015

Ubuntu logoOU logoHere’s the conundrum: to load slides into BlackBoard Collaborate (the Open Universiteit’s online teaching environment), I need Apache OpenOffice (AOO). To collaborate with people who work in MS Office (most of my colleages, most of the students), Apache OpenOffice is not good enough. Libreoffice (LO) is.

So I need the two side-by-side on Ubuntu. Which isn’t easy.

1. Getting Apache OpenOffice to work with Collaborate

  • sudo apt-get purge libreoffice\*
  • Download openoffice and dpkg -i the necessary files (don’t forget the desktop-integration subdir!)

If you install AOO before removing LO, then the install isn’t complete. Even though you can use AOO, Collaborate cannot. So purge your LibreOffice :s

2. Getting LibreOffice back on your system without destroying things

DO NOT INSTALL LibreOffice FROM THE OFFICIAL REPOSITORIES!
It fails and leaves your package database in an inconsistent state. I had to manually solve the problem by using

  • dpkg -l | grep libreoffice to check which packages there were, and
  • removing these with dpkg --purge.

The convenient command ended up being:
dpkg -l | grep libreoffice | cut -f 3 -d ' ' | xargs sudo dpkg --purge

That wasn’t quite enough to fix the database — there was a remnant of another package in the way. Removing that one (dpkg --purge python3-uno) addressed that, and then apt-get was happy with me again.

So what to do? Here’s how: download the latest LibreOffice, and install LO from the downloaded DEB files (tar -zxvf $downloadedfile; cd $LOdir/DEBS; sudo dpkg -i *deb). That works, and you now have the two side by side :)

NTLM authentication working!

Thursday, February 26th, 2015

OU logoWoohoo! I got NTLM to work! What a relief to finally feel “connected” with the rest :)
How I finally managed: I installed NTLM APS version 0.9.9.5, and used the following config values (keeping only the pertinent values, the rest isn’t changed):

[GENERAL]
PARENT_PROXY:

[NTLM_AUTH]
NT_HOSTNAME:
NT_DOMAIN:pwo
USER:hjo
PASSWORD:
LM_PART:1
NT_PART:1
NTLM_FLAGS: 07820000
NTLM_TO_BASIC:0

Let’s see if it still works with debugging turned off…yup! So I’ve updated that in the above description.

I’ve now added a tiny PAC file, proxy-for-local-domain.js:

function FindProxyForURL(url, host) {
        host = host.toLowerCase();
        
        // Route all OU traffic through local NTLM authentication-
        // handling proxy
        if (dnsDomainIs(host, ".ou.nl"))  {
                return "PROXY 127.0.0.1:5865";          // (IP:port)
        }

        // Anything else: just direct
        return "DIRECT";
}

and then configured Firefox to use an automatic proxy configuration url of file://.../proxy-for-local-domain.js. Tested and it works! woohoo!

Writing my own python proxy (OU setup part XI)

Thursday, February 19th, 2015

Python seems to have partially solved my problems. In particular, the requests-ntlm package works. So far, I’ve done this:

  • sudo apt-get install python-pip
  • sudo pip install requests_ntlm
  • Follow the instructions on the requests_ntlm page in the Python interpreter:
    >>> import requests
    >>> from requests_ntlm import HttpNtlmAuth
    >>> requests.get("http://www.intranet.ou.nl", auth=HttpNtlmAuth('pwo\\XXX', 'mypassword'))
    
    

Eeeks! We get a 200! Most likely, it’s an HTTP 200 status code – i.e. here’s the goods!! Darnit, now all I need is to get my hands at the result. (r=requests.get("...") and r.text was sufficient)

Printing running; NTLM authentication 1 step closer

Friday, February 6th, 2015

With some help of the OU IT staff, I got one step closer to two things!

NTLM authentication

This was my goof-up. The cntlm config file was only readable by root. Le doh!
So:

  1. install cntlm
  2. config /etc/cntlm.conf as:

    Username hjo
    Domain www.intranet.ou.nl

    # List of parent proxies to use. More proxies can be defined
    # one per line in format : Proxy 145.20.126.12:8080
    #Proxy 10.0.0.42:8080

    # List addresses you do not want to pass to parent proxies
    # * and ? wildcards can be used
    #
    NoProxy localhost, 127.0.0.*, 10.*, 192.168.*

    # Specify the port cntlm will listen on
    # You can bind cntlm to specific interface by specifying
    # the appropriate IP address also in format :
    # Cntlm listens on 127.0.0.1:3128 by default
    #
    Listen 3128
    Listen 3310

  3. run chmod go+r /etc/cntlm.conf
  4. Generate the password hashes for authentication: cntlm -H and enter your password. Example:

    $ cntlm -H
    Password:
    PassLM FE03A594184396D6552C4BCA4AEBFB11
    PassNT F3496B77FA086840D57D7F868C476AC8
    PassNTLMv2 9AB19C7C88EADFC4DE62B818E2878131 # Only for user ‘hjo’, domain ‘www.intranet.ou.nl’

  5. copy the password hash lines to //etc/cntlm.conf below username/domain.

That’s where I’m at now. It still doesn’t work, but we jumped through another hoop! :)

Printing

I followed now the Mac instructions again:

  1. Go to the “add printer” dialog
  2. Choose LPD printer, add the name.
    Name is something like MFP-XXX-A0YYYY. XXX for my building is HLR – my printer is MFP-HLR-A09550.
  3. Download the C360 printer driver (PPD) from the Konica Minolta website (I found multiple options, ended up using the file KOC360UX.ppd)
  4. Use this printer driver. Configuration:
    • paper source unit: PC-408
    • Finisher: FS-529
    • Punch Unit: none
    • Saddle kit: none
  5. Now you need to set up authentication. I’m not clear on how to do this (doesn’t work yet), but good info seems to be available from:
    • here for printers in the same class (Konica Minolta C220/280/360 share the same printer driver, apparently)
    • here for other printers.
      This explanation includes a link to an explanation on how to send the correct printer commands apparently.

This actually works!

PS: I was running this while using the Java Juniper client, so I was on the VPN.

Connecting to VPN (Juniper) on Ubuntu 14.04 64 bit

Wednesday, February 4th, 2015

The OU is using a VPN. You can connect with a Java applet, unfortunately, we’re still running an older version that relies on the 32 bit java version.

Instructions for working around that can be found
here.
Moreover, my home dir is encrypted, which apparently a problem (see comment about encrypted home dirs).
Solution to that one from here:
move the setuid binaries somewhere else and symlink them.
I.e.:

  • sudo mv $HOME/.juniper_networks/network_connect/ncsvc /opt/juniper-vpn/ncsvc
  • ln -s /opt/juniper-vpn/ncsvc $home/.juniper_networks/network_connect/ncsvc

This gets it working. Funnily enough, I still cannot connect directly to intranet – so what is Juniper now doing for me anyway? :)

Edit
Note that you should *ONLY* link the SUID binary. If you symlink the whole directory, it doesn’t work and Juniper crashes.
(Thanks Juniper, for that fun-filled 45 minutes of hunting the internet on why you crashed!)

Exchange + Google calendars in Thunderbird

Monday, February 2nd, 2015

Thunderbird logoPart 2 of getting set up. Obviously, I have an Exchange calendar. Obviously, people are going to be using that to gauge when I’m available. So I need to manage that calendar in a way that works.

Enter the Lightning plugin for Thunderbird! With the previously mentioned DavMail, you can get your exchange calendar in Thunderbird. Which kind of beats Microsoft’s web interface – though not by much.

I also added a Google calendar via CalDav (which works directly with Lightning). Adding and deleting events is nicely synchronized :) Adding another (big) Google calendar, however, borked the overview (appointments no longer shown), though the list above the calendar still showed correct info.