May 23, 2014
0 notes

Hacky workaround for keyboard focus problems with stumpwm (e.g. with Java apps)

As a horrible workaround, since there are some apps I occasionally use like the Dell BMC remote console Java app, I run:

  • Xephyr as a nested X server : Xephyr :1
  • Set the DISPLAY variable to point at this in a single xterm : export DISPLAY=:1.0
  • Run metacity in this terminal to get the GNOME window manager on that display : metacity &
  • Now run the problematic app. E.g. javasw jviewer.jnlp
  • Enjoy a functioning keyboard in your java app! Woo :)
May 23, 2014
0 notes

pidgin on SL6 — “Read Error” connecting to Microsoft Lync Server

I got this after a restart and had forgotten the fix! Run pidgin setting this variable as a workaround for the problem:

NSS_SSL_CBC_RANDOM_IV=0 pidgin

This is in the Pidgin SIPE plugin FAQ but I needed to look it up again, so it’s here as a reminder to myself for next time :)

May 20, 2014
0 notes

puppet / hiera yaml and indentation gotcha

I recently switched to using the official puppetlabs/apache module rather than the cobbled-together one I made yonks ago and have had limping along. Then I was beating my head against my hiera configs in Puppet for a while, wondering why my additions were being ignored. A vhost with rewrites, created in a manifest file was working just fine, so it seemed likely that i was doing something wrong rather than a bug in the module.

Of course, it was because I’d laid something out incorrectly in my hiera data structure…

This:

site::apache::vhosts:
  testvhost.example.org:
    docroot: '/var/www/something'
    rewrites:
      - Test rewrite:
          rewrite_rule: [ '/somewhere http://other.example.org/somewhere' ]
      - Test rewrite2:
          rewrite_cond: [ '%{QUERY_STRING} ^var=val$' ]
          rewrite_rule: [ '/somewhere2 http://other.example.org/somewhere2' ]

..is not the same as this:

site::apache::vhosts:
  testvhost.example.org:
    docroot: '/var/www/something'
    rewrites:
      - Test rewrite:
        rewrite_rule: [ '/somewhere http://other.example.org/somewhere' ]
      - Test rewrite2:
        rewrite_cond: [ '%{QUERY_STRING} ^var=val$' ]
        rewrite_rule: [ '/somewhere2 http://other.example.org/somewhere2' ]

The former has an additional (and unwanted) extra layer of hash-ness in the generated rewrites data structure. Of course, instead of validating this the module and template just ignore it. Thankfully, the command-line ‘hiera’ tool came to the rescue:

hiera --hash site::apache::vhosts fqdn=host.example.org

