Openconnect on Fedora 29

As of 7 Dec 2018, this is fixed in the vpnc-script package in the updates repo. Version 20171004-4.git6f87b0f or later.

As of Nov 2018, openconnect appears to be broken on Fedora 29. When you connect to a VPN, the DNS servers are not updated and hence any hosts over the VPN will not resolve.

This has been reported on bugzilla but in the meantime the following fix works.

Create a copy of /etc/vpnc/vpnc-script to apply fixes.

cp /etc/vpnc/vpnc-script /etc/vpnc/vpnc-script-fixed

Comment out the lines about resolvconf:

--- /etc/vpnc/vpnc-script	2018-07-15 17:21:15.000000000 +0100
+++ /etc/vpnc/vpnc-script-fixed	2018-11-23 14:30:46.554019322 +0000
@@ -131,9 +131,9 @@
 elif [ -x /usr/bin/busctl ] && [ ${RESOLVEDENABLED} = 1 ]; then  # For systemd-resolved (version 229 and above)
-elif [ -x /sbin/resolvconf ]; then # Optional tool on Debian, Ubuntu, Gentoo and FreeBSD
-	MODIFYRESOLVCONF=modify_resolvconf_manager
-	RESTORERESOLVCONF=restore_resolvconf_manager
+#elif [ -x /sbin/resolvconf ]; then # Optional tool on Debian, Ubuntu, Gentoo and FreeBSD
+#	MODIFYRESOLVCONF=modify_resolvconf_manager
+#	RESTORERESOLVCONF=restore_resolvconf_manager
 elif [ -x /sbin/netconfig ]; then # tool on Suse after 11.1

Then supply this as an argument to openconnect:

/usr/sbin/openconnect -s /etc/vpnc/vpnc-script-fixed <args> hostname

Draw fysom defined state machines

If you have a finite state machine defined using the Python fysom library it is often useful to see how it looks in graphical form.

Take the following machine (from the fysom readme).

from fysom import Fysom

