Category Archives: Uncategorized

Modernising the Windows Console

My work laptop is stuck in Windows-land really, because of some required corporate applications. Lately I’ve been writing a fair bit of Python, and using the coloredlogs extension to the logging module to produce pretty logging from my code. Except on Windows, where the standard CMD prompt doesn’t understand ANSI colour codes, which is kind of a pain.

There are a few solutions that patch the default command prompt, to add back in ANSI support (DOS always had it available, way back when), but they all seemed a bit hacky.

So I switched to ConEmu, which provides a huge list of features, including ANSI colour support, tabs, all kinds of display modes, transparency, xterm-style cut&paste, and a canned list of contained applications, including CMD, Powershell, Chocolatey, Cygwin and that funny shell with all the environment set up that Visual Studio uses. Of course, you can also add your own.

Now I have a nicer-looking and nicer-acting console, and my Python logging colours work properly!

After playing with that for a while, I noticed the option to enable Clink inside ConEmu. Clink adds a large range of bash-style features to Cmd itself, like saved history, incremental history search and fancy completion, as well as simple things like being able to press Ctrl-V to paste, and readline editing (emacs keys to edit the input).

Leave a Comment

Filed under Uncategorized

IOS XR SSH: “Server refused to allocate pty”

Just another SSH note, since it took me a while to work out what was going on: if you putty into an IOS XR router (ASR9001 in my case) with SSH Agent Forwarding enabled then it just drops the connection with this message: “Server refused to allocate pty”

Solution: don’t do that. Turn off Agent Forwarding in the SSH options (or stop using ssh -A for the commandline client).

Leave a Comment

Filed under Uncategorized

RANCID, ssh, Cisco MDS and “too many authentication failures”

I just ran into this, and it took a little while to figure out, so here’s my quick note. If you have a Cisco MDS being backed up by RANCID, then you can get the following odd message, even if it’s the first time you tried to log in with this user:

Received disconnect from 10.0.7.5: 2: Too many authentication failures for confbackup

What is happening is that the ssh client tries with whatever public keys it has configured first, and then the password-based auth that you thought it was doing all along. With a few keys, that’s enough to annoy the MDS into closing the connection.

The solution is to disable public-key auth for this connection. To do that with RANCID requires a little bit of extra work. First, create a shellscript (I call mine /opt/rancid/local/ssh-no-pubkey):

#!/bin/sh

ssh -o PubkeyAuthentication=no $*

Then for the devices that are suffering, tell RANCID to use this new SSH command instead of just ‘ssh’. In .cloginrc:

add sshcmd mds01 {/opt/rancid/local/ssh-no-pubkey}

Now RANCID can login and backup the config fine.

Additional tip – the ‘cisco’ device type seems to work better than the (theoretically correct) ‘cisco-nx’ device type for MDS switches.

Leave a Comment

Filed under Monitoring, Network, Tech, Uncategorized

KIO’s zasm on Ubuntu

kio makes a nice-looking z80 assembler with lots of interesting output options for cross-development to a ZX Spectrum target, like writing .SNA files straight from the assembler. However, it only comes with binaries for a few platforms (or rather not all versions on all platforms), and source-code comes with just an xcode build file. The instructions then just say ‘create a Makefile’ to get it to compile! Here’s how I compiled it on Ubuntu 14.04…

First, you’ll need a c++ compiler:

sudo apt-get install g++

Then, you’ll need the config.h for linux:

cd {the directory you unzipped the source into}
cp config.h config.h-dist
cp config.h.LINUX config.h

Then compile it all together in a single line:

g++ -o zasm -I. -I kio *.cpp kio/*.cpp -lpthread

Which should leave you with a zasm binary in the current directory.

To install:

sudo cp zasm /usr/local/bin

Finally, to get an emulator to feed your project to:

sudo apt-get install fuse-emulator-gtk

1 Comment

Filed under Uncategorized

Personalising your Apple product is the door to a world of pain…

Apple do this nice service when you order directly from the Apple Online Store where you can get an engraving on the back of your iPod, iPad etc for free. It looks really nice, and it adds about a day onto the delivery time. What could go wrong? Well, let me tell you a story…

I recently bought an iPad Mini for my girlfriend’s birthday. Got her a nice designer case for it, a data nanosim and a cute little private joke engraved on the back (along with her e-mail address – I’m still fairly practical). She loved it, and started “moving in” straight away. The next day though, it was failing already – the display backlight wouldn’t light and in just the right light you could make out a very rough-looking display. So we wiped it clean (iTunes could still talk to it) and went to the Apple store.

First of all, one does not simply walk into an Apple store. Obviously you need an appointment with a “genius” to actually get customer service. Although it turns out if you stand in the middle of a ipad-buying crowd with a dead unit and a grumpy face, someone will help. Except they can’t, because it’s personalised, so it has to go back to the mothership.

The one super-impressive part of the customer service experiences comes next – Apple’s phone system. If you call from the phone that they have recorded against your name for your account, the phone system just says (literally) “Oh, is it about that ipad?”, and everyone knows what is going on. Neat!

They send out a courier box for the unit, and you send it back. Then they send out the repaired one. Unlike the Apple store itself, they use TNT, and they don’t let you know the tracking number for the repaired item.

So my repair is turned around in a day or so, and then the item is just marked “shipped” on the Apple site. I wait, and wait some more. After speaking to Apple customer service, they want to wait until TNT have had their “allow for delivery” time, which is something like 10 days. I did get the tracking number from them though, so I could play along at home – it just says “out for delivery” for several days. Eventually TNT admit that actually they’ve lost it, so Apple organise another replacement, with personalisation. They confirm the details, and get it sent. It arrives a few days later, and it’s the wrong spec. We go back two steps and repeat one more time. Finally, 6 weeks after her birthday, we have a working unit!

In their defence, I did get personal contact details from several folks at Apple who followed the case through for me, but it shouldn’t really come to that. Obviously, if I’d have just bought the unit without personalisation, I could have had it swapped out at the local physical store, and been done in a day or two.

Think twice before engraving!

Leave a Comment

Filed under Uncategorized

Something is wrong somewhere

I was sitting at my desk watching John Allspaw’s Alert Design presentation in the corner of my screen, while doing some ‘real’ work, and I heard this odd noise. It was familiar, it was an alert sound, but it wasn’t in the right context. It wasn’t my phone, or my PC… eventually I realised it was the noise the our car makes when you are low on fuel (a soft ‘bong’ on recent BMWs). Looking out the window, way down the street was someone loading their BMW with stuff, setting off an alarm.

Anyway, context is important for alarms. The presentation is interesting.

Leave a Comment

Filed under Uncategorized

This made me smile…

“After all, while it might be OK for the laptop support group to reformat your laptop when they can no longer cope with the increasing complexity of desktop operating systems, reformatting the network usually isn’t an option.”
This is what makes networking so complex

Leave a Comment

Filed under Uncategorized

Serial Consoles – Windows Edition

Small update on console servers: Having actually tried, HW Software VSP is the thing to get for adding a virtual COM port to Windows. You need to get the singleport version, and then point it at the ‘telnet’ protocol port on your ser2net server. Now you can change the baud rate and other settings in your Windows app (e.g. Hyperterminal) and the settings are passed through to the remote serial port.

Finally you can virtualise that application with the weird serial hardware!

Leave a Comment

Filed under Uncategorized