{"testvhost.example.org"=>
  {"rewrites"=>
    [{"rewrite_rule"=>
       ["/somewhere http://other.example.org/somewhere"]},
     {"rewrite_rule"=>
       ["/somewhere2 http://other.example.org/somewhere2"],
      "rewrite_cond"=>["%{QUERY_STRING} ^var=val$"]},
  "docroot"=>"/var/www/wwwroot"}}

At least in this format it’s obvious how nested the hiera-produced data has become. This is the correct format — the incorrect one had an extra layer of curly braces which made it clearer (at least to me!) how the data was laid out.

Still can’t say I’m a fan of significant indentation, but the worst thing here is the silent breakage — there definitely needs to be more validation that the structure is of the expected form :/

Dec 17, 2013
0 notes

Generate bogus MAC according to IP address

To produce a MAC address from an IP address, to ensure uniqueness when adding to DHCP settings, say:

alias p=printf
function genmac {
    p 20;p ':%02X' 0 ${1//./ }
}

Now use genmac 127.0.0.1 and you’ll have a MAC address you can use in your configs without fear of clashes. Lovely :D

Dec 10, 2013
0 notes

Making a bootable USB stick from a Windows DVD iso

In my attempts to turn a backup iso of a Dell OEM Windows DVD into a bootable USB stick (to reinstall a Dell desktop machine), I found many and varied accounts of how to achieve this.

There are loads of tools to help with this — winusb, unetbootin and so on, but I couldn’t get them to work.

However, it turns out that for a simple single boot image USB stick (which was all I wanted at the time) all you need is:

  • A single FAT32 or NTFS partition
  • The contents of the Windows DVD copied onto that partition
  • A Windows MBR on the USB stick

…and it Just Works{tm}.

So it should be as simple as:

  • Ensure the usb stick is unmounted — probably using pumount /dev/sd<something>
  • fdisk /dev/sdx (or whatever device the usb stick has shown up as), remove all existing partitions and create a single partition set as NTFS or FAT32 (LBA)
  • mkfs.ntfs (or mkfs.vfat) /dev/sdx1
  • Mount this somewhere with mount /dev/sdx1 /media/usb, or eject and re-insert the stick
  • Copy the contents of the iso onto the USB stick — you can either extract the contents using 7z x backup.iso or by loopback mounting the iso with mount -o ro,loop backup.iso /media/loop and then copying
  • Use ms-sys to put a standard windows MBR on the USB stick
  • And that’s it! (The only tool required is ms-sys, but that should be packaged by your distro or it’s trivial to build from sources)

The same should also be true to creating such a bootable USB stick from Windows, just using fdisk /mbr on the usb device in place of ms-sys.

(The available tools are probably a better bet if you want to have a multi-boot stick and a menu to pick what to boot, but this will do for a simple single-use stick)

Oct 17, 2013
0 notes

modinfo — show options available to linux kernel modules

e.g. modinfo iwlwifi

Really quite useful when fiddling with the options available to see if you can make your Intel wireless card actually work properly under Linux…

It seems there are a lot of reported problems with 802.11n support on the Intel wireless chipsets over a couple of years, but no proper fixes yet :(

Oct 8, 2013
0 notes

Debian unstable stumpwm “cannot find component” errors

It seems that there is a bug with the current Debian unstable asdf which causes Lisp compilers to fail to find the installed components if the XDG_DATA_DIRS variable is not set. This variable is set if you use Gnome, but when not set asdf fails to use a default setting for where to look for systems or source and so doesn’t find anything at all!

This has been reported as Debian bug 723977 and a fix is in testing so hopefully it will be updated soon.

As a workaround, you can add the following to a file which is included by the common-lisp-controller, such as /home/username/.config/common-lisp/source-registry.conf.d/system.conf (anything in the ~/.config/common-lisp/source-registry.conf.d directory is included, so you can have multiple separate files in here), containing:

(:tree "/usr/share/common-lisp/source/")

..and this will allow all lisp compilers/interpreters to find the installed packages. It used to be that symlinks were required from /usr/share/common-lisp/systems/ into the individual package directories, but this has been deprecated in favour of it searching the source tree.

This took me a while to find, so I thought it would be good to share this for others to find and save some time and pain :)

Jul 7, 2013
0 notes

Outrun Cannonball OpenGL output

OpenGL rendering added which improved performance considerably :D

Apr 1, 2013
0 notes

DVD ripping part 2 — ddrescue, “dvdbackup —mirror” and “dvdbackup —feature”

So I’ve got things working a bit better now. There have still been one or two that haven’t ripped using one of these three methods, but this covers 99% of my DVDs that I want to play with MythTV:

  • Method 1 : ddrescue

    ddrescue -n -b 2048 /dev/sr0 dvdtitle.iso dvdtitle.log
    

    When this works you might get one or two error sectors, but most of the disc will rip without error. These errors are intentionally added as part of the copy-protection. This gives a DVD iso image which mythvideo is happy to play.

  • Method 2 : dvdbackup —mirror

    This produces a VIDEO_TS folder which, again, mythvideo is happy to play. Sometimes this doesn’t work, or produces a damaged rip which is several times the size of the real DVD. If it’s bigger than about 10GB then this probably won’t play, so try method 3:

  • Method 3 : dvdbackup —feature

    This produces a VIDEO_TS folder, but often mythvideo won’t play it. mplayer is generally happy to play this.

All in all, still a bit of a pain but at least I can play most of the DVDs I own now!

Mar 29, 2013
0 notes

Moved from Posterous to Tumblr…

Blog moved since Posterous is closing soon to “concentrate on Twitter”… Hopefully the RSS feed will continue working (need to check on this!)

http://Justmigrate.com was a big help to move the posts across but the (very few) comments can’t be migrated on this way, so apologies to both commenters when on the previous host!

The main features I was using were post-by- email and Markdown for formatting, both of which are available on Tumblr. Phew :D

Navigate
« To the past Page 1 of 3
About