fsm = Fysom({
    'initial': 'green',
    'events': [
        {'name': 'warn', 'src': 'green', 'dst': 'yellow'},
        {'name': 'panic', 'src': 'yellow', 'dst': 'red'},
        {'name': 'calm', 'src': 'red', 'dst': 'yellow'},
        {'name': 'clear', 'src': 'yellow', 'dst': 'green'}

This can be displayed using networkx and nxpd

import networkx as nx
from nxpd import draw

G = nx.MultiDiGraph()

for event, transitions in fsm._map.items():
    for from_state, to_state in transitions.items():
        G.add_edges_from([(from_state, to_state)], label=event)


This will generate the image below:

This also works inside iPython/Jupyter notebooks – just call the draw function as

draw(G, show='ipynb')

NVIDIA CUDA under Fedora 21


As of May 2015, NVIDIA CUDA is not officially supported under Fedora 21. According to their website they plan to release CUDA 7 for FC21, but until then you can still install CUDA 6.5 using the official packages. If you are trying to install under Fedora 20 then follow this tutorial.

Install cuda-repo-fedora20-6.5-14.x86_64.rpm from the NVIDIA site.  This will add a new “cuda” repo from where you can install the cuda packages:

sudo yum install xorg-x11-drv-nvidia-cuda


The cuda codebase will not compile under GCC 5 (the default for Fedora 21) but you can just remove the warning and everything works fine (thanks to plebean_student on reddit for the tip).



and comment out the following line:

#error -- unsupported GNU version! gcc 4.9 and up are not supported!

Build the examples

Setup your environment to point to the installed CUDA libraries and binaries:

export CUDA_HOME=/usr/local/cuda-6.5 
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 
export PATH 

Create a new directory for the examples and build them:  ~ 
cd ~/NVIDIA_CUDA-6.5_Samples 
make -j10

Run some examples to check they work ok:


Jenkins and pep257 warnings

Want to get your Python pep257 docstring errors in a Jenkins job?  Then you can use the Jenkins Warnings plugin with a custom parser.  These can be added under “Manage Jenkins” > “Configure System” and in the “Compiler Warnings” section.

Add a new parser (I set “Name”, “Link name” and “Trend report name” to “pep257”) with the following settings:

Regular Expression


Mapping Script

import hudson.plugins.warnings.parser.Warning

String fileName =;
String lineNumber =;
String category =;
String message = + ":" +;

return new Warning(fileName, Integer.parseInt(lineNumber), "Dynamic Parser", category, message);

Example Log Message in private nested class `meta`:
        D101: Docstring missing in public method `method`:
        D102: Docstring missing

Jenkins job

Also worth remembering that pep257 returns an exit code of 1 if it finds any problems. This will cause the Jenkins job to be marked as failure. To avoid this change the exit code:

find . -name '*.py' | xargs pep257 || true

Fedora 21 PyYAML fails to update

Spotted some errors after upgrading to Fedora 21 with PyYAML failing when doing a yum update:

Error unpacking rpm package PyYAML-3.11-6.fc21.x86_64
error: unpacking of archive failed on file /usr/lib64/python2.7/site-packages/PyYAML-3.11-py2.7.egg-info: cpio: rename
error: PyYAML-3.11-6.fc21.x86_64: install failed
  PyYAML.x86_64 0:3.10-10.fc20                  PyYAML.x86_64 0:3.11-6.fc21

The fix for this is to remove the temporary installation files for version 3.11:

rm -rf /usr/lib64/python2.7/site-packages/PyYAML-3.11-py2.7.egg-info*

Then yum update will work correctly

pylint in Vim

I’m a big fan of Vim and I do lots of Python programming and I like to ensure my code passes static analysis (using pylint).  To hook these together I added the following to my .vimrc file.

autocmd FileType python set makeprg=pylint\ --reports=n\ --msg-template=\"{path}:{line}:\ {msg_id}\ {symbol},\ {obj}\ {msg}\"\ %:p
autocmd FileType python set errorformat=%f:%l:\ %m

When you have a python file open :make runs pylint and shows the results in the quickfix window so you can jump to the line with the problem.

Vim pylint integration

More CPAN issues in Fedora 20

Following on from may last post about CPAN in Fedora 20, I faced another problem on a machine I upgraded.  cpan would fail to load with the error:

Attempt to reload Scalar/ aborted.
Compilation failed in require at /usr/share/perl5/ line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/ line 4.
Compilation failed in require at /usr/share/perl5/ line 56.
BEGIN failed--compilation aborted at /usr/share/perl5/ line 56.
Compilation failed in require at /usr/share/perl5/App/ line 218.
BEGIN failed--compilation aborted at /usr/share/perl5/App/ line 218.
Compilation failed in require at /bin/cpan line 9.
BEGIN failed--compilation aborted at /bin/cpan line 9.

The problem I found was in the List::Util library, this library needs to removed and reinstalled.  But you have to use yum (as CPAN is broken!)  In order to force yum to do its job, you need to remove the offending files first:

find /usr/ -wholename "*/List/Util*" -delete

After this force a reinstall using yum:

yum reinstall perl-Scalar-List-Utils -y

CPAN should then start running at this point.

CPAN problems in Fedora 20

After a recent Fedora 20 update my Perl libraries are broken. This appears to be a common problem with Fedora updates.

When trying to use cpan it kept failing when building the database with error:

install_driver(SQLite) failed: Perl API version v5.16.0 of does not match v5.18.0 at /usr/lib64/perl5/ line 213, line 138944.
Compilation failed in require at (eval 45) line 3, line 138944. at /usr/local/share/perl5/CPAN/SQLite/ line 78.

This is caused by some old files that have moved location (“yum provides” shows no Fedora package installs this any more). Just remove that directory:

rm -rf /usr/local/share/perl5/CPAN/SQLite

And it all works fine.

I had some other problems using other Perl libs due to C API mismatch problems:

Perl API version v5.16.0 of HTML::Parser does not match v5.18.0 at /usr/share/perl5/ line 92.

This can simply be fixed by forcing a reinstall in cpan of the problem module:

force install HTML::Parser

NAT forwarding under Linux

Easy setup of NAT forwarding using iptables under Linux (this was only tested on Fedora 18):

sysctl -w net.ipv4.ip_forward=1
iptables -F