Sunday, April 1, 2018

Extend laptop battery life in Linux?

I came across a thread at the Debian User Forums a while ago on this subject. One post there suggested installing TLP.

The Mint Guide suggests you need to run 
# tlp start
once to start it.

I don't use my laptop very much at the moment so I haven't been able to test it. At some point I will try to get round to doing a test and post an update, but if you find laptop battery life is poor compared to Windows, maybe try this.

Cancel print job in Gnome (Debian Stretch)

After over a year of using Debian Stretch, I finally found an issue to write about: it doesn't seem to be possible cancel a print job from the Printers dialogue in Gnome.

Possibly it's this bug, which seems to have been fixed just a few weeks previously to this post, so will still be affecting Stretch.

A solution I found here is to run the CUPS interface and delete the job from there:
http://localhost:631/jobs/
Cheers Zwets for that!

Tuesday, March 20, 2018

Installing Brother HL-1212 W-Fi Mono Laser Printer in Debian Stretch (Gnome)

I have never been a big fan of inkjet printers. My first clogged up regularly and required the print heads to be cleaned. Eventually It gave me a message that it had reached the end of its service life or similar. A web search told me I needed to open and clean out the ink reservoir. When I did, I found a small sponge where ink is deposited during the cleaning process- full of about two ink cartridges' worth of (very expensive) ink.

My last printer was better in that the cartridges contained the print head, so fewer blockages. However, the cartridges were horribly expensive. I tried some non-genuine ones, but experienced banding in prints with one cartridge, and another two were rejected by the printer shortly after installation. (I read somewhere that the manufacturer had updated printer firmware on some models to reject non-genuine cartridges, and as the printer was internet connected, that's a possibility with mine.)

Having paid about £25 for a set of genuine inkjet cartridges a while ago, I was more than somewhat annoyed to find that the printer had stopped working when I tried it recently. The print heads seemed to be blocked. Running the cleaning cycle improved printing a bit, but not enough to be useable (and no doubt wasted a lot of that expensive ink).

Rather that fork out another £25 quid to check if indeed it was the cartridges, I decided to have a look for a cheap laser printer. And indeed they are cheap these days. £45 gets you a USB model and £50-55 or so a wireless model.

I saw the Brother printer in the title of this post on sale for £49.99 and it looked good. Unlike other models from other manufacturers it comes with a full toner cartridge- not just a half-full trial cartridge.

But was it going to be usable in Linux? Well, the Brother web page had Linux drivers for download, and a Google search brought up some posts from various forums from people who had got it working in Linux, so I snapped one up.

I will relate the procedure I went through first, but this won't be a good procedure to follow because it didn't work at first- I'll recap the correct procedure at the end.

First I tried plugging in the printer, turning it on, and connecting it to the computer. (You'll need a USB computer cable. The manufacturer obviously assumes that everybody has one lying around from a previous printer purchase- in this case correctly.)

A pop-up appeared to say that Gnome was configuring the printer. That sounds good! Then another one appeared to say a driver was needed. I clicked OK to look for it, but a message appeared to say that a driver hadn't been found, with a link to a web page explaining it might be proprietary software.

However, the printer was available in the printer dialogue, although it had defaulted to a driver that didn't match my printer model. I tried printing a test page, but characters in the text were deformed.

Obviously I needed to install the driver for my printer from the Brother website.

Before doing that, I wanted to see if it was possible to set up a network connection for the printer, as it has Wi-Fi. I did this by using the WPS button on my router, then pressing the Wi-Fi button on the printer for a few seconds. The printer connected to the network and I was able to find its IP address from the router. Once I'd done that I was able to access the printer control page by tying the IP address into my web browser.
Using the menus I could enter the router password (Network/Wireless/Personal) and give the printer a static IP address.

Without a WPS button, I suspect it may be possible to access the control panel using localhost, although I didn't test this out. If you don't have WPS, open CUPS, see if the printer has an IP address, and type it into a browser, as described in step 5b in this page on the Brother web site.

So, printer successfully network enabled, I went on to install the printer driver.

(First I removed the non-working brother printer from the Printers dialogue.)

Brother has a very easy to use installation tool for Linux drivers for its printers. I should say easy to use if you are OK with working in a terminal, but not difficult to run even if you aren't. Here is the link:

Brother driver install tool.

Read the notes before downloading because there is some important information. For Debian Stretch, it's the following:
Requirement ia32-libs or lib32stdc++ is required to be installed.
In Stretch it seems to be lib32stdc++6, which also brings down some 32 bit architecture (the drivers are 32 bit, I think).

That done, I downloaded the tool and followed the steps in the guide. Having set up my printer with a static IP address, at the end, where it says...
When you see the message "Will you specify the DeviceURI ?", For USB Users: Choose N(No) For Network Users: Choose Y(Yes) and DeviceURI number.
I entered the IP address I had given the printer, and the tool installed the printer as a network printer.

There was this warning at the end, but I think it's only a warning about a missing folder in Sane, and as the printer doesn't have a scanner, I don't think it's critical.
ls: cannot access '/etc/udev/rules.d/*.rules': No such file or directory
After the process finished, a test print produced perfect results!

So recap, if you are installing the printer and want to use the Wi-Fi connection, first try to set up the printer on the network, then run the Brother driver installation tool with the IP address you gave the printer.

To conclude, some pros and cons of the printer.

Cons:
  • Only prints in black and white, in case you missed the word "mono" in the title.
  • Still has my pet hate of desktop printers: the external paper tray. If you don't use the printer for a while, the paper sits in the open gathering dust, until the next print, when that dust is drawn into the machine.
Pros:
  • Cheap
  • Works with Linux
  • Fast, good quality, dry prints
  • come with a full toner cartridge

Sunday, March 18, 2018

OpenVPN in Gnome

Here's how to use OpenVPN in Gnome.

First you will need to install openvpn and its dependencies.

You will also need to install network-manager-openvpn-gnome.

Failure to do so will result in the following message when trying to add a password or otherwise edit VPN settings:
Error: Failure to load VPN connection editor.
I have been using VPNBook OpenVPN: highly recommended.

The only thing to note is that they do change the password every so often, resulting in a failure to connect. New passwords used to be announced on Twitter, but they seem to be on the web page now.

Saturday, September 23, 2017

OpenDNS IP Updater for Dynamic Networks - ddclient in Debian

I've been trying out OpenDNS's web content filtering. This computer is used (stress tested!) by two children, and I didn't want them straying onto any nasty sites.

The only problem is that my ISP gives me a dynamic IP address- which changes now and then, and when it does, content filtering stops.

Somebody suggested a Linux IP updater.

The updater uses ddclient, so the first thing to do is to install that from the Debian repository. The installer offers a lot of configuration options, but just click through those because you're going to add a custom configuration file from the link above, replacing the one that is written to the etc/ddclient.conf file.

These are the configuration settings I used:
##
## OpenDNS.com account-configuration
##
use=web, web=myip.dnsomatic.com
ssl=yes
server=updates.opendns.com
protocol=dyndns2
login=opendns_username
password=opendns_password
opendns_network_label
DNS-O-Matic is an OpenDNS service that detects your IP address- which is then fed to the OpenDNS server and updated if it has changed. (You change the checking interval by editing /etc/default/ddclient).

(In Debian at least the default setting seems to be for ddclient to run as a daemon, and there doesn't appear to be a need to add anything to start it.)

Login=the email address that serves as your OpenDNS login: joebloggs@gmail.com.

Password=your OpenDNS password, inside single quotes:'password$' (Apparently ddclient is written in Perl and special characters must be in quotes in Perl, and OpenDNS insists on at least one special character in password.) *see warning below.

opendns_network_label is the name you have given to your network on the OpenDNS settings page: for me it was Home. (NB If you have spaces in your network label, they must be replaced by underscores.)

So the final three lines were:
login=joebloggs@gmail.com
password='password$'
Home
You can test if the updater is working by running
# ddclient -verbose -file /etc/ddclient.conf
For me the updater didn't work at first- my IP address changed but OpenDNS wasn't updated.The above command gave the following error message:
updating: authorization failed Unauthorized FAILED
After an hour or two of Googling, I eventually stumbled upon a solution at DynDNS Community Forum: *apparently ddclient doesn't handle special characters well (even in quotes), and I had several in mine.

I changed my password for something with only one special character (a boring old $- they seem to be acceptable), and my IP address was updated in the OpenDNS settings, so everything seems to be working OK now.

Thursday, April 20, 2017

Can't reply to comments in Blogger?

You'll need to enable third party cookies.

Update:

In Google Chrome, you can add an exception for third party cookies in Privacy > Content settings, rather than allowing all.
In Firefox I found that it was Privacy Badger causing the problem by blocking the blogger.com cookies. Moving the slider to Allow fixed the problem.
I had already allowed third party cookies in Firefox, because blocking them caused a problem on a particular website (can't remember where), but it is also possible to block them and add exceptions in Preferences >Privacy > History > Use custom settings for history.

Update 2:

If you have blocked third party cookies in Firefox, add an exception for https://blogger.com:
Note: https

Stop code: NTFS file system

"Your PC ran into a problem and needs to restart."

Over and over again- the dreaded boot loop.

Here's how to fix it*. (The bad news is you'll need access to another Windows 10 computer, assuming you haven't already created a Windows 10 installation DVD or USB drive.)
  • Set the computer to boot from USB or DVD, depending on the media you created, either from the BIOS, or by tapping F8 while booting, which on this computer gave me boot medium options.
  • Boot from the Windows Media DVD or USB drive you created. 
  • Click on Repair your computer at the bottom left of the window. 
  • Click on Troubleshoot > Advanced Options > Command prompt
  • Type in "diskpart" and wait a few seconds. 
  • In Diskpart, enter "list vol". 
  • Look for the volume label of the main partition on the HD- it will be NTFS and many GB. On this computer it was E.
  • Type "exit" to get out of Diskpart. Run Chkdsk on the main partition. In this case it was "chkdsk e: /f"
Thanks to td512 at superuser for the info which helped me identify the correct drive letter to use.

* The root cause may be an interrupted power supply or a failing hard drive. In this case I suspect a faulty power cable. If disk errors are the result of a failing hard drive, the fix may be temporary.