Unable to connect to Ubuntu and Mint VNC server

When using the VNC server built into ubuntu and linux mint, many clients can’t connect with error:

Unkown authType 18

The easy solution is to disable encryption:

Method 1

$ dconf write /org/gnome/desktop/remote-access/require-encryption false

Method 2

$ sudo apt-get install dconf-editor

$ dconf-editor

navigate to /org/gnome/desktop/remote-access/ set require-encryption to false

I recommend setting a password for remote connections, otherwise internet users can connect using hole punching through your NAT.

Brother MFC-J220 (and other brscan3 printers) on Linux

Preface: This is for Linux Mint 18.1 which is based on Ubuntu 16.04, other distributions will be similar.


Brother offers the packages by themselves and an automated driver install tool. We’re going to use the automated tool. It uses dpkg and apt-get to install prerequisites, so make sure the apt/dpkg lock is available – Quit / Wait for any apt-get installs in other shells, and quit software update programs to be sure.

  1. Download the .deb ‘Driver Install Tool’ package from: http://support.brother.com/g/b/downloadtop.aspx?c=eu_ot&lang=en&prod=mfcj220_all
  2. Unzip the package and make the installer executable. Note: gunzip removes the original archive when unzipping
    $ gunzip ./linux-brprinter-installer-2.1.1-1.gz
    $ chmod +x linux-brprinter-installer-2.1.1-1
  3. Run the installer. Superuser permission is required. Put in your model number when requested.
    $ sudo ./linux-brprinter-installer-2.1.1-1 
    Input model name ->MFC-J220
    You are going to install following packages.
    OK? [y/N] ->y
  4. The installer will download the relevant package from Brother, install the prerequisites and the package. During this process you will have to agree to Brother and GPL licensing agreements.
  5. At the end of installing mfcj220cupswrapper you will be asked the location of the printer. If you are using USB then selecting no is fine.
    Preparing to unpack mfcj220cupswrapper-1.1.3-1a.i386.deb ...
    Unpacking mfcj220cupswrapper:i386 (1.1.3-1) ...
    Setting up mfcj220cupswrapper:i386 (1.1.3-1) ...
    Restarting cups (via systemctl): cups.service.
    Will you specify the Device URI? [Y/n] ->n
    Test Print? [y/N] ->y
    wait 5s.
    lpr -P MFCJ220 /usr/share/cups/data/testprint

    If you choose to manually specify, you’re presented an option list like this:

    0: ipp
    1: beh
    2: ippsbrscan3-0.2.13-1.amd64.deb
    3: socket
    4: ipp14
    5: lpd
    6: http
    7: https
    8: usb://Brother/MFC-J220?serial=XXXXXXXXXXXX
    9: hp
    10: smb
    11: hpfax
    12 (I): Specify IP address.
    13 (A): Auto. (usb://Brother/MFC-J220?serial=XXXXXXXXXXXX)
    select the number of destination Device URI. ->

    Hopefully you took the opportunity to print a test page and it all went well.

  6. Continue installing packages until complete.
  7. Note the installer downloaded the Brother packages into the current directory:
    $ ls

    Delete these or keep them around in an archive folder if you need the uninstallers.

OK, assuming that all went smoothly you should now have a working printer. However the scanner doesn’t work yet.

The installer package installed the brscan packages which drive the scanner. There’s one remaining file to download from the Brother driver page – the Scanner setting file. The driver page has the latest version.

If you need more information, the download page links you to: http://support.brother.com/g/s/id/linux/en/instruction_scn1c.html?c=eu_ot&lang=en&prod=mfcj220_all&redirect=on (This page has outdated versions and information for other distros)

Download the file from the main page and install it with:

$ sudo dpkg -i brother-udev-rule-type1-1.0.2-0.all.deb
Selecting previously unselected package brother-udev-rule-type1.
(Reading database ... 224361 files and directories currently installed.)
Preparing to unpack brother-udev-rule-type1-1.0.2-0.all.deb ...
Unpacking brother-udev-rule-type1 (1.0.2) ...
Setting up brother-udev-rule-type1 (1.0.2) ...
ls: cannot access '/etc/udev/rules.d/*.rules': No such file or directory

The error when installing the scanner config package is nothing to worry about. The following is what happens when removing the udev rule and reinstalling (you don’t have to do this step, it’s just a demo):

$ cd /opt/brother/scanner/udev-rules/type1
$ sudo ./install -e
$ sudo ./install
ls: cannot access '/etc/udev/rules.d/*.rules': No such file or directory

The udev rule gets installed fine though. Investigating the udev rule I discovered a second error:

$ sudo service udev status
Mar 18 23:58:11 xxxxxxx systemd-udevd[355]: unknown key 'SYSFS{idVendor}' in /etc/udev/rules.d/40-brother-libsane-type1.rules:17
Mar 18 23:58:11 xxxxxxx systemd-udevd[355]: invalid rule '/etc/udev/rules.d/40-brother-libsane-type1.rules:17'

It’s referring to an error in the file at /etc/udev/rules.d/40-brother-libsane-type1.rules

In newer versions of udev the SYSFS field has changed to ATTR. It looks like they tried to update it, repeating line 17 with both SYSFS on 17 and ATTR on 18. Go in and delete the SYSFS version on line 17.

While you’re in there remove any comments (#’s at the start) on the lower lines:


Setting the above makes the scanner available to normal system users (I think)

$ sudo nano /etc/udev/rules.d/40-brother-libsane-type1.rules
# delete the SYSFS line and uncomment the other lines
$ sudo service udev restart

We still need to make our Brother libraries available before we can use the scanner.

Confirm scanimage -L doesn’t work yet:

$ scanimage -L

No scanners were identified. ...

Make missing symbolic links (probably because we used 64 bit driver):

$ sudo mkdir /usr/lib/sane
$ sudo ln -s /usr/lib64/sane/libsane-brother3.so /usr/lib/sane/libsane-brother3.so
$ sudo ln -s /usr/lib64/sane/libsane-brother3.so.1 /usr/lib/sane/libsane-brother3.so.1
$ sudo ln -s /usr/lib64/sane/libsane-brother3.so.1.0.7 /usr/lib/sane/libsane-brother3.so.1.0.7

Confrim scanimage -L now works:

$ scanimage -L
device `brother3:bus7;dev1' is a Brother MFC-J220 USB scanner

You should now try scanning. I use simple-scan. If your scanning program doesn’t work, try running as superuser in case there’s a permissions problem.

The brscan-skey package handles scanner buttons, info on setting it up is available eslewhere.

Hope that helps, it’s been a long one.

/dev/urandom is too slow to fill a drive

I can never remember how to use OpenSSL to generate randomly seeded garbage. Thankfully, there’s a post on netzgewitter.com:

Speed wiping a hard drive with crypto garbage generated by openssl

Update: netzgewitter.com seems to be down. Here’s the important bit:

$ openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt </dev/zero > /dev/sda

replace /dev/sda with the block device you wish to erase

Wireless card stops working on Linux

2 Tips, especially for ath9k users:

Tip 1 – Unload and Reload your driver

Have you tried turning it off and turning it on again? No, seriously. Unload and reload the driver. I had an ath9k card that would work again for hours after doing this:

$ modprobe -r ath9k
$ modprobe ath9k

Eventually it stopped working and I replaced it with a D-Link DWA-131. I could have tried tip 2 first:

Tip 2 – Turn off hardware encryption

The parameter name varies between drivers, but the method is largely the same:

Create/Edit driver options file:

$ sudo nano /etc/modprobe.d/ath9k.conf

Put contents:

options ath9k nohwcrypt=1

Then reboot.

D-Link DWA-131 rev. E on Linux

Today’s topic: The D-Link DWA-131 Wireless N Nano USB Adapter.


Early models in round cases used chipsets which now have inbuilt support (rev A- realtek 8192su, rev B – realtek 8192cu), but the newer ones (revision E) use a realtek 8192eu. There is a driver available from D-Link, but for me it was a kernel-panicky mess.

This is a list of instructions that I used to install a driver hosted by github user jpostma which seems to be the official realtek driver with patches (for what? not sure, but it works) applied.

User Brainiarc7 suggests using https://github.com/Mange/rtl8192eu-linux-driver which also has patches applied, as it is “Newer, and currently under maintenance.” I had a look at it, and it already has the DWA-131 device id, so I recommend you use it first.

This is for an ubuntu based linux distribution, but for others the principle is the same.

Plug the adapter in and determine the device ID, ensure it is 2001:3319 otherwise you have a different device:

$ lsusb
Bus 001 Device 004: ID 2001:3319 D-Link Corp.

Ensure you have the necessary prerequisites:

$ sudo apt-get install linux-headers-generic build-essential git

Clone the github repository with the driver source code:

$ git clone https://github.com/jpostma/rtl8192eu.git

Once the repository is downloaded, edit rtl8192eu/os_dep/linux/usb_intf.c
and add the device ID of our card, at around line 321.

#ifdef CONFIG_RTL8192E
    /*=== Realtek demoboard ===*/
    {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x818B,0xff,0xff,0xff),.driver_info = RTL8192E},/* Default ID */
    {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x818C,0xff,0xff,0xff),.driver_info = RTL8192E},/* Default ID */
    {USB_DEVICE(0x2001, 0x3319),.driver_info = RTL8192E}, /* D-Link - DWA131 Rev. E */

Edit rtl8192eu/Makefile and change 2 things:

  1. At about line 16 add a # to comment out a flag that causes compile problems on recent kernels:
    #EXTRA_CFLAGS += -Wno-error=date-time
  2. At about line 42 edit the line to switch power saving off:




Compile the driver:

$ cd rtl8192eu
$ make

If there are any problems with compilation go back and fix them (install libraries, etc.) before proceeding.

Install and load the driver:

$ sudo make install
$ sudo modprobe 8192eu

This is what worked for me, and since setting it up it’s been flawless.