Firefox opening binary files in gedit

June 23rd, 2016

Firefox logoFirefox started getting a nasty habit of opening some files in gedit. Of course, there’s a bug report. In there, there’s a workaround:

I found a strange entry in ~/.local/share/applications/mimeapps.list

application/octet-stream=gedit.desktop;

This means open almost any kind of binary file in gedit. Perhaps you have something similar. Deleting that line has solved the problem for me, until next time.

I had that line too. Deleting that changed Firefox’s behaviour to something less prone to gedit’s madness.

ZSH man pages missing on Ubuntu 14.04

July 28th, 2015

ZSH logoFix is from a bug report:

sudo apt-get install zsh=5.0.5-4ubuntu1~ubuntu14.04.1 zsh-common=5.0.5-4ubuntu1~ubuntu14.04.1 zsh-doc=5.0.5-4ubuntu1~ubuntu14.04.1

Hattip to this comment on the original bug.

Bonus: it gets you a newer ZSH.

Printing OU style

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

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

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 :)

BlackBoard Collaborate powerpoint import problem

March 18th, 2015

OU logoIn a nutshell: if you get an error “the <ppt> file type is not supported“, download the Visual Basic 5 Runtime from Microsoft and install it.

This solved the problem for a colleague of mine in windows.

Hattip to http://www.wecollaborate.com/forum/topics/workaround-for-the-ppt-file-type-is-not-supported?xg_source=activity.

Ubuntu + Bluetooth disabling / re-enabling every 5 seconds on Toshiba Z930

March 11th, 2015

Ubuntu iconThere’s an interesting thing happening with Bluetooth and Ubuntu 14.04. If you check dmesg, you’ll see something like:

....
[  464.115830] toshiba_bluetooth: Re-enabling Toshiba Bluetooth
[  464.155555] usb 1-1.2: USB disconnect, device number 90
[  464.655517] usb 1-1.2: new full-speed USB device number 91 using ehci-pci
[  464.848663] usb 1-1.2: New USB device found, idVendor=8087, idProduct=07da
[  464.848675] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
...

This is repeated every 5 seconds. Thankfully, people are working on a solution!

See:

The latter has a proposed patch that I’m using right now. It stops the spam in the logs, that’s clear :)
What’s not yet clear to me (see also my comment there) is whether Bluetooth keeps working well.

NTLM authentication working!

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)

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)

CNTLM downer (setting up my laptop for the OU, part X)

February 19th, 2015

OU logoFrom the CNTLM man page:

But please note that NTLM WWW auth (that is auth to HTTP servers), when it is running without any parent proxy as a standalone proxy server in itself, won’t probably be implemented ever. Even though the tasks share common NTLM authentication, they are different things. Also, I’ve never seen any access-protected HTTP server requiring solely NTLM without any alternative. Such a narrow-spectrum tool can be written in Perl in a few minutes. I strive to keep the code of cntlm simple and efficient.

“Never seen that”? Well, allow me to introduce to you: The Open Universiteit :s.

And yes, me and perl won’t see eye to eye in “a few minutes